diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-11-30 00:16:24 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-11-30 00:16:24 +0000 |
| commit | 3db964eee299eae5c98a48753a096fe7786af29a (patch) | |
| tree | 94c6a909b1365428c2e2ea012a852cf4d1631f6b /lib/python/Screens | |
| parent | fdde0706735b9c687a22f7aed393174801cbf139 (diff) | |
| download | enigma2-3db964eee299eae5c98a48753a096fe7786af29a.tar.gz enigma2-3db964eee299eae5c98a48753a096fe7786af29a.zip | |
add notifications
Diffstat (limited to 'lib/python/Screens')
| -rw-r--r-- | lib/python/Screens/InfoBar.py | 12 | ||||
| -rw-r--r-- | lib/python/Screens/InfoBarGenerics.py | 24 | ||||
| -rw-r--r-- | lib/python/Screens/Screen.py | 16 |
3 files changed, 45 insertions, 7 deletions
diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 62e4fcd2..3ddb1c3c 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -7,10 +7,12 @@ from Components.Clock import Clock from Components.ActionMap import ActionMap from Components.ServicePosition import ServicePosition +from Tools.Notifications import AddNotificationWithCallback + from Screens.InfoBarGenerics import InfoBarVolumeControl, InfoBarShowHide, \ InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \ InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \ - InfoBarAudioSelection, InfoBarAdditionalInfo + InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications from Screens.HelpMenu import HelpableScreen, HelpMenu @@ -21,7 +23,7 @@ import time class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, - HelpableScreen, InfoBarAdditionalInfo): + HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications): def __init__(self, session): Screen.__init__(self, session) @@ -35,7 +37,7 @@ class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \ - InfoBarAdditionalInfo: + InfoBarAdditionalInfo, InfoBarNotifications: x.__init__(self) self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")])) @@ -51,7 +53,7 @@ class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, class MoviePlayer(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ InfoBarMenu, \ - InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, HelpableScreen): + InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications): def __init__(self, session, service): Screen.__init__(self, session) @@ -61,7 +63,7 @@ class MoviePlayer(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey "leavePlayer": self.leavePlayer }) - for x in HelpableScreen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection: + for x in HelpableScreen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, InfoBarNotifications: x.__init__(self) self["CurrentTime"] = ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 978a1134..c1842796 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -20,6 +20,8 @@ from Screens.Mute import Mute from Screens.Standby import Standby from Screens.EventView import EventView +from Tools import Notifications + #from enigma import eTimer, eDVBVolumecontrol, quitMainloop from enigma import * @@ -522,4 +524,24 @@ class InfoBarAdditionalInfo: self["ButtonRedText"] = Label(_("Record")) self["ButtonGreen"] = Pixmap() self["ButtonYellow"] = Pixmap() - self["ButtonBlue"] = Pixmap()
\ No newline at end of file + self["ButtonBlue"] = Pixmap() + +class InfoBarNotifications: + def __init__(self): + self.onExecBegin.append(self.checkNotifications) + Notifications.notificationAdded.append(self.checkNotificationsIfExecing) + + def checkNotificationsIfExecing(self): + if self.execing: + self.checkNotifications() + + def checkNotifications(self): + if len(Notifications.notifications): + n = Notifications.notifications[0] + Notifications.notifications = Notifications.notifications[1:] + print "open",n + cb = n[0] + if cb is not None: + self.session.openWithCallback(cb, *n[1:]) + else: + self.session.open(*n[1:]) diff --git a/lib/python/Screens/Screen.py b/lib/python/Screens/Screen.py index 13e31d67..231cbfaa 100644 --- a/lib/python/Screens/Screen.py +++ b/lib/python/Screens/Screen.py @@ -15,26 +15,40 @@ class Screen(dict, HTMLSkin, GUISkin): self.onExecBegin = [ ] self.onShown = [ ] + self.execing = False + # in order to support screens *without* a help, # we need the list in every screen. how ironic. self.helpList = [ ] def execBegin(self): + self.active_components = [ ] for x in self.onExecBegin: x() + if self.session.currentDialog != self: + return + # assert self.session == None, "a screen can only exec one per time" # self.session = session + for (name, val) in self.items(): val.execBegin() + if self.session.currentDialog != self: + return + self.active_components.append(val) + self.execing = True + for x in self.onShown: x() def execEnd(self): - for (name, val) in self.items(): +# for (name, val) in self.items(): + for val in self.active_components: val.execEnd() # assert self.session != None, "execEnd on non-execing screen!" # self.session = None + self.execing = False # never call this directly - it will be called from the session! def doClose(self): |
