From: Andreas Monzner Date: Tue, 22 Apr 2008 16:30:20 +0000 (+0000) Subject: deliver service events only to last created class which is based on X-Git-Tag: 2.6.0~1302 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/ef1a9823a5da0c626766dad7afc858e15b57a2d0?hp=fc5e9eff8617503e21ea4181ba5b312d7d177cff deliver service events only to last created class which is based on InfoBarBase --- diff --git a/lib/python/Components/ServiceEventTracker.py b/lib/python/Components/ServiceEventTracker.py index 20460436..89c339f8 100644 --- a/lib/python/Components/ServiceEventTracker.py +++ b/lib/python/Components/ServiceEventTracker.py @@ -1,15 +1,49 @@ +class InfoBarBase: + def __init__(self): + ServiceEventTracker.setActiveInfoBar(self) + self.onClose.append(self.__close) + + def __close(self): + ServiceEventTracker.popActiveInfoBar() + class ServiceEventTracker: """Tracks service events into a screen""" - + InfoBarStack = [ ] + InfoBarStackSize = 0 + def __init__(self, screen, eventmap): self.__eventmap = eventmap - self.session = screen.session - self.session.nav.event.append(self.__event) + self.screen = screen + screen.session.nav.event.append(self.__event) screen.onClose.append(self.__del_event) def __del_event(self): - self.session.nav.event.remove(self.__event) + self.screen.session.nav.event.remove(self.__event) def __event(self, ev): + set = ServiceEventTracker + ssize = set.InfoBarStackSize + stack = set.InfoBarStack if ev in self.__eventmap: - self.__eventmap[ev]() + if not isinstance(self.screen, InfoBarBase) or (ssize and stack[ssize-1] == self.screen): + self.__eventmap[ev]() +# else: +# print "ignore event", ev, "for inactive infobar '" + str(self.screen) + "'" + + @staticmethod + def setActiveInfoBar(infobar): + set = ServiceEventTracker + assert infobar not in set.InfoBarStack, "FATAL: Infobar '" + str(infobar) + "' is already active!" + set.InfoBarStack.append(infobar) + set.InfoBarStackSize += 1 +# print "ServiceEventTracker set active '" + str(infobar) + "'" + + @staticmethod + def popActiveInfoBar(): + set = ServiceEventTracker + stack = set.InfoBarStack + if set.InfoBarStackSize: + set.InfoBarStackSize -= 1 + del stack[set.InfoBarStackSize] +# if set.InfoBarStackSize: +# print "ServiceEventTracker reset active '" + str(stack[set.InfoBarStackSize-1]) + "'" diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index 4cbb8930..61acf042 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -5,7 +5,7 @@ from Screens.MessageBox import MessageBox from Components.ServicePosition import ServicePositionGauge from Components.ActionMap import HelpableActionMap from Components.MultiContent import MultiContentEntryText -from Components.ServiceEventTracker import ServiceEventTracker +from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase from Components.VideoWindow import VideoWindow from Screens.InfoBarGenerics import InfoBarSeek, InfoBarCueSheetSupport from Components.GUIComponent import GUIComponent @@ -144,7 +144,7 @@ class CutList(GUIComponent): if self.instance is not None: self.instance.moveSelectionTo(index) -class CutListEditor(Screen, InfoBarSeek, InfoBarCueSheetSupport, HelpableScreen): +class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, HelpableScreen): skin = """ @@ -171,6 +171,7 @@ class CutListEditor(Screen, InfoBarSeek, InfoBarCueSheetSupport, HelpableScreen) Screen.__init__(self, session) InfoBarSeek.__init__(self, actionmap = "CutlistSeekActions") InfoBarCueSheetSupport.__init__(self) + InfoBarBase.__init__(self) HelpableScreen.__init__(self) self.old_service = session.nav.getCurrentlyPlayingServiceReference() session.nav.playService(service) diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 3ecd9f8a..fd048695 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -10,7 +10,7 @@ from Screens.InfoBarGenerics import InfoBarSeek, InfoBarPVRState, InfoBarCueShee from Components.ActionMap import ActionMap, NumberActionMap, HelpableActionMap from Components.Label import Label from Components.FileList import FileList -from Components.ServiceEventTracker import ServiceEventTracker +from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase from Components.config import config from Components.ProgressBar import ProgressBar from ServiceReference import ServiceReference @@ -147,7 +147,7 @@ class ChapterZap(Screen): self.Timer.callback.append(self.keyOK) self.Timer.start(3000, True) -class DVDPlayer(Screen, InfoBarNotifications, InfoBarSeek, InfoBarCueSheetSupport, InfoBarPVRState, InfoBarShowHide, HelpableScreen): +class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarCueSheetSupport, InfoBarPVRState, InfoBarShowHide, HelpableScreen): ALLOW_SUSPEND = True ENABLE_RESUME_SUPPORT = True @@ -220,6 +220,7 @@ class DVDPlayer(Screen, InfoBarNotifications, InfoBarSeek, InfoBarCueSheetSuppor def __init__(self, session, args = None): Screen.__init__(self, session) + InfoBarBase.__init__(self) InfoBarNotifications.__init__(self) InfoBarCueSheetSupport.__init__(self, actionmap = "MediaPlayerCueSheetActions") InfoBarShowHide.__init__(self) diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 68645842..93765628 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -12,7 +12,7 @@ from Components.FileList import FileList from Components.MediaPlayer import PlayList from Tools.Directories import resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCOPE_SKIN_IMAGE from Components.ServicePosition import ServicePositionGauge -from Components.ServiceEventTracker import ServiceEventTracker +from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase from Components.Playlist import PlaylistIOInternal, PlaylistIOM3U, PlaylistIOPLS from Screens.InfoBarGenerics import InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications from ServiceReference import ServiceReference @@ -42,7 +42,7 @@ class MediaPixmap(Pixmap): self.default_pixmap = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/no_coverArt.png") return Pixmap.applySkin(self, desktop) -class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, HelpableScreen): +class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, HelpableScreen): ALLOW_SUSPEND = True ENABLE_RESUME_SUPPORT = True @@ -51,6 +51,7 @@ class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSup InfoBarAudioSelection.__init__(self) InfoBarCueSheetSupport.__init__(self, actionmap = "MediaPlayerCueSheetActions") InfoBarNotifications.__init__(self) + InfoBarBase.__init__(self) HelpableScreen.__init__(self) self.summary = None self.oldService = self.session.nav.getCurrentlyPlayingServiceReference() diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index eb372c7a..1e7f9f2a 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -5,7 +5,7 @@ from Components.Button import Button from Components.ServiceList import ServiceList from Components.ActionMap import NumberActionMap, ActionMap, HelpableActionMap from Components.MenuList import MenuList -from Components.ServiceEventTracker import ServiceEventTracker +from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase profile("ChannelSelection.py 1") from EpgSelection import EPGSelection from enigma import eServiceReference, eEPGCache, eServiceCenter, eRCInput, eTimer, eDVBDB, iPlayableService, iServiceInformation, getPrevAsciiCode @@ -1322,13 +1322,14 @@ class RadioInfoBar(Screen): Screen.__init__(self, session) self["RdsDecoder"] = RdsDecoder(self.session.nav) -class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG): +class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG, InfoBarBase): ALLOW_SUSPEND = True def __init__(self, session, infobar): ChannelSelectionBase.__init__(self, session) ChannelSelectionEdit.__init__(self) ChannelSelectionEPG.__init__(self) + InfoBarBase.__init__(self) self.infobar = infobar self.onLayoutFinish.append(self.onCreate) diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index ad38f46a..99979b13 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -25,12 +25,12 @@ from Screens.InfoBarGenerics import InfoBarShowHide, \ profile("LOAD:InitBar_Components") from Components.ActionMap import HelpableActionMap from Components.config import config -from Components.ServiceEventTracker import ServiceEventTracker +from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase profile("LOAD:HelpableScreen") from Screens.HelpMenu import HelpableScreen -class InfoBar(InfoBarShowHide, +class InfoBar(InfoBarBase, InfoBarShowHide, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, InfoBarInstantRecord, InfoBarAudioSelection, HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, @@ -43,7 +43,6 @@ class InfoBar(InfoBarShowHide, def __init__(self, session): Screen.__init__(self, session) - self["actions"] = HelpableActionMap(self, "InfobarActions", { "showMovies": (self.showMovies, _("Play recorded movies...")), @@ -52,7 +51,7 @@ class InfoBar(InfoBarShowHide, }, prio=2) for x in HelpableScreen, \ - InfoBarShowHide, \ + InfoBarBase, InfoBarShowHide, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder, \ InfoBarInstantRecord, InfoBarAudioSelection, \ InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \ @@ -118,7 +117,7 @@ class InfoBar(InfoBarShowHide, if service is not None: self.session.open(MoviePlayer, service) -class MoviePlayer(InfoBarShowHide, \ +class MoviePlayer(InfoBarBase, InfoBarShowHide, \ InfoBarMenu, \ InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications, InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, @@ -137,7 +136,7 @@ class MoviePlayer(InfoBarShowHide, \ }) for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \ - InfoBarSeek, InfoBarShowMovies, \ + InfoBarBase, InfoBarSeek, InfoBarShowMovies, \ InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \ InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \ InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \