diff options
Diffstat (limited to 'lib/python')
| -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 | ||||
| -rw-r--r-- | lib/python/Tools/Makefile.am | 2 | ||||
| -rw-r--r-- | lib/python/Tools/Notifications.py | 13 | ||||
| -rw-r--r-- | lib/python/Tools/__init__.py | 2 |
6 files changed, 60 insertions, 9 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): diff --git a/lib/python/Tools/Makefile.am b/lib/python/Tools/Makefile.am index d2054589..bee4dde1 100644 --- a/lib/python/Tools/Makefile.am +++ b/lib/python/Tools/Makefile.am @@ -1,4 +1,4 @@ installdir = $(LIBDIR)/enigma2/python/Tools install_DATA = \ - FuzzyDate.py XMLTools.py Directories.py NumericalTextInput.py KeyBindings.py BoundFunction.py ISO639.py __init__.py + FuzzyDate.py XMLTools.py Directories.py NumericalTextInput.py KeyBindings.py BoundFunction.py ISO639.py Notifications.py __init__.py diff --git a/lib/python/Tools/Notifications.py b/lib/python/Tools/Notifications.py new file mode 100644 index 00000000..b547639b --- /dev/null +++ b/lib/python/Tools/Notifications.py @@ -0,0 +1,13 @@ + +notifications = [ ] + +notificationAdded = [ ] + +def AddNotification(screen, *args): + AddNotificationWithCallback(None, screen, *args) + +def AddNotificationWithCallback(fnc, screen, *args): + notifications.append((fnc, screen) + args) + for x in notificationAdded: + x() + diff --git a/lib/python/Tools/__init__.py b/lib/python/Tools/__init__.py index 2d7c2efa..df963dad 100644 --- a/lib/python/Tools/__init__.py +++ b/lib/python/Tools/__init__.py @@ -1 +1 @@ -all = ["FuzzyDate.py", "XMLTools.py", "Directories.py", "KeyBindings.py", "BoundFunction.py", "ISO639.py"] +all = ["FuzzyDate.py", "XMLTools.py", "Directories.py", "KeyBindings.py", "BoundFunction.py", "ISO639.py", "Notifications"] |
