- def extensionCallback(self, answer):
- if answer is not None:
- if answer[1] == self.PIPON:
- self.session.pip = self.session.instantiateDialog(PictureInPicture)
- newservice = self.session.nav.getCurrentlyPlayingServiceReference()
- 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)
- elif answer[1] == self.PIPOFF:
- del self.session.pip
+ def getSleepTimerName(self):
+ return _("Sleep Timer")
+
+ def showSleepTimerSetup(self):
+ self.session.open(SleepTimerEdit)
+
+# depends on InfoBarExtensions
+class InfoBarPiP:
+ def __init__(self):
+ self.session.pipshown = False
+
+ self.addExtension((self.getShowHideName, self.showPiP, self.available), "blue")
+ self.addExtension((self.getMoveName, self.movePiP, self.pipShown), "green")
+ self.addExtension((self.getSwapName, self.swapPiP, self.pipShown), "yellow")
+
+ def available(self):
+ return True
+
+ def pipShown(self):
+ return self.session.pipshown
+
+ def getShowHideName(self):
+ if self.session.pipshown:
+ return _("Disable Picture in Picture")
+ else:
+ return _("Activate Picture in Picture")
+
+ def getSwapName(self):
+ return _("Swap Services")
+
+ def getMoveName(self):
+ return _("Move Picture in Picture")
+
+ def showPiP(self):
+ if self.session.pipshown:
+ del self.session.pip
+ self.session.pipshown = False
+ else:
+ self.session.pip = self.session.instantiateDialog(PictureInPicture)
+ newservice = self.session.nav.getCurrentlyPlayingServiceReference()
+ if self.session.pip.playService(newservice):
+ self.session.pipshown = True
+ self.session.pip.servicePath = self.servicelist.getCurrentServicePath()
+ else: