remove unneeded code
[enigma2.git] / lib / python / Screens / InfoBar.py
index ab40838d53d13921f516f4294664007ffad77eb7..92be77196e99477571461468115f77ef5bc7abb0 100644 (file)
@@ -8,8 +8,7 @@ from Screens.Ci import CiHandler
 from Components.Sources.Clock import Clock
 from Components.ActionMap import HelpableActionMap
 from Components.config import config
-
-from Tools.Notifications import AddNotificationWithCallback
+from Components.ServiceEventTracker import ServiceEventTracker
 
 from Screens.InfoBarGenerics import InfoBarShowHide, \
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
@@ -20,7 +19,9 @@ from Screens.InfoBarGenerics import InfoBarShowHide, \
        InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
        InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport
 
-from Screens.HelpMenu import HelpableScreen, HelpMenu
+from Screens.HelpMenu import HelpableScreen
+
+from enigma import iPlayableService
 
 class InfoBar(InfoBarShowHide,
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
@@ -60,6 +61,40 @@ class InfoBar(InfoBarShowHide,
 
                self["CurrentTime"] = Clock()
 
+               self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
+                       {
+                               iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
+                       })
+
+               self.current_begin_time=0
+
+       def __eventInfoChanged(self):
+               if self.execing:
+                       service = self.session.nav.getCurrentService()
+                       old_begin_time = self.current_begin_time
+                       info = service and service.info()
+                       ptr = info and info.getEvent(0)
+                       self.current_begin_time = ptr and ptr.getBeginTime() or 0
+                       if config.usage.show_infobar_on_event_change.value:
+                               if old_begin_time and old_begin_time != self.current_begin_time:
+                                       self.doShow()
+
+       def __checkServiceStarted(self):
+               self.__serviceStarted(True)
+               self.onExecBegin.remove(self.__checkServiceStarted)
+
+       def serviceStarted(self):  #override from InfoBarShowHide
+               new = self.servicelist.newServicePlayed()
+               if self.execing:
+                       InfoBarShowHide.serviceStarted(self)
+                       self.current_begin_time=0
+               elif not self.__checkServiceStarted in self.onShown and new:
+                       self.onShown.append(self.__checkServiceStarted)
+
+       def __checkServiceStarted(self):
+               self.serviceStarted()
+               self.onShown.remove(self.__checkServiceStarted)
+
        def showTv(self):
                self.showTvChannelList(True)
 
@@ -84,7 +119,7 @@ class MoviePlayer(InfoBarShowHide, \
                InfoBarMenu, \
                InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
                InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
-               InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarExtensions, InfoBarTeletextPlugin,
+               InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
                InfoBarServiceErrorPopupSupport):
 
        ENABLE_RESUME_SUPPORT = True
@@ -102,7 +137,7 @@ class MoviePlayer(InfoBarShowHide, \
                                InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
                                InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
                                InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
-                               InfoBarSummarySupport, InfoBarSubtitleSupport, InfoBarExtensions, \
+                               InfoBarSummarySupport, InfoBarSubtitleSupport, \
                                InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport:
                        x.__init__(self)