simplify code
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index 0241b6dcd6afb17d084f992b7a1b113eb515f607..9b6712e55a93f4af52ebe5d25f0e49ebe042ae42 100644 (file)
@@ -254,13 +254,13 @@ class InfoBarChannelSelection:
 
                self["ChannelSelectActions"] = HelpableActionMap(self, "InfobarChannelSelection",
                        {
-                               "switchChannelUp": self.switchChannelUp,
-                               "switchChannelDown": self.switchChannelDown,
+                               "switchChannelUp": (self.switchChannelUp, _("open servicelist(up)")),
+                               "switchChannelDown": (self.switchChannelDown, _("open servicelist(down)")),
                                "zapUp": (self.zapUp, _("previous channel")),
                                "zapDown": (self.zapDown, _("next channel")),
                                "historyBack": (self.historyBack, _("previous channel in history")),
                                "historyNext": (self.historyNext, _("next channel in history")),
-                               "openServiceList": (self.openServiceList, _("open service list")),
+                               "openServiceList": (self.openServiceList, _("open servicelist")),
                        })
 
        def showTvChannelList(self, zap=False):
@@ -299,16 +299,36 @@ class InfoBarChannelSelection:
                self.session.execDialog(self.servicelist)
 
        def zapUp(self):
-               if currentConfigSelectionElement(config.usage.quickzap_bouquet_change) == "yes":
-                       if self.servicelist.inBouquet() and self.servicelist.atBegin():
-                               self.servicelist.prevBouquet()
-               self.servicelist.moveUp()
+               if self.servicelist.inBouquet():
+                       prev = self.servicelist.getCurrentSelection()
+                       if prev:
+                               prev = prev.toString()
+                               while True:
+                                       if currentConfigSelectionElement(config.usage.quickzap_bouquet_change) == "yes":
+                                               if self.servicelist.atBegin():
+                                                       self.servicelist.prevBouquet()
+                                       self.servicelist.moveUp()
+                                       cur = self.servicelist.getCurrentSelection()
+                                       if not cur or (not (cur.flags & 64)) or cur.toString() == prev:
+                                               break
+               else:
+                       self.servicelist.moveUp()
                self.servicelist.zap()
                self.doShow()
 
        def zapDown(self):
-               if currentConfigSelectionElement(config.usage.quickzap_bouquet_change) == "yes" and self.servicelist.inBouquet() and self.servicelist.atEnd():
-                       self.servicelist.nextBouquet()
+               if self.servicelist.inBouquet():
+                       prev = self.servicelist.getCurrentSelection()
+                       if prev:
+                               prev = prev.toString()
+                               while True:
+                                       if currentConfigSelectionElement(config.usage.quickzap_bouquet_change) == "yes" and self.servicelist.atEnd():
+                                               self.servicelist.nextBouquet()
+                                       else:
+                                               self.servicelist.moveDown()
+                                       cur = self.servicelist.getCurrentSelection()
+                                       if not cur or (not (cur.flags & 64)) or cur.toString() == prev:
+                                               break
                else:
                        self.servicelist.moveDown()
                self.servicelist.zap()
@@ -829,7 +849,6 @@ class InfoBarTimeshiftState(InfoBarPVRState):
        def __init__(self):
                InfoBarPVRState.__init__(self, screen=TimeshiftState)
 
-
 class InfoBarShowMovies:
 
        # i don't really like this class. 
@@ -903,9 +922,9 @@ class InfoBarTimeshift:
                print "enable timeshift"
                ts = self.getTimeshift()
                if ts is None:
-                       self.session.open(MessageBox, _("Timeshift not possible!"), MessageBox.TYPE_ERROR)
-                       print "no ts interface"
-                       return
+#                      self.session.open(MessageBox, _("Timeshift not possible!"), MessageBox.TYPE_ERROR)
+#                      print "no ts interface"
+                       return 0;
                
                if self.timeshift_enabled:
                        print "hu, timeshift already enabled?"
@@ -913,7 +932,7 @@ class InfoBarTimeshift:
                        if not ts.startTimeshift():
                                import time
                                self.timeshift_enabled = 1
-                               
+
                                # we remove the "relative time" for now.
                                #self.pvrStateDialog["timeshift"].setRelative(time.time())
                                        
@@ -928,11 +947,11 @@ class InfoBarTimeshift:
 
        def stopTimeshift(self):
                if not self.timeshift_enabled:
-                       return
+                       return 0
                print "disable timeshift"
                ts = self.getTimeshift()
                if ts is None:
-                       return
+                       return 0
                self.session.openWithCallback(self.stopTimeshiftConfirmed, MessageBox, _("Stop Timeshift?"), MessageBox.TYPE_YESNO)
 
        def stopTimeshiftConfirmed(self, confirmed):
@@ -1030,7 +1049,7 @@ class InfoBarExtensions:
                l = s and s.getSubtitleList() or [ ]
                
                for x in l:
-                       list.append(("DEBUG: Enable Subtitles: " + x[0], self.ENABLE_SUBTITLE, x[1]))
+                       list.append(("Enable Subtitles: " + x[0], self.ENABLE_SUBTITLE, x[1]))
                
                self.session.openWithCallback(self.extensionCallback, ChoiceBox, title=_("Please choose an extension..."), list = list)
 
@@ -1187,7 +1206,7 @@ class InfoBarInstantRecord:
                except:
                        self.session.open(MessageBox, _("No HDD found or HDD not initialized!"), MessageBox.TYPE_ERROR)
                        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")])
                else: