really fix satfinder
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 4 Jul 2006 18:52:17 +0000 (18:52 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Tue, 4 Jul 2006 18:52:17 +0000 (18:52 +0000)
sync channellist with pip

lib/python/Plugins/SystemPlugins/Satfinder/plugin.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/InfoBarGenerics.py

index 861db62..fceff4c 100644 (file)
@@ -79,12 +79,18 @@ class Satfinder(ScanSetup):
                self.feid = feid
 
                if not self.openFrontend():
-                       self.frontend = None
+                       session.nav.stopService() # try to disable foreground service
+                       if not self.openFrontend():
+                               if session.pipshown: # try to disable pip
+                                       session.pipshown = False
+                                       del session.pip
+                                       if not self.openFrontend():
+                                               self.frontend = None # in normal case this should not happen
+                                               self.getFrontend = None
 
                ScanSetup.__init__(self, session)
-               self.session.nav.stopService()
                self.tuner = Tuner(self.frontend)
-               
+
                self["snr"] = Label()
                self["agc"] = Label()
                self["ber"] = Label()
@@ -129,7 +135,7 @@ class Satfinder(ScanSetup):
                        self.list.append(getConfigListEntry(_('Symbol Rate'), config.scan.sat.symbolrate))
                        self.list.append(getConfigListEntry(_("Polarity"), config.scan.sat.polarization))
                        self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec))
-               elif config.tuning.transponder and self.currentConfigSelectionElement(config.tuning.type) == "predefined_transponder":
+               elif config.tuning.transponder and currentConfigSelectionElement(config.tuning.type) == "predefined_transponder":
                        self.list.append(getConfigListEntry(_("Transponder"), config.tuning.transponder))
                self["config"].list = self.list
                self["config"].l.setList(self.list)
index 0870232..a52fd36 100644 (file)
@@ -1032,6 +1032,20 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect
                        self.lastservice.value = refstr
                        self.lastservice.save()
 
+       def setCurrentServicePath(self, path):
+               hlen = len(self.history)
+               if hlen > 0:
+                       self.history[self.history_pos] = path
+               else:
+                       self.history.append(path)
+               self.setHistoryPath()
+
+       def getCurrentServicePath(self):
+               hlen = len(self.history)
+               if hlen > 0:
+                       return self.history[self.history_pos]
+               return None
+
        def recallPrevService(self):
                hlen = len(self.history)
                if hlen > 1:
index fcce082..f530ddd 100644 (file)
@@ -1029,7 +1029,7 @@ from Screens.PiPSetup import PiPSetup
 
 class InfoBarExtensions:
        def __init__(self):
-               self.pipshown = False
+               self.session.pipshown = False
                
                self["InstantExtensionsActions"] = HelpableActionMap(self, "InfobarExtensions",
                        {
@@ -1044,9 +1044,9 @@ class InfoBarExtensions:
 
        def extensions(self):
                list = []
-               if self.pipshown == False:
+               if self.session.pipshown == False:
                        list.append((_("Activate Picture in Picture"), self.PIPON))
-               elif self.pipshown == True:
+               elif self.session.pipshown == True:
                        list.append((_("Disable Picture in Picture"), self.PIPOFF))
                        list.append((_("Move Picture in Picture"), self.MOVEPIP))
                        list.append((_("Swap services"), self.PIPSWAP))
@@ -1062,26 +1062,32 @@ class InfoBarExtensions:
        def extensionCallback(self, answer):
                if answer is not None:
                        if answer[1] == self.PIPON:
-                               self.pip = self.session.instantiateDialog(PictureInPicture)
-                               
+                               self.session.pip = self.session.instantiateDialog(PictureInPicture)
                                newservice = self.session.nav.getCurrentlyPlayingServiceReference()
-                               
-                               if self.pip.playService(newservice):
-                                       self.pipshown = True
+                               if self.session.pip.playService(newservice):
+                                       self.session.pipshown = True
+                                       self.session.pip.servicePath = self.servicelist.getCurrentServicePath()
                                else:
-                                       self.pipshown = False
-                                       del self.pip
+                                       self.session.pipshown = False
+                                       del self.session.pip
                                self.session.nav.playService(newservice)
                        elif answer[1] == self.PIPOFF:
-                               del self.pip
-                               self.pipshown = False
+                               del self.session.pip
+                               self.session.pipshown = False
                        elif answer[1] == self.PIPSWAP:
-                               swapservice = self.pip.getCurrentService()
-                               self.pip.playService(self.session.nav.getCurrentlyPlayingServiceReference())
-                               self.session.nav.playService(swapservice)
-                               
+                               swapservice = self.session.nav.getCurrentlyPlayingServiceReference()
+                               if self.session.pip.servicePath:
+                                       servicepath = self.servicelist.getCurrentServicePath()
+                                       ref=servicepath[len(servicepath)-1]
+                                       pipref=self.session.pip.getCurrentService()
+                                       self.session.pip.playService(swapservice)
+                                       self.servicelist.setCurrentServicePath(self.session.pip.servicePath)
+                                       if pipref.toString() != ref.toString(): # is a subservice ?
+                                               self.session.nav.stopService() # stop portal
+                                               self.session.nav.playService(pipref) # start subservice
+                                       self.session.pip.servicePath=servicepath
                        elif answer[1] == self.MOVEPIP:
-                               self.session.open(PiPSetup, pip = self.pip)
+                               self.session.open(PiPSetup, pip = self.session.pip)
                        elif answer[1] == self.ENABLE_SUBTITLE:
                                self.selected_subtitle = answer[2]
                                self.subtitles_enabled = True