From 9062e2e8234479445e6c06f8b873d7d866dc8492 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 2 Jan 2006 13:08:25 +0000 Subject: [PATCH 1/1] toggle between epg types with info --- data/keymap.xml | 1 + lib/python/Screens/EpgSelection.py | 11 +++++++-- lib/python/Screens/InfoBarGenerics.py | 34 +++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/data/keymap.xml b/data/keymap.xml index c6702857..221f1552 100644 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -199,6 +199,7 @@ + diff --git a/lib/python/Screens/EpgSelection.py b/lib/python/Screens/EpgSelection.py index 6f556003..9458e395 100644 --- a/lib/python/Screens/EpgSelection.py +++ b/lib/python/Screens/EpgSelection.py @@ -38,16 +38,23 @@ class EPGSelection(Screen): self["actions"] = ChannelActionMap(["EPGSelectActions", "OkCancelActions"], { - "cancel": self.close, + "cancel": self.closeClose, "ok": self.eventSelected, "timerAdd": self.timerAdd, "yellow": self.yellowButtonPressed, - "blue": self.blueButtonPressed + "blue": self.blueButtonPressed, + "info": self.closeInfo }) self["actions"].csel = self self.onLayoutFinish.append(self.onCreate) + def closeClose(self): + self.close(False) + + def closeInfo(self): + self.close(True) + #just used in multipeg def onCreate(self): l = self["list"] diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index e3fa423f..393f6901 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -358,7 +358,7 @@ class InfoBarEPG: def __init__(self): self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", { - "showEPGList": (self.showEPGList, _("show EPG...")), + "showEPGList": (self.openSingleServiceEPG, _("show EPG...")), }) def showEPGList(self): @@ -374,6 +374,36 @@ class InfoBarEPG: else: #no bouquets so we open single epg self.openSingleEPGSelector(self.session.nav.getCurrentlyPlayingServiceReference()) + def bouquetEPGCallback(self, info): + if info: + self.openSingleServiceEPG() + + def singleEPGCallback(self, info): + if info: + self.showEPGList() + + def openSingleServiceEPG(self): + ref=self.session.nav.getCurrentlyPlayingServiceReference() + ptr=eEPGCache.getInstance() + if ptr.startTimeQuery(ref) != -1: + self.session.openWithCallback(self.singleEPGCallback, EPGSelection, ref) + else: # try to show now/next + print 'no epg for service', ref.toString() + try: + self.epglist = [ ] + service = self.session.nav.getCurrentService() + info = service.info() + ptr=info.getEvent(0) + if ptr: + self.epglist.append(ptr) + ptr=info.getEvent(1) + if ptr: + self.epglist.append(ptr) + if len(self.epglist) > 0: + self.session.open(EventView, self.epglist[0], ServiceReference(ref), self.eventViewCallback) + except: + pass + def openBouquetEPG(self, bouquet): ptr=eEPGCache.getInstance() services = [ ] @@ -387,7 +417,7 @@ class InfoBarEPG: continue services.append(ServiceReference(service)) if len(services): - self.session.open(EPGSelection, services) + self.session.openWithCallback(self.bouquetEPGCallback, EPGSelection, services) def openSingleEPGSelector(self, ref): ptr=eEPGCache.getInstance() -- 2.30.2