ugly workaround a bluescreen happening when a record timer fires that zaps away
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index 67212656c57660e0a88f48703ddc23a08691e1d0..2624209cbe336ef712ad7ded8fd23b2983c2c744 100644 (file)
@@ -1020,6 +1020,7 @@ class InfoBarExtensions:
        PIPON = 0
        PIPOFF = 1
        MOVEPIP = 2
+       PIPSWAP = 3
 
        def extensions(self):
                list = []
@@ -1028,29 +1029,30 @@ class InfoBarExtensions:
                elif self.pipshown == True:
                        list.append((_("Disable Picture in Picture"), self.PIPOFF))
                        list.append((_("Move Picture in Picture"), self.MOVEPIP))
+                       list.append((_("Swap services"), self.PIPSWAP))
                self.session.openWithCallback(self.extensionCallback, ChoiceBox, title=_("Please choose an extension..."), list = list)
 
        def extensionCallback(self, answer):
                if answer is not None:
                        if answer[1] == self.PIPON:
-#                              self.session.nav.stopService()
                                self.pip = self.session.instantiateDialog(PictureInPicture)
-                               #self.pip.show()
                                
                                newservice = self.session.nav.getCurrentlyPlayingServiceReference()
-                               self.pipservice = eServiceCenter.getInstance().play(newservice)
-                               if self.pipservice and not self.pipservice.setTarget(1):
-                                       self.pipservice.start()
+                               
+                               if self.pip.playService(newservice):
                                        self.pipshown = True
                                else:
-                                       self.pipservice = None
+                                       self.pipshown = False
                                        del self.pip
                                self.session.nav.playService(newservice)
                        elif answer[1] == self.PIPOFF:
-                               #self.pip.hide()
-                               self.pipservice = None
                                del self.pip
                                self.pipshown = False
+                       elif answer[1] == self.PIPSWAP:
+                               swapservice = self.pip.getCurrentService()
+                               self.pip.playService(self.session.nav.getCurrentlyPlayingServiceReference())
+                               self.session.nav.playService(swapservice)
+                               
                        elif answer[1] == self.MOVEPIP:
                                self.session.open(PiPSetup, pip = self.pip)
 
@@ -1410,8 +1412,11 @@ class InfoBarNotifications:
                Notifications.notificationAdded.append(self.checkNotificationsIfExecing)
        
        def checkNotificationsIfExecing(self):
-               if self.execing:
-                       self.checkNotifications()
+               try:
+                       if self.execing:
+                               self.checkNotifications()
+               except:
+                       print "******************************* A SEVERE ERROR HAPPENED... Someone who understands the code... please fix :) *******"
 
        def checkNotifications(self):
                if len(Notifications.notifications):