toggle between epg types with info
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 2 Jan 2006 13:08:25 +0000 (13:08 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 2 Jan 2006 13:08:25 +0000 (13:08 +0000)
data/keymap.xml
lib/python/Screens/EpgSelection.py
lib/python/Screens/InfoBarGenerics.py

index c67028574999703f2e5f12e84eb9da90d9fe0a11..221f1552e707972439461af63a6d0a72db7ee972 100644 (file)
                <key id="KEY_GREEN" mapto="timerAdd" flags="m" />
                <key id="KEY_YELLOW" mapto="yellow" flags="m" />
                <key id="KEY_BLUE" mapto="blue" flags="m" />
+               <key id="KEY_INFO" mapto="info" flags="m" />
        </map>
 
        <map context="EventViewActions">
index 6f5560038607797c66a48e9966266c7978fb86f5..9458e39564a209ccd1d0a61edd01083f1a33ecc8 100644 (file)
@@ -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"]
index e3fa423f818df4c362242b18a1887955f9fcf93c..393f6901c40f3c25476e6a61ee29dfb86b096054 100644 (file)
@@ -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()