X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/84702da5d3a6df33717b399b859008a3cf8a1522..4438bf2708045c28b32839ae840866d861bace03:/lib/python/Screens/InfoBarGenerics.py diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 7c335f1d..c3c6e21a 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -265,7 +265,7 @@ class InfoBarChannelSelection: config.misc.initialchannelselection.value = 0 config.misc.initialchannelselection.save() self.switchChannelDown() - + def historyBack(self): self.servicelist.historyBack() @@ -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() @@ -448,7 +448,8 @@ class InfoBarEPG: if self.is_now_next and len(self.dlg_stack) == 1: self.getNowNext() assert self.eventView - self.eventView.setEvent(self.epglist[0]) + if len(self.epglist): + self.eventView.setEvent(self.epglist[0]) def openEventView(self): ref = self.session.nav.getCurrentlyPlayingServiceReference() @@ -1015,20 +1016,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((_("Move Picture in Picture"), "movepip")) + 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() @@ -1041,12 +1046,12 @@ class InfoBarExtensions: self.pipservice = None del self.pip self.session.nav.playService(newservice) - elif answer[1] == "pipoff": + elif answer[1] == self.PIPOFF: #self.pip.hide() self.pipservice = None del self.pip self.pipshown = False - elif answer[1] == "movepip": + elif answer[1] == self.MOVEPIP: self.session.open(PiPSetup, pip = self.pip) from RecordTimer import parseEvent @@ -1221,14 +1226,59 @@ class InfoBarAudioSelection: def audioSelected(self, audio): if audio is not None: self.audio.selectTrack(audio[1]) + del self.audio class InfoBarSubserviceSelection: def __init__(self): self["SubserviceSelectionAction"] = HelpableActionMap(self, "InfobarSubserviceSelectionActions", { - "subserviceSelection": (self.subserviceSelection, "Subservice list..."), + "subserviceSelection": (self.subserviceSelection, _("Subservice list...")), }) + self["SubserviceQuickzapAction"] = HelpableActionMap(self, "InfobarSubserviceQuickzapActions", + { + "nextSubservice": (self.nextSubservice, _("Switch to next subservice")), + "prevSubservice": (self.prevSubservice, _("Switch to previous subservice")) + }, -1) + self["SubserviceQuickzapAction"].setEnabled(False) + + self.session.nav.event.append(self.checkSubservicesAvail) # we like to get service events + + def checkSubservicesAvail(self, ev): + if ev == iPlayableService.evUpdatedEventInfo: + service = self.session.nav.getCurrentService() + subservices = service.subServices() + if subservices.getNumberOfSubservices() == 0: + self["SubserviceQuickzapAction"].setEnabled(False) + + def nextSubservice(self): + self.changeSubservice(+1) + + def prevSubservice(self): + self.changeSubservice(-1) + + def changeSubservice(self, direction): + service = self.session.nav.getCurrentService() + subservices = service.subServices() + n = subservices.getNumberOfSubservices() + if n > 0: + selection = -1 + ref = self.session.nav.getCurrentlyPlayingServiceReference() + for x in range(n): + if subservices.getSubservice(x).toString() == ref.toString(): + selection = x + if selection != -1: + selection += direction + if selection >= n: + selection=0 + elif selection < 0: + selection=n-1 + newservice = subservices.getSubservice(selection) + if newservice.valid(): + del subservices + del service + self.session.nav.playService(newservice) + def subserviceSelection(self): service = self.session.nav.getCurrentService() subservices = service.subServices() @@ -1248,6 +1298,7 @@ class InfoBarSubserviceSelection: def subserviceSelected(self, service): if not service is None: + self["SubserviceQuickzapAction"].setEnabled(True) self.session.nav.playService(service[1]) class InfoBarAdditionalInfo: @@ -1360,9 +1411,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):