reverted PiP zap support
authorpieterg <pieterg@users.sourceforge.net>
Wed, 18 Nov 2009 22:05:20 +0000 (23:05 +0100)
committerpieterg <pieterg@users.sourceforge.net>
Wed, 18 Nov 2009 22:15:41 +0000 (23:15 +0100)
Navigation.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/PictureInPicture.py

index e3db30b..2ca87f6 100644 (file)
@@ -28,7 +28,6 @@ class Navigation:
                self.record_event = [ ]
                self.currentlyPlayingServiceReference = None
                self.currentlyPlayingService = None
-               self.currentlyPlayingServicePath = None
                self.RecordTimer = RecordTimer.RecordTimer()
                if getFPWasTimerWakeup():
                        clearFPWasTimerWakeup()
@@ -51,13 +50,12 @@ class Navigation:
                for x in self.record_event:
                        x(rec_service, event)
 
-       def playService(self, ref, path = None, checkParentalControl = True):
+       def playService(self, ref, checkParentalControl = True):
                oldref = self.currentlyPlayingServiceReference
                if ref and oldref and ref == oldref:
                        print "ignore request to play already running service"
                        return 0
                print "playing", ref and ref.toString()
-               self.currentlyPlayingServicePath = None
                if ref is None:
                        self.stopService()
                        return 0
@@ -73,7 +71,6 @@ class Navigation:
                                playref = ref
                        if self.pnav and not self.pnav.playService(playref):
                                self.currentlyPlayingServiceReference = playref
-                               self.currentlyPlayingServicePath = path
                                return 0
                else:
                        self.stopService()
@@ -82,9 +79,6 @@ class Navigation:
        def getCurrentlyPlayingServiceReference(self):
                return self.currentlyPlayingServiceReference
        
-       def getCurrentlyPlayingServicePath(self):
-               return self.currentlyPlayingServicePath
-
        def recordService(self, ref, simulate=False):
                service = None
                print "recording service: %s" % (str(ref))
index 323f7b7..b6d8a31 100644 (file)
@@ -79,7 +79,6 @@ class ChannelContextMenu(Screen):
                #raise Exception("we need a better summary screen here")
                self.csel = csel
                self.bsel = None
-               self.session = session
 
                self["actions"] = ActionMap(["OkCancelActions"],
                        {
@@ -1141,15 +1140,6 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect
                self.new_service_played = False
                self.onExecBegin.append(self.asciiOn)
 
-               #zap focus setting, when True, zap the PiP. When false, zap the main screen
-               self.zappip = False
-
-       def setZapFocus(self, focus):
-               if self.session.pipshown and focus == self.session.pip:
-                       self.zappip = True
-               else:
-                       self.zappip = False
-
        def asciiOn(self):
                rcinput = eRCInput.getInstance()
                rcinput.setKeyboardMode(rcinput.kmAscii)
@@ -1162,9 +1152,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect
                self.recallBouquetMode()
 
        def __evServiceStart(self):
-               #we're starting a service on the main screen, don't obey current zap focus here
                service = self.session.nav.getCurrentService()
-
                if service:
                        info = service.info()
                        if info:
@@ -1232,24 +1220,16 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect
        #called from infoBar and channelSelected
        def zap(self):
                self.revertMode=None
-               if self.zappip and self.session.pipshown:
-                       ref = self.session.pip.getCurrentlyPlayingServiceReference()
-               else:
-                       ref = self.session.nav.getCurrentlyPlayingServiceReference()
+               ref = self.session.nav.getCurrentlyPlayingServiceReference()
                nref = self.getCurrentSelection()
                if ref is None or ref != nref:
+                       self.new_service_played = True
+                       self.session.nav.playService(nref)
                        self.saveRoot()
                        self.saveChannel(nref)
                        if config.usage.savelastservice.value:
                                config.servicelist.lastmode.save()
                        self.addToHistory(nref)
-                       self.new_service_played = True
-                       #now that we set the current path, call playService
-                       #(which needs the path as an argument, in order to be able to swap PiP and main screen, if required)
-                       if self.zappip and self.session.pipshown:
-                               self.session.pip.playService(nref, self.getCurrentServicePath())
-                       else:
-                               self.session.nav.playService(nref, self.getCurrentServicePath())
 
        def newServicePlayed(self):
                ret = self.new_service_played
@@ -1293,14 +1273,9 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect
                cur_root = self.getRoot()
                if cur_root and cur_root != root:
                        self.setRoot(root)
+               self.session.nav.playService(ref)
                self.setCurrentSelection(ref)
                self.saveChannel(ref)
-               #now that we set the current path, call playService
-               #(which needs the path as an argument, in order to be able to swap PiP and main screen, if required)
-               if self.zappip and self.session.pipshown:
-                       self.session.pip.playService(ref, self.getCurrentServicePath())
-               else:
-                       self.session.nav.playService(ref, self.getCurrentServicePath())
 
        def saveRoot(self):
                if not config.usage.savelastservice.value:
index 1bd165a..949e442 100644 (file)
@@ -1360,13 +1360,11 @@ class InfoBarPiP:
                        self.session.pipshown
                except:
                        self.session.pipshown = False
-               self.zappip = False
                if SystemInfo.get("NumVideoDecoders", 1) > 1:
                        if (self.allowPiP):
                                self.addExtension((self.getShowHideName, self.showPiP, lambda: True), "blue")
                                self.addExtension((self.getMoveName, self.movePiP, self.pipShown), "green")
                                self.addExtension((self.getSwapName, self.swapPiP, self.pipShown), "yellow")
-                               self.addExtension((self.getZapFocusName, self.zapFocusToggle, self.pipShown), "red")
                        else:
                                self.addExtension((self.getShowHideName, self.showPiP, self.pipShown), "blue")
                                self.addExtension((self.getMoveName, self.movePiP, self.pipShown), "green")
@@ -1389,59 +1387,34 @@ class InfoBarPiP:
        def getMoveName(self):
                return _("Move Picture in Picture")
 
-       def getZapFocusName(self):
-               if self.zappip:
-                       return _("Set zap focus to main screen")
-               else:
-                       return _("Set zap focus to Picture in Picture")
-
-       def zapFocusToggle(self):
-               self.zappip = not self.zappip
-               if self.zappip:
-                       self.servicelist.setZapFocus(self.session.pip)
-                       if self.session.pip.getCurrentlyPlayingServicePath() is not None:
-                               self.servicelist.setCurrentServicePath(self.session.pip.getCurrentlyPlayingServicePath())
-               else:
-                       self.servicelist.setZapFocus(self.session.nav)
-                       if self.session.nav.getCurrentlyPlayingServicePath():
-                               self.servicelist.setCurrentServicePath(self.session.nav.getCurrentlyPlayingServicePath())
-
        def showPiP(self):
                if self.session.pipshown:
-                       if self.zappip:
-                               self.zappip = False
-                               self.servicelist.setZapFocus(self.session.nav)
-                               self.servicelist.setCurrentServicePath(self.session.nav.getCurrentlyPlayingServicePath())
-                       self.session.pipshown = False
                        del self.session.pip
+                       self.session.pipshown = False
                else:
                        self.session.pip = self.session.instantiateDialog(PictureInPicture)
                        self.session.pip.show()
                        newservice = self.session.nav.getCurrentlyPlayingServiceReference()
-                       if self.session.pip.playService(newservice, self.servicelist.getCurrentServicePath()):
+                       if self.session.pip.playService(newservice):
                                self.session.pipshown = True
+                               self.session.pip.servicePath = self.servicelist.getCurrentServicePath()
                        else:
+                               self.session.pipshown = False
                                del self.session.pip
+                       self.session.nav.playService(newservice)
 
        def swapPiP(self):
-               navservice = self.session.nav.getCurrentlyPlayingServiceReference()
-               pipservice = self.session.pip.getCurrentlyPlayingServiceReference()
-               if navservice.toString() != pipservice.toString():
-                       if self.zappip:
-                               navservicepath = self.session.nav.getCurrentlyPlayingServicePath()
-                               pipservicepath = self.servicelist.getCurrentServicePath()
-                       else:
-                               pipservicepath = self.session.pip.getCurrentlyPlayingServicePath()
-                               navservicepath = self.servicelist.getCurrentServicePath()
-                       self.session.nav.stopService() # stop portal
-                       self.session.nav.playService(pipservice, pipservicepath)
-                       self.session.pip.playService(navservice, navservicepath)
-                       if self.zappip:
-                               newservicepath = navservicepath
-                       else:
-                               newservicepath = pipservicepath
-                       if newservicepath is not None:
-                               self.servicelist.setCurrentServicePath(newservicepath)
+               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
 
        def movePiP(self):
                self.session.open(PiPSetup, pip = self.session.pip)
index 6be847b..e49eb36 100644 (file)
@@ -11,18 +11,11 @@ class PictureInPicture(Screen):
                Screen.__init__(self, session)
                self["video"] = VideoWindow()
                self.currentService = None
-               self.currentServicePath = None
                if not pip_config_initialized:
                        config.av.pip = ConfigPosition(default=[-1, -1, -1, -1], args = (719, 567, 720, 568))
                        pip_config_initialized = True
                self.onLayoutFinish.append(self.LayoutFinished)
 
-       def getCurrentlyPlayingServiceReference(self):
-               return self.currentService
-
-       def getCurrentlyPlayingServicePath(self):
-               return self.currentServicePath
-
        def LayoutFinished(self):
                self.onLayoutFinish.remove(self.LayoutFinished)
                x = config.av.pip.value[0]
@@ -52,10 +45,7 @@ class PictureInPicture(Screen):
        def getSize(self):
                return (self.instance.size().width(), self.instance.size().height())
 
-       def playService(self, service, path = None):
-               if service and self.currentService and service == self.currentService:
-                       self.currentServicePath = path
-                       return True
+       def playService(self, service):
                if service and (service.flags & eServiceReference.isGroup):
                        ref = getBestPlayableServiceReference(service, eServiceReference())
                else:
@@ -65,7 +55,6 @@ class PictureInPicture(Screen):
                        if self.pipservice and not self.pipservice.setTarget(1):
                                self.pipservice.start()
                                self.currentService = service
-                               self.currentServicePath = path
                                return True
                        else:
                                self.pipservice = None