+ self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
+ {
+ iPlayableService.evUpdatedEventInfo: self.__eventInfoChanged
+ })
+
+ self.current_begin_time=0
+ assert InfoBar.instance is None, "class InfoBar is a singleton class and just one instance of this class is allowed!"
+ InfoBar.instance = self
+
+ def __onClose(self):
+ InfoBar.instance = None
+
+ 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)