+ def volMute(self, showMuteSymbol=True, force=False):
+ vol = self.volctrl.getVolume()
+ if vol or force:
+ self.volctrl.volumeToggleMute()
+ if self.volctrl.isMuted():
+ if showMuteSymbol:
+ self.muteDialog.show()
+ self.volumeDialog.setValue(0)
+ else:
+ self.muteDialog.hide()
+ self.volumeDialog.setValue(vol)
+
+from Screens.Standby import Standby
+
+class PowerKey:
+ """ PowerKey stuff - handles the powerkey press and powerkey release actions"""
+
+ def __init__(self, session):
+ self.session = session
+ self.powerKeyTimer = eTimer()
+ self.powerKeyTimer.timeout.get().append(self.powertimer)
+ globalActionMap.actions["powerdown"]=self.powerdown
+ globalActionMap.actions["powerup"]=self.powerup
+ self.standbyblocked = 0
+# self["PowerKeyActions"] = HelpableActionMap(self, "PowerKeyActions",
+ #{
+ #"powerdown": self.powerdown,
+ #"powerup": self.powerup,
+ #"discreteStandby": (self.standby, "Go standby"),
+ #"discretePowerOff": (self.quit, "Go to deep standby"),
+ #})
+
+ def powertimer(self):
+ print "PowerOff - Now!"
+ self.quit()
+
+ def powerdown(self):
+ self.standbyblocked = 0
+ self.powerKeyTimer.start(3000, True)
+
+ def powerup(self):
+ self.powerKeyTimer.stop()
+ if self.standbyblocked == 0:
+ self.standbyblocked = 1
+ self.standby()
+
+ def standby(self):
+ if self.session.current_dialog and self.session.current_dialog.ALLOW_SUSPEND:
+ self.session.open(Standby, self)
+
+ def quit(self):
+ # halt
+ quitMainloop(1)