display zap errors in popups
authorFelix Domke <tmbinc@elitedvb.net>
Sat, 9 Dec 2006 14:36:04 +0000 (14:36 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sat, 9 Dec 2006 14:36:04 +0000 (14:36 +0000)
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py

index 1b08f77..f112384 100644 (file)
@@ -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()
index 3b653d0..26bc0d4 100644 (file)
@@ -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")