diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-11-12 23:23:21 +0000 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-11-12 23:23:21 +0000 |
| commit | a304ed63ef86c02d1c74b342b619edff642a164b (patch) | |
| tree | b823c1f26ef5b8e26186819f3a2697e9e18f73bd /lib/python | |
| parent | f3382e42e8c28c692f50ddee5fedcae55652edeb (diff) | |
| download | enigma2-a304ed63ef86c02d1c74b342b619edff642a164b.tar.gz enigma2-a304ed63ef86c02d1c74b342b619edff642a164b.zip | |
adding a sleep timer
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/Screens/Makefile.am | 3 | ||||
| -rw-r--r-- | lib/python/Screens/SleepTimerEdit.py | 96 |
2 files changed, 98 insertions, 1 deletions
diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index 455209fc..b4e28e3c 100644 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -11,4 +11,5 @@ install_PYTHON = \ TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \ Console.py InputBox.py ChoiceBox.py SimpleSummary.py ImageWizard.py \ MediaPlayer.py TimerSelection.py PictureInPicture.py TimeDateInput.py \ - SubtitleDisplay.py SubservicesQuickzap.py ParentalControlSetup.py NumericalTextInputHelpDialog.py + SubtitleDisplay.py SubservicesQuickzap.py ParentalControlSetup.py NumericalTextInputHelpDialog.py \ + SleepTimerEdit.py diff --git a/lib/python/Screens/SleepTimerEdit.py b/lib/python/Screens/SleepTimerEdit.py new file mode 100644 index 00000000..ac500665 --- /dev/null +++ b/lib/python/Screens/SleepTimerEdit.py @@ -0,0 +1,96 @@ +from Screens.Screen import Screen +from Screens.MessageBox import MessageBox +from Components.ActionMap import NumberActionMap +from Components.Input import Input +from Components.Label import Label +from Components.Pixmap import Pixmap +from Components.config import config +from SleepTimer import SleepTimerEntry +import time + +class SleepTimerEdit(Screen): + def __init__(self, session): + Screen.__init__(self, session) + + self["red"] = Pixmap() + self["green"] = Pixmap() + self["yellow"] = Pixmap() + self["blue"] = Pixmap() + self["red_text"] = Label() + self["green_text"] = Label() + self["yellow_text"] = Label() + self["blue_text"] = Label() + self.updateColors() + + self["pretext"] = Label(_("Shutdown Dreambox after")) + self["input"] = Input(text = str(self.session.nav.SleepTimer.getCurrentSleepTime()), maxSize = False, type = Input.NUMBER) + self["aftertext"] = Label(_("minutes")) + + self["actions"] = NumberActionMap(["SleepTimerEditorActions"], + { + "exit": self.close, + "select": self.select, + "1": self.keyNumberGlobal, + "2": self.keyNumberGlobal, + "3": self.keyNumberGlobal, + "4": self.keyNumberGlobal, + "5": self.keyNumberGlobal, + "6": self.keyNumberGlobal, + "7": self.keyNumberGlobal, + "8": self.keyNumberGlobal, + "9": self.keyNumberGlobal, + "0": self.keyNumberGlobal, + "selectLeft": self.selectLeft, + "selectRight": self.selectRight, + "disableTimer": self.disableTimer, + "toggleAction": self.toggleAction, + "toggleAsk": self.toggleAsk + }, -1) + + def updateColors(self): + if self.session.nav.SleepTimer.isActive(): + self["red_text"].setText(_("Timer status:") + " " + _("Enabled")) + else: + self["red_text"].setText(_("Timer status:") + " " + _("Disabled")) + if config.SleepTimer.action.value == "shutdown": + self["green_text"].setText(_("Sleep timer action:") + " " + _("Deep Standby")) + elif config.SleepTimer.action.value == "standby": + self["green_text"].setText(_("Sleep timer action:") + " " + _("Standby")) + + if config.SleepTimer.ask.value: + self["yellow_text"].setText(_("Ask before shutdown:") + " " + _("yes")) + else: + self["yellow_text"].setText(_("Ask before shutdown:") + " " + _("no")) + self["blue_text"].setText(_("Settings")) + + + def select(self): + self.session.nav.SleepTimer.setSleepTime(int(self["input"].getText())) + self.session.openWithCallback(self.close, MessageBox, _("The sleep timer has been acitvated."), MessageBox.TYPE_INFO) + + def keyNumberGlobal(self, number): + self["input"].number(number) + + def selectLeft(self): + self["input"].left() + + def selectRight(self): + self["input"].right() + + def disableTimer(self): + if self.session.nav.SleepTimer.isActive(): + self.session.nav.SleepTimer.clear() + else: + self.session.nav.SleepTimer.setSleepTime(int(self["input"].getText())) + self.updateColors() + + def toggleAction(self): + if config.SleepTimer.action.value == "shutdown": + config.SleepTimer.action.value = "standby" + elif config.SleepTimer.action.value == "standby": + config.SleepTimer.action.value = "shutdown" + self.updateColors() + + def toggleAsk(self): + config.SleepTimer.ask.value = not config.SleepTimer.ask.value + self.updateColors()
\ No newline at end of file |
