add kwargs support for notifications
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index c18c698f4ad4f9a4f3449cf78a5bbe90328f5946..2bae4296161dddc43f557636d9ad815957e32303 100644 (file)
@@ -408,8 +408,8 @@ class InfoBarEPG:
                        self.eventView = None
                if ret:
                        dlgs=len(self.dlg_stack)
-                       assert dlgs>0
-                       self.dlg_stack[dlgs-1].close(dlgs > 1)
+                       if dlgs > 0:
+                               self.dlg_stack[dlgs-1].close(dlgs > 1)
 
        def openMultiServiceEPG(self, withCallback=True):
                bouquets = self.servicelist.getBouquetList()
@@ -1005,6 +1005,8 @@ class InfoBarTimeshift:
                self.timeshift_enabled = False
                self.__seekableStatusChanged()
 
+from Screens.PiPSetup import PiPSetup
+
 class InfoBarExtensions:
        def __init__(self):
                self.pipshown = False
@@ -1013,19 +1015,24 @@ class InfoBarExtensions:
                        {
                                "extensions": (self.extensions, "Extensions..."),
                        })
-                       
+
+       PIPON = 0
+       PIPOFF = 1
+       MOVEPIP = 2
+
        def extensions(self):
                list = []
                if self.pipshown == False:
-                       list.append((_("Activate Picture in Picture"), "pipon"))
+                       list.append((_("Activate Picture in Picture"), self.PIPON))
                elif self.pipshown == True:
-                       list.append((_("Disable Picture in Picture"), "pipoff"))
+                       list.append((_("Disable Picture in Picture"), self.PIPOFF))
+                       list.append((_("Move Picture in Picture"), self.MOVEPIP))
                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] == "pipon":
-                               self.session.nav.stopService()
+                       if answer[1] == self.PIPON:
+#                              self.session.nav.stopService()
                                self.pip = self.session.instantiateDialog(PictureInPicture)
                                #self.pip.show()
                                
@@ -1037,12 +1044,14 @@ class InfoBarExtensions:
                                else:
                                        self.pipservice = None
                                        del self.pip
-       
-                       elif answer[1] == "pipoff":
+                               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.MOVEPIP:
+                               self.session.open(PiPSetup, pip = self.pip)
 
 from RecordTimer import parseEvent
 
@@ -1216,6 +1225,7 @@ class InfoBarAudioSelection:
        def audioSelected(self, audio):
                if audio is not None:
                        self.audio.selectTrack(audio[1])
+               del self.audio
 
 class InfoBarSubserviceSelection:
        def __init__(self):
@@ -1355,9 +1365,9 @@ class InfoBarNotifications:
                        print "open",n
                        cb = n[0]
                        if cb is not None:
-                               self.session.openWithCallback(cb, *n[1:])
+                               self.session.openWithCallback(cb, n[1], *n[2], **n[3])
                        else:
-                               self.session.open(*n[1:])
+                               self.session.open(n[1], *n[2], **n[3])
 
 class InfoBarServiceNotifications:
        def __init__(self):