+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 = 1
+# 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!"
+ if not Screens.Standby.inTryQuitMainloop:
+ self.session.open(Screens.Standby.TryQuitMainloop, 1)
+
+ 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 not Screens.Standby.inStandby and self.session.current_dialog and self.session.current_dialog.ALLOW_SUSPEND:
+ self.session.open(Screens.Standby.Standby)
+
+from Screens.Scart import Scart
+
+class AutoScartControl:
+ def __init__(self, session):
+ self.force = False
+ self.current_vcr_sb = eAVSwitch.getInstance().getVCRSlowBlanking()
+ if self.current_vcr_sb and config.av.vcrswitch.value:
+ self.scartDialog = session.instantiateDialog(Scart, True)