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 c670285..221f155 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_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">
        </map>
 
        <map context="EventViewActions">
index 6f55600..9458e39 100644 (file)
@@ -38,16 +38,23 @@ class EPGSelection(Screen):
 
                self["actions"] = ChannelActionMap(["EPGSelectActions", "OkCancelActions"],
                        {
 
                self["actions"] = ChannelActionMap(["EPGSelectActions", "OkCancelActions"],
                        {
-                               "cancel": self.close,
+                               "cancel": self.closeClose,
                                "ok": self.eventSelected,
                                "timerAdd": self.timerAdd,
                                "yellow": self.yellowButtonPressed,
                                "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)
 
                        })
                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"]
        #just used in multipeg
        def onCreate(self):
                l = self["list"]
index e3fa423..393f690 100644 (file)
@@ -358,7 +358,7 @@ class InfoBarEPG:
        def __init__(self):
                self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", 
                        {
        def __init__(self):
                self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", 
                        {
-                               "showEPGList": (self.showEPGList, _("show EPG...")),
+                               "showEPGList": (self.openSingleServiceEPG, _("show EPG...")),
                        })
 
        def showEPGList(self):
                        })
 
        def showEPGList(self):
@@ -374,6 +374,36 @@ class InfoBarEPG:
                else: #no bouquets so we open single epg
                        self.openSingleEPGSelector(self.session.nav.getCurrentlyPlayingServiceReference())
 
                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 = [ ]
        def openBouquetEPG(self, bouquet):
                ptr=eEPGCache.getInstance()
                services = [ ]
@@ -387,7 +417,7 @@ class InfoBarEPG:
                                        continue
                                services.append(ServiceReference(service))
                if len(services):
                                        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()
 
        def openSingleEPGSelector(self, ref):
                ptr=eEPGCache.getInstance()