From 952b92e60a529fc711bf419def94091a494ec03e Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sat, 9 Dec 2006 14:36:04 +0000 Subject: [PATCH 1/1] display zap errors in popups --- lib/python/Screens/InfoBar.py | 12 ++++--- lib/python/Screens/InfoBarGenerics.py | 45 +++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 1b08f775..f1123842 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -19,7 +19,7 @@ from Screens.InfoBarGenerics import InfoBarShowHide, \ InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift, \ InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \ InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \ - InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer + InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport from Screens.HelpMenu import HelpableScreen, HelpMenu @@ -33,7 +33,8 @@ class InfoBar(InfoBarShowHide, HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, - InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, Screen): + InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport, + Screen): ALLOW_SUSPEND = True @@ -56,7 +57,7 @@ class InfoBar(InfoBarShowHide, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \ InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \ InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarSleepTimer, \ - InfoBarPlugins: + InfoBarPlugins, InfoBarServiceErrorPopupSupport: x.__init__(self) self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))])) @@ -84,7 +85,8 @@ class MoviePlayer(InfoBarShowHide, \ InfoBarMenu, \ InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications, InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, - InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarExtensions, InfoBarTeletextPlugin): + InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarExtensions, InfoBarTeletextPlugin, + InfoBarServiceErrorPopupSupport): ENABLE_RESUME_SUPPORT = True ALLOW_SUSPEND = True @@ -102,7 +104,7 @@ class MoviePlayer(InfoBarShowHide, \ InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \ InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \ InfoBarSummarySupport, InfoBarSubtitleSupport, InfoBarExtensions, \ - InfoBarTeletextPlugin: + InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport: x.__init__(self) self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference() diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 3b653d05..26bc0d41 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1850,3 +1850,48 @@ class InfoBarSubtitleSupport(object): subtitles_enabled = property(lambda self: self.__subtitles_enabled, setSubtitlesEnable) selected_subtitle = property(lambda self: self.__selected_subtitle, setSelectedSubtitle) + +class InfoBarServiceErrorPopupSupport: + def __init__(self): + self.__event_tracker = ServiceEventTracker(screen=self, eventmap= + { + iPlayableService.evTuneFailed: self.__tuneFailed, + iPlayableService.evStart: self.__serviceStarted + }) + self.__serviceStarted() + + def __serviceStarted(self): + self.last_error = None + Notifications.RemovePopup(id = "ZapError") + + def __tuneFailed(self): + service = self.session.nav.getCurrentService() + info = service and service.info() + error = info and info.getInfo(iServiceInformation.sDVBState) + + if error == self.last_error: + error = None + else: + self.last_error = error + + errors = { + eDVBServicePMTHandler.eventNoResources: _("No free tuner!"), + eDVBServicePMTHandler.eventTuneFailed: _("Tune failed!"), + eDVBServicePMTHandler.eventNoPAT: _("No data on transponder!\n(Timeout reading PAT)"), + eDVBServicePMTHandler.eventNoPATEntry: _("Service not found!\n(SID not found in PAT)"), + eDVBServicePMTHandler.eventNoPMT: _("Service invalid!\n(Timeout reading PMT)"), + eDVBServicePMTHandler.eventNewProgramInfo: None, + eDVBServicePMTHandler.eventTuned: None, + eDVBServicePMTHandler.eventSOF: None, + eDVBServicePMTHandler.eventEOF: None + } + + if error not in errors: + error = None + + error = error and errors[error] + + if error is not None: + Notifications.AddPopup(text = error, type = MessageBox.TYPE_ERROR, timeout = 5, id = "ZapError") + else: + Notifications.RemovePopup(id = "ZapError") -- 2.30.2