Move sleeptimer notifications to InfoBarGenerics
authorLittlesat <littlesat99@yahoo.com>
Wed, 13 Mar 2013 07:38:48 +0000 (08:38 +0100)
committerLittlesat <littlesat99@yahoo.com>
Wed, 13 Mar 2013 07:38:48 +0000 (08:38 +0100)
So you also get a notification in case you extend or abort a Sleeptimer

lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/SleepTimerEdit.py

index f765193..de053dd 100644 (file)
@@ -2522,7 +2522,6 @@ class InfoBarPowersaver:
                self.restartInactiveTimer()
                self.sleepTimer = eTimer()
                self.sleepTimer.callback.append(self.sleepTimerTimeout)
-               self.setSleepTimer(0)
                eActionMap.getInstance().bindAction('', -maxint - 1, self.keypress)
 
        def keypress(self, key, flag):
@@ -2556,9 +2555,17 @@ class InfoBarPowersaver:
        def setSleepTimer(self, time):
                print "[InfoBarPowersaver] set sleeptimer", time
                if time:
+                       if time < 0:
+                               message = _("And will shutdown your receiver over ")
+                       else:
+                               message = _("And will put your receiver in standby over ")
+                       m = abs(time / 60)
+                       message = _("The sleep timer has been activated.") + "\n" + message + ngettext("%d minute", "%d minutes", m) % m
                        self.sleepTimer.startLongTimer(abs(time))
                else:
+                       message = _("The sleep timer has been disabled.")
                        self.sleepTimer.stop()
+               Notifications.AddPopup(message, type = MessageBox.TYPE_INFO, timeout = 5)
                self.sleepTimerSetting = time
 
        def sleepTimerTimeout(self):
index b2e787d..0d1b94e 100644 (file)
@@ -6,7 +6,6 @@ from Components.ConfigList import ConfigListScreen
 from Components.Label import Label
 from Components.Sources.StaticText import StaticText
 from Components.config import config, getConfigListEntry
-from Tools.Notifications import AddPopup
 from enigma import eEPGCache
 from time import time
 
@@ -53,18 +52,7 @@ class SleepTimerEdit(ConfigListScreen, Screen):
                                sleepTimer = self.currentEventTime()
                        else:
                                sleepTimer = int(sleepTimer)
-                       if sleepTimer:
-                               if sleepTimer < 0:
-                                       message = _("And will shutdown your receiver over ")
-                               else:
-                                       message = _("And will put your receiver in standby over ")
-                               m = abs(sleepTimer / 60)
-                               message = _("The sleep timer has been activated.") + "\n" + message + ngettext("%d minute", "%d minutes", m) % m
-                               InfoBar.instance.setSleepTimer(sleepTimer)
-                       else:
-                               message = _("The sleep timer has been disabled.")
-                               InfoBar.instance.setSleepTimer(0)
-                       AddPopup(message, type = MessageBox.TYPE_INFO, timeout = 5)
+                       InfoBar.instance.setSleepTimer(sleepTimer)
                        self.close(True)
                self.close()