much simpler fix..
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index eb382fe7eb44dec81997e38bf82c045cf5d2e4d7..2c2b4a5b684428c74489953e3e2ed91895d20a7b 100644 (file)
@@ -39,7 +39,7 @@ from Tools import Notifications
 from Tools.Directories import SCOPE_HDD, resolveFilename
 
 from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \
-       iPlayableService, eServiceReference, eDVBResourceManager, iFrontendInformation
+       iPlayableService, eServiceReference, eDVBResourceManager, iFrontendInformation, eEPGCache
 
 from time import time
 from os import stat as os_stat
@@ -227,7 +227,7 @@ class InfoBarNumberZap:
                        bouquetlist = serviceHandler.list(bouquet)
                        if not bouquetlist is None:
                                while number:
-                                       bouquet = self.servicelist.appendDVBTypes(bouquetlist.getNext())
+                                       bouquet = bouquetlist.getNext()
                                        if not bouquet.valid(): #check end of list
                                                break
                                        if bouquet.flags & eServiceReference.isDirectory:
@@ -863,22 +863,26 @@ class InfoBarPVRState:
        def __init__(self, screen=PVRState):
                self.onPlayStateChanged.append(self.__playStateChanged)
                self.pvrStateDialog = self.session.instantiateDialog(screen)
-               self.onShow.append(self.__mayShow)
+               self.onShow.append(self._mayShow)
                self.onHide.append(self.pvrStateDialog.hide)
-       
-       def __mayShow(self):
-               if self.seekstate != self.SEEK_STATE_PLAY and self.execing:
+
+       def _mayShow(self):
+               if self.execing and self.seekstate != self.SEEK_STATE_PLAY:
                        self.pvrStateDialog.show()
 
        def __playStateChanged(self, state):
                playstateString = state[3]
                self.pvrStateDialog["state"].setText(playstateString)
-               self.__mayShow()
+               self._mayShow()
 
 class InfoBarTimeshiftState(InfoBarPVRState):
        def __init__(self):
                InfoBarPVRState.__init__(self, screen=TimeshiftState)
 
+       def _mayShow(self):
+               if self.execing and self.timeshift_enabled:
+                       self.pvrStateDialog.show()
+
 class InfoBarShowMovies:
 
        # i don't really like this class. 
@@ -1321,7 +1325,7 @@ class InfoBarInstantRecord:
        def inputCallback(self, value):
                if value is not None:
                        print "stopping recording after", int(value), "minutes."
-                       self.recording[self.selectedEntry].end = time.time() + 60 * int(value)
+                       self.recording[self.selectedEntry].end = time() + 60 * int(value)
                        self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry])
 
        def instantRecord(self):
@@ -1332,9 +1336,21 @@ class InfoBarInstantRecord:
                        return
 
                if self.isInstantRecordRunning():
-                       self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("A recording is currently running.\nWhat do you want to do?"), list=[(_("stop recording"), "stop"), (_("change recording (duration)"), "changeduration"), (_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"), (_("do nothing"), "no")])
+                       self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, \
+                               title=_("A recording is currently running.\nWhat do you want to do?"), \
+                               list=[(_("stop recording"), "stop"), \
+                               (_("change recording (duration)"), "changeduration"), \
+                               (_("add recording (indefinitely)"), "indefinitely"), \
+                               (_("add recording (stop after current event)"), "event"), \
+                               (_("add recording (enter recording duration)"), "manualduration"), \
+                               (_("do nothing"), "no")])
                else:
-                       self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("Start recording?"), list=[(_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"),(_("don't record"), "no")])
+                       self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, \
+                               title=_("Start recording?"), \
+                               list=[(_("add recording (indefinitely)"), "indefinitely"), \
+                               (_("add recording (stop after current event)"), "event"), \
+                               (_("add recording (enter recording duration)"), "manualduration"), \
+                               (_("don't record"), "no")])
 
 from Tools.ISO639 import LanguageCodes
 
@@ -1891,12 +1907,9 @@ class InfoBarServiceErrorPopupSupport:
                        eDVBServicePMTHandler.eventSOF: None,
                        eDVBServicePMTHandler.eventEOF: None
                }
-               
-               if error not in errors:
-                       error = None
 
-               error = error and errors[error]
-               
+               error = errors.get(error) #this returns None when the key not exist in the dict
+
                if error is not None:
                        Notifications.AddPopup(text = error, type = MessageBox.TYPE_ERROR, timeout = 5, id = "ZapError")
                else: