new function: press "0" to swap current running service and service selected from...
authorDr.Best <dr_best@users.schwerkraft.elitedvb.net>
Sat, 27 Feb 2010 20:36:58 +0000 (20:36 +0000)
committerDr.Best <dr_best@users.schwerkraft.elitedvb.net>
Sat, 27 Feb 2010 20:36:58 +0000 (20:36 +0000)
virtualzap/src/plugin.py

index ce43e0a..c1beaad 100644 (file)
@@ -120,7 +120,7 @@ def setup(session,**kwargs):
        session.open(VirtualZapConfig)
 
 def main(session,**kwargs):
-               session.open(VirtualZap, kwargs["servicelist"])
+       session.open(VirtualZap, kwargs["servicelist"])
 
 class VirtualZap(Screen):\r
        sz_w = getDesktop(0).size().width()
@@ -225,6 +225,7 @@ class VirtualZap(Screen):
                },-2)
                self["actions2"] = NumberActionMap(["NumberActions"],
                {
+                       "0": self.swap,
                        "1": self.keyNumberGlobal,
                        "2": self.keyNumberGlobal,
                        "3": self.keyNumberGlobal,
@@ -240,7 +241,6 @@ class VirtualZap(Screen):
                if self.pipAvailable:
                        # activate PiP support
                        self["video"] = VideoWindow(fb_width = getDesktop(0).size().width(), fb_height = getDesktop(0).size().height())
-                       self.pip = None
                        self.currentPiP = ""
                # this is the servicelist from ChannelSelectionBase
                self.servicelist = servicelist
@@ -467,9 +467,28 @@ class VirtualZap(Screen):
                                self.servicelist.enterPath(bouquet)
                        self.servicelist.setCurrentSelection(service) #select the service in servicelist
                # update infos, no matter if service is none or not
-               self.updateInfos()\r
-
+               self.updateInfos()
 
+       def swap(self, number):
+               if self.pipAvailable:
+                       # save old values for selecting it in servicelist after zapping
+                       currentRef = self.curRef
+                       currentBouquet = self.curBouquet
+                       # we have to close PiP first, otherwise the service-display is freezed
+                       self.pipservice = None
+                       # zap and set new values for the new reference and bouquet
+                       self.servicelist.zap()
+                       self.curRef = ServiceReference(self.servicelist.getCurrentSelection())
+                       self.curBouquet = self.servicelist.getRoot()
+                       # select old values in servicelist
+                       if currentBouquet != self.servicelist.getRoot():
+                               self.servicelist.clearPath()
+                               if self.servicelist.bouquet_root != currentBouquet:
+                                       self.servicelist.enterPath(self.servicelist.bouquet_root)
+                               self.servicelist.enterPath(currentBouquet)
+                       self.servicelist.setCurrentSelection(currentRef.ref)
+                       # play old service in PiP
+                       self.updateInfos()
 
 class VirtualZapConfig(Screen, ConfigListScreen):