many info handling changes (nownext/multi/single epg)
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 25 Jan 2006 16:15:44 +0000 (16:15 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 25 Jan 2006 16:15:44 +0000 (16:15 +0000)
data/button-fs8.png [new file with mode: 0644]
data/button-selected-fs8.png [new file with mode: 0644]
data/keymap.xml
data/skin.xml
lib/python/Components/EpgList.py
lib/python/Components/UsageConfig.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/EpgSelection.py
lib/python/Screens/EventView.py
lib/python/Screens/InfoBarGenerics.py

diff --git a/data/button-fs8.png b/data/button-fs8.png
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/data/button-selected-fs8.png b/data/button-selected-fs8.png
new file mode 100644 (file)
index 0000000..e69de29
index 1e6fbd5accfecf67a0060edd3bcd64862a41f395..f2fae39b31c825dcc517c5be92109a01ed2dc8b5 100644 (file)
@@ -64,7 +64,7 @@
        </map>
 
        <map context="InfobarEPGActions">
        </map>
 
        <map context="InfobarEPGActions">
-               <key id="KEY_INFO" mapto="showEPGList" flags="m" />
+               <key id="KEY_INFO" mapto="showEventInfo" flags="m" />
        </map>
        
        <map context="InfobarInstantRecord">
        </map>
        
        <map context="InfobarInstantRecord">
                <key id="KEY_LEFT" mapto="prevEvent" flags="mr" />
                <key id="KEY_RIGHT" mapto="nextEvent" flags="mr" />
                <key id="KEY_GREEN" mapto="timerAdd" flags="m" />
                <key id="KEY_LEFT" mapto="prevEvent" flags="mr" />
                <key id="KEY_RIGHT" mapto="nextEvent" flags="mr" />
                <key id="KEY_GREEN" mapto="timerAdd" flags="m" />
+               <key id="KEY_INFO" mapto="cancel" flags="m" />
+       </map>
+       
+       <map context="EventViewEPGActions">
+               <key id="KEY_YELLOW" mapto="openSingleServiceEPG" flags="m" />
+               <key id="KEY_BLUE" mapto="openMultiServiceEPG" flags="m" />
        </map>
 
        <map context="OkCancelActions">
        </map>
 
        <map context="OkCancelActions">
index ec26d55520d4c44fa42dd334e94848f0b8e63b52..dc1d86b9f4bd682581fb4dba335d8340adcc56bd 100644 (file)
@@ -40,6 +40,9 @@
                        <!--<widget name="menu" position="10,55" size="280,150" font="Regular;23" />-->
                        <widget name="menu" position="10,55" size="290,175" scrollbarMode="showOnDemand" />
                </screen>
                        <!--<widget name="menu" position="10,55" size="280,150" font="Regular;23" />-->
                        <widget name="menu" position="10,55" size="290,175" scrollbarMode="showOnDemand" />
                </screen>
+               <screen name="BouquetSelector" position="210,150" size="300,195" title="Choose bouquet">
+                       <widget name="menu" position="10,10" size="280,175" scrollbarMode="showOnDemand" />
+               </screen>
                <screen name="Scart" position="0,0" size="720,576">
                </screen>
                <screen name="ServiceInfo" position="160,120" size="400,330" title="Serviceinfo">
                <screen name="Scart" position="0,0" size="720,576">
                </screen>
                <screen name="ServiceInfo" position="160,120" size="400,330" title="Serviceinfo">
                        <widget name="key_blue" position="420,0" size="140,40" backgroundColor="blue" font="Regular;21" />
                </screen>
                <screen name="EPGSelection" position="90,100" size="560,420" title="EPG Selection">
                        <widget name="key_blue" position="420,0" size="140,40" backgroundColor="blue" font="Regular;21" />
                </screen>
                <screen name="EPGSelection" position="90,100" size="560,420" title="EPG Selection">
+                       <widget name="key_red" position="0,0" size="140,30" backgroundColor="red" font="Regular;21" />
+                       <widget name="key_green" position="140,0" size="140,30" backgroundColor="green" font="Regular;21" />
+                       <widget name="key_yellow" position="280,0" size="140,30" backgroundColor="yellow" font="Regular;21" />
+                       <widget name="key_blue" position="420,0" size="140,30" backgroundColor="blue" font="Regular;21" />
                        <widget name="list" position="0,40" size="560,375" scrollbarMode="showOnDemand" />
                        <widget name="list" position="0,40" size="560,375" scrollbarMode="showOnDemand" />
+               </screen>
+               <screen name="EPGSelectionMulti" position="90,100" size="560,420" title="EPG Selection">
                        <widget name="key_red" position="0,0" size="140,30" backgroundColor="red" font="Regular;21" />
                        <widget name="key_green" position="140,0" size="140,30" backgroundColor="green" font="Regular;21" />
                        <widget name="key_yellow" position="280,0" size="140,30" backgroundColor="yellow" font="Regular;21" />
                        <widget name="key_blue" position="420,0" size="140,30" backgroundColor="blue" font="Regular;21" />
                        <widget name="key_red" position="0,0" size="140,30" backgroundColor="red" font="Regular;21" />
                        <widget name="key_green" position="140,0" size="140,30" backgroundColor="green" font="Regular;21" />
                        <widget name="key_yellow" position="280,0" size="140,30" backgroundColor="yellow" font="Regular;21" />
                        <widget name="key_blue" position="420,0" size="140,30" backgroundColor="blue" font="Regular;21" />
+                       <widget name="now_button" position="10,40" size="123,40" pixmap="/usr/share/enigma2/button-fs8.png" />
+                       <widget name="next_button" position="143,40" size="123,40" pixmap="/usr/share/enigma2/button-fs8.png" />
+                       <widget name="more_button" position="276,40" size="123,40" pixmap="/usr/share/enigma2/button-fs8.png" />
+                       <widget name="now_button_sel" position="10,40" size="123,40" pixmap="/usr/share/enigma2/button-selected-fs8.png" />
+                       <widget name="next_button_sel" position="143,40" size="123,40" pixmap="/usr/share/enigma2/button-selected-fs8.png" />
+                       <widget name="more_button_sel" position="276,40" size="123,40" pixmap="/usr/share/enigma2/button-selected-fs8.png" />
+                       <widget name="now_text" text="NOW" zPosition="2" position="10,40" size="123,40" transparent="1" halign="center" valign="center" font="Regular;21" />
+                       <widget name="next_text" text="NEXT" zPosition="2" position="143,40" size="123,40" transparent="1" halign="center" valign="center" font="Regular;21" />
+                       <widget name="more_text" text="MORE" zPosition="2" position="276,40" size="123,40" transparent="1" halign="center" valign="center" font="Regular;21" />
+                       <widget name="date" position="410,40" size="140,40" valign="center" halign="right" font="Regular;24" />
+                       <widget name="list" position="00,85" size="560,325" scrollbarMode="showOnDemand" />
                </screen>
                <screen name="EventView" position="100,100" size="520,380" title="Eventview">
                </screen>
                <screen name="EventView" position="100,100" size="520,380" title="Eventview">
-                       <widget name="epg_description" position="10,5" size="500,335" font="Regular;22" />
+                       <widget name="key_red" position="0,0" size="130,30" backgroundColor="red" font="Regular;21" />
+                       <widget name="key_green" position="130,0" size="130,30" backgroundColor="green" font="Regular;21" />
+                       <widget name="key_yellow" position="260,0" size="130,30" backgroundColor="yellow" font="Regular;21" />
+                       <widget name="key_blue" position="390,0" size="130,30" backgroundColor="blue" font="Regular;21" />
+                       <widget name="epg_description" position="10,40" size="500,305" font="Regular;22" />
                        <widget name="datetime" position="10,345" size="130,30" font="Regular;22" />
                        <widget name="duration" position="140,345" size="100,30" font="Regular;22" />
                        <widget name="channel" position="240,345" size="270,30" font="Regular;22" />
                        <widget name="datetime" position="10,345" size="130,30" font="Regular;22" />
                        <widget name="duration" position="140,345" size="100,30" font="Regular;22" />
                        <widget name="channel" position="240,345" size="270,30" font="Regular;22" />
index cc5bc619f8feae21b8339142219750995ec1adc4..a87504858a19c472d0237802a38f5f25e862065c 100644 (file)
@@ -60,6 +60,11 @@ class EPGList(HTMLComponent, GUIComponent):
                        event = self.epgcache.lookupEventId(service.ref, eventid)
                return event
 
                        event = self.epgcache.lookupEventId(service.ref, eventid)
                return event
 
+       def getCurrentChangeCount(self):
+               if self.type == EPG_TYPE_SINGLE:
+                       return 0
+               return self.l.getCurrentSelection()[0][0]
+
        def getCurrent(self):
                if self.type == EPG_TYPE_SINGLE:
                        if SINGLE_CPP > 0:
        def getCurrent(self):
                if self.type == EPG_TYPE_SINGLE:
                        if SINGLE_CPP > 0:
@@ -69,8 +74,8 @@ class EPGList(HTMLComponent, GUIComponent):
                                evt = self.getEventFromId(self.service, eventid)
                else:
                        tmp = self.l.getCurrentSelection()[0]
                                evt = self.getEventFromId(self.service, eventid)
                else:
                        tmp = self.l.getCurrentSelection()[0]
-                       eventid = tmp[0]
-                       service = ServiceReference(tmp[1])
+                       eventid = tmp[1]
+                       service = ServiceReference(tmp[2])
                        event = self.getEventFromId(service, eventid)
                        evt = ( event, service )
                return evt
                        event = self.getEventFromId(service, eventid)
                        evt = ( event, service )
                return evt
@@ -138,13 +143,13 @@ class EPGList(HTMLComponent, GUIComponent):
                res.append((eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r2.height(), 0, RT_HALIGN_LEFT, EventName))
                return res
 
                res.append((eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r2.height(), 0, RT_HALIGN_LEFT, EventName))
                return res
 
-       def buildMultiEntry(self, service, eventId, begTime, duration, EventName, nowTime, service_name):
+       def buildMultiEntry(self, changecount, service, eventId, begTime, duration, EventName, nowTime, service_name):
                sname = service_name
                r1=self.service_rect
                r2=self.progress_rect
                r3=self.descr_rect
                r4=self.start_end_rect
                sname = service_name
                r1=self.service_rect
                r2=self.progress_rect
                r3=self.descr_rect
                r4=self.start_end_rect
-               res = [ (eventId, service, begTime, duration) ]
+               res = [ (changecount, eventId, service, begTime, duration) ]
                re = compile('\xc2\x86.*?\xc2\x87')
                list = re.findall(sname)
                if len(list):
                re = compile('\xc2\x86.*?\xc2\x87')
                list = re.findall(sname)
                if len(list):
@@ -186,18 +191,19 @@ class EPGList(HTMLComponent, GUIComponent):
                tmp = self.queryEPG(test)
                self.list = [ ]
                for x in tmp:
                tmp = self.queryEPG(test)
                self.list = [ ]
                for x in tmp:
-                       self.list.append(self.buildMultiEntry(x[0], x[1], x[2], x[3], x[4], x[5], x[6]))
+                       self.list.append(self.buildMultiEntry(0, x[0], x[1], x[2], x[3], x[4], x[5], x[6]))
                self.l.setList(self.list)
                print time() - t
                self.l.setList(self.list)
                print time() - t
+               self.selectionChanged()
 
        def updateMultiEPG(self, direction):
                t = time()
                test = [ 'RIBDTCN' ]
                for x in self.list:
                        data = x[0]
 
        def updateMultiEPG(self, direction):
                t = time()
                test = [ 'RIBDTCN' ]
                for x in self.list:
                        data = x[0]
-                       service = data[1]
-                       begTime = data[2]
-                       duration = data[3]
+                       service = data[2]
+                       begTime = data[3]
+                       duration = data[4]
                        if begTime is None:
                                begTime = 0
                        test.append((service, direction, begTime))
                        if begTime is None:
                                begTime = 0
                        test.append((service, direction, begTime))
@@ -205,8 +211,10 @@ class EPGList(HTMLComponent, GUIComponent):
                tmp = self.queryEPG(test)
                cnt=0
                for x in tmp:
                tmp = self.queryEPG(test)
                cnt=0
                for x in tmp:
-                       if x[2] is not None:
-                               self.list[cnt]=self.buildMultiEntry(x[0], x[1], x[2], x[3], x[4], x[5], x[6])
+                       changecount = self.list[cnt][0][0] + direction
+                       if changecount >= 0:
+                               if x[2] is not None:
+                                       self.list[cnt]=self.buildMultiEntry(changecount, x[0], x[1], x[2], x[3], x[4], x[5], x[6])
                        cnt+=1
                self.l.setList(self.list)
                print time() - t
                        cnt+=1
                self.l.setList(self.list)
                print time() - t
@@ -227,3 +235,4 @@ class EPGList(HTMLComponent, GUIComponent):
 #                              self.list.append(self.buildSingleEntry(refstr, x[0], x[1], x[2], x[3]))
                        self.l.setList(self.list)
                print time() - t
 #                              self.list.append(self.buildSingleEntry(refstr, x[0], x[1], x[2], x[3]))
                        self.l.setList(self.list)
                print time() - t
+               self.selectionChanged()
index 779f5cf37a75216161a181c428087af1427de94f..d51b512ab67d8f571f3cac572db26300c78d70f4 100644 (file)
@@ -4,7 +4,6 @@ from enigma import *
 
 def InitUsageConfig():
        config.usage = ConfigSubsection();
 
 def InitUsageConfig():
        config.usage = ConfigSubsection();
-       config.usage.epgtoggle = configElement("config.usage.epgtoggle", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
        config.usage.showdish = configElement("config.usage.showdish", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
        config.usage.multibouquet = configElement("config.usage.multibouquet", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
 
        config.usage.showdish = configElement("config.usage.showdish", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
        config.usage.multibouquet = configElement("config.usage.multibouquet", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) )
 
index 4c8b2486198bb3bab2e7e9bddc2fffa2f62106d7..89bc2154d8d393cd69ff9c74426f447b2027ffbd 100644 (file)
@@ -2,6 +2,7 @@ from Screen import Screen
 from Components.Button import Button
 from Components.ServiceList import ServiceList
 from Components.ActionMap import NumberActionMap, ActionMap
 from Components.Button import Button
 from Components.ServiceList import ServiceList
 from Components.ActionMap import NumberActionMap, ActionMap
+from Components.MenuList import MenuList
 from EpgSelection import EPGSelection
 from enigma import eServiceReference, eEPGCache, eEPGCachePtr, eServiceCenter, eServiceCenterPtr, iMutableServiceListPtr, iStaticServiceInformationPtr, eTimer, eDVBDB
 from Components.config import config, configElement, ConfigSubsection, configText, currentConfigSelectionElement
 from EpgSelection import EPGSelection
 from enigma import eServiceReference, eEPGCache, eEPGCachePtr, eServiceCenter, eServiceCenterPtr, iMutableServiceListPtr, iStaticServiceInformationPtr, eTimer, eDVBDB
 from Components.config import config, configElement, ConfigSubsection, configText, currentConfigSelectionElement
@@ -17,17 +18,27 @@ from os import remove
 
 import xml.dom.minidom
 
 
 import xml.dom.minidom
 
-class BouquetSelector(FixedMenu):
+class BouquetSelector(Screen):
        def __init__(self, session, bouquets, selectedFunc):
        def __init__(self, session, bouquets, selectedFunc):
+               Screen.__init__(self, session)
+
                self.selectedFunc=selectedFunc
                self.selectedFunc=selectedFunc
+
+               self["actions"] = ActionMap(["OkCancelActions"],
+                       {
+                               "ok": self.okbuttonClick,
+                               "cancel": self.cancelClick
+                       })
                entrys = [ ]
                for x in bouquets:
                entrys = [ ]
                for x in bouquets:
-                       entrys.append((x[0], self.bouquetSelected, x[1]))
-               FixedMenu.__init__(self, session, "Bouquetlist", entrys)
-               self.skinName = "Menu"
+                       entrys.append((x[0], x[1]))
+               self["menu"] = MenuList(entrys)
+
+       def okbuttonClick(self):
+               self.selectedFunc(self["menu"].getCurrent()[1])
 
 
-       def bouquetSelected(self):
-               self.selectedFunc(self["menu"].getCurrent()[2])
+       def cancelClick(self):
+               self.close(False)
 
 class ChannelContextMenu(FixedMenu):
        def __init__(self, session, csel):
 
 class ChannelContextMenu(FixedMenu):
        def __init__(self, session, csel):
index d6fee56759e5b50b32642a5ce888c9a3ae0bc261..c8db81b33ba4ed8662f5f2409f013a9add88ff10 100644 (file)
@@ -1,8 +1,11 @@
 from Screen import Screen
 from Components.Button import Button
 from Screen import Screen
 from Components.Button import Button
+from Components.Pixmap import Pixmap
+from Components.Label import Label
 from Components.EpgList import *
 from Components.ActionMap import ActionMap
 from Components.EpgList import *
 from Components.ActionMap import ActionMap
-from Screens.EventView import EventView
+from Components.ScrollLabel import ScrollLabel
+from Screens.EventView import EventViewSimple
 from enigma import eServiceReference, eServiceEventPtr
 from Screens.FixedMenu import FixedMenu
 from RecordTimer import RecordTimerEntry, parseEvent
 from enigma import eServiceReference, eServiceEventPtr
 from Screens.FixedMenu import FixedMenu
 from RecordTimer import RecordTimerEntry, parseEvent
@@ -10,28 +13,40 @@ from TimerEdit import TimerEditList
 from TimerEntry import TimerEntry
 from ServiceReference import ServiceReference
 from Components.config import config, currentConfigSelectionElement
 from TimerEntry import TimerEntry
 from ServiceReference import ServiceReference
 from Components.config import config, currentConfigSelectionElement
+from time import localtime
 
 import xml.dom.minidom
 
 class EPGSelection(Screen):
 
 import xml.dom.minidom
 
 class EPGSelection(Screen):
-       def __init__(self, session, service):
+       def __init__(self, session, service, zapFunc=None):
                Screen.__init__(self, session)
                Screen.__init__(self, session)
-
                self["key_red"] = Button("")
                self["key_red"] = Button("")
-               self["key_green"] = Button(_("Add timer"))
-
+               self.closeRecursive = False
                if isinstance(service, eServiceReference):
                        self.type = EPG_TYPE_SINGLE
                        self["key_yellow"] = Button()
                        self["key_blue"] = Button()
                        self.currentService=ServiceReference(service)
                else:
                if isinstance(service, eServiceReference):
                        self.type = EPG_TYPE_SINGLE
                        self["key_yellow"] = Button()
                        self["key_blue"] = Button()
                        self.currentService=ServiceReference(service)
                else:
+                       self.skinName = "EPGSelectionMulti"
                        self.type = EPG_TYPE_MULTI
                        self["key_yellow"] = Button(_("Prev"))
                        self["key_blue"] = Button(_("Next"))
                        self.type = EPG_TYPE_MULTI
                        self["key_yellow"] = Button(_("Prev"))
                        self["key_blue"] = Button(_("Next"))
+                       self["now_button"] = Pixmap()
+                       self["next_button"] = Pixmap()
+                       self["more_button"] = Pixmap()
+                       self["now_button_sel"] = Pixmap()
+                       self["next_button_sel"] = Pixmap()
+                       self["more_button_sel"] = Pixmap()
+                       self["now_text"] = Label()
+                       self["next_text"] = Label()
+                       self["more_text"] = Label()
+                       self["date"] = Label()
                        self.services = service
                        self.services = service
+                       self.zapFunc = zapFunc
 
 
-               self["list"] = EPGList(self.type)
+               self["key_green"] = Button(_("Add timer"))
+               self["list"] = EPGList(self.type, self.onSelectionChanged)
 
                class ChannelActionMap(ActionMap):
                        def action(self, contexts, action):
 
                class ChannelActionMap(ActionMap):
                        def action(self, contexts, action):
@@ -44,21 +59,26 @@ class EPGSelection(Screen):
                                "timerAdd": self.timerAdd,
                                "yellow": self.yellowButtonPressed,
                                "blue": self.blueButtonPressed,
                                "timerAdd": self.timerAdd,
                                "yellow": self.yellowButtonPressed,
                                "blue": self.blueButtonPressed,
-                               "info": self.infoKeyPressed
+                               "info": self.infoKeyPressed,
+                               "zapTo": self.zapTo
                        })
                self["actions"].csel = self
 
                self.onLayoutFinish.append(self.onCreate)
 
                        })
                self["actions"].csel = self
 
                self.onLayoutFinish.append(self.onCreate)
 
-       def infoKeyPressed(self):
-               if currentConfigSelectionElement(config.usage.epgtoggle) == "yes":
-                       self.close(True)
-               else:
-                       self.close(False)
-
        def closeScreen(self):
        def closeScreen(self):
-               self.close(False)
+               self.close(self.closeRecursive or self.type == EPG_TYPE_SINGLE)
 
 
+       def infoKeyPressed(self):
+               if self.type == EPG_TYPE_MULTI:
+                       cur = self["list"].getCurrent()
+                       event = cur[0]
+                       service = cur[1]
+               else:
+                       event = self["list"].getCurrent()
+                       service = self.currentService
+               if event is not None:
+                       self.session.open(EventViewSimple, event, service, self.eventViewCallback)
 
        #just used in multipeg
        def onCreate(self):
 
        #just used in multipeg
        def onCreate(self):
@@ -88,16 +108,17 @@ class EPGSelection(Screen):
                                setEvent(cur[0])
                                setService(cur[1])
 
                                setEvent(cur[0])
                                setService(cur[1])
 
+       def zapTo(self): # just used in multiepg
+               if self.zapFunc != None:
+                       self.closeRecursive = True
+                       ref = self["list"].getCurrent()[1]
+                       self.zapFunc(ref.ref)
+
        def eventSelected(self):
                if self.type == EPG_TYPE_SINGLE:
        def eventSelected(self):
                if self.type == EPG_TYPE_SINGLE:
-                       event = self["list"].getCurrent()
-                       service = self.currentService
+                       self.infoKeyPressed()
                else: # EPG_TYPE_MULTI
                else: # EPG_TYPE_MULTI
-                       cur = self["list"].getCurrent()
-                       event = cur[0]
-                       service = cur[1]
-               if event is not None:
-                       self.session.open(EventView, event, service, self.eventViewCallback)
+                       self.zapTo()
 
        def yellowButtonPressed(self):
                if self.type == EPG_TYPE_MULTI:
 
        def yellowButtonPressed(self):
                if self.type == EPG_TYPE_MULTI:
@@ -131,3 +152,48 @@ class EPGSelection(Screen):
 
        def moveDown(self):
                self["list"].moveDown()
 
        def moveDown(self):
                self["list"].moveDown()
+
+       def applyButtonState(self, state):
+               if state == 1:
+                       self["now_button_sel"].showWidget()
+                       self["now_button"].hideWidget()
+               else:
+                       self["now_button"].showWidget()
+                       self["now_button_sel"].hideWidget()
+
+               if state == 2:
+                       self["next_button_sel"].showWidget()
+                       self["next_button"].hideWidget()
+               else:
+                       self["next_button"].showWidget()
+                       self["next_button_sel"].hideWidget()
+
+               if state == 3:
+                       self["more_button_sel"].showWidget()
+                       self["more_button"].hideWidget()
+               else:
+                       self["more_button"].showWidget()
+                       self["more_button_sel"].hideWidget()
+
+       def onSelectionChanged(self):
+               if self.type == EPG_TYPE_MULTI:
+                       count = self["list"].getCurrentChangeCount()
+                       if count > 1:
+                               self.applyButtonState(3)
+                       elif count > 0:
+                               self.applyButtonState(2)
+                       else:
+                               self.applyButtonState(1)
+                       days = [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]
+                       datastr = ""
+                       event = self["list"].getCurrent()[0]
+                       if event is not None:
+                               now = time()
+                               beg = event.getBeginTime()
+                               nowTime = localtime(now)
+                               begTime = localtime(beg)
+                               if nowTime[2] != begTime[2]:
+                                       datestr = '%s %d.%d.'%(days[begTime[6]], begTime[2], begTime[1])
+                               else:
+                                       datestr = '%s %d.%d.'%(_("Today"), begTime[2], begTime[1])
+                       self["date"].setText(datestr)
index d96be6d604c61255bb0b6a6c1cdc393617daea14..95c875f582cc0345956dbff766582743bf1f2626 100644 (file)
@@ -1,5 +1,6 @@
 from Screen import Screen
 from Components.ActionMap import ActionMap
 from Screen import Screen
 from Components.ActionMap import ActionMap
+from Components.Button import Button
 from Components.Label import Label
 from Components.ScrollLabel import ScrollLabel
 from enigma import eServiceEventPtr
 from Components.Label import Label
 from Components.ScrollLabel import ScrollLabel
 from enigma import eServiceEventPtr
@@ -7,9 +8,8 @@ from ServiceReference import ServiceReference
 from RecordTimer import RecordTimerEntry, parseEvent
 from TimerEntry import TimerEntry
 
 from RecordTimer import RecordTimerEntry, parseEvent
 from TimerEntry import TimerEntry
 
-class EventView(Screen):
-       def __init__(self, session, Event, Ref, callback=None):
-               Screen.__init__(self, session)
+class EventViewBase:
+       def __init__(self, Event, Ref, callback=None):
                self.cbFunc = callback
                self.currentService=Ref
                self.event = Event
                self.cbFunc = callback
                self.currentService=Ref
                self.event = Event
@@ -17,6 +17,10 @@ class EventView(Screen):
                self["datetime"] = Label()
                self["channel"] = Label()
                self["duration"] = Label()
                self["datetime"] = Label()
                self["channel"] = Label()
                self["duration"] = Label()
+               self["key_red"] = Button(_(""))
+               self["key_green"] = Button(_("Add Timer"))
+               self["key_yellow"] = Button(_(""))
+               self["key_blue"] = Button(_(""))
                self["actions"] = ActionMap(["OkCancelActions", "EventViewActions"],
                        {
                                "cancel": self.close,
                self["actions"] = ActionMap(["OkCancelActions", "EventViewActions"],
                        {
                                "cancel": self.close,
@@ -49,7 +53,7 @@ class EventView(Screen):
                if (answer[0]):
                        self.session.nav.RecordTimer.record(answer[1])
                else:
                if (answer[0]):
                        self.session.nav.RecordTimer.record(answer[1])
                else:
-                       print "Timeredit aborted"       
+                       print "Timeredit aborted"
 
        def setService(self, service):
                self.currentService=service
 
        def setService(self, service):
                self.currentService=service
@@ -77,6 +81,25 @@ class EventView(Screen):
 
        def pageUp(self):
                self["epg_description"].pageUp()
 
        def pageUp(self):
                self["epg_description"].pageUp()
-       
+
        def pageDown(self):
                self["epg_description"].pageDown()
        def pageDown(self):
                self["epg_description"].pageDown()
+
+class EventViewSimple(Screen, EventViewBase):
+       def __init__(self, session, Event, Ref, callback=None):
+               Screen.__init__(self, session)
+               self.skinName = "EventView"
+               EventViewBase.__init__(self, Event, Ref, callback)
+
+class EventViewEPGSelect(Screen, EventViewBase):
+       def __init__(self, session, Event, Ref, callback=None, singleEPGCB=None, multiEPGCB=None):
+               Screen.__init__(self, session)
+               self.skinName = "EventView"
+               EventViewBase.__init__(self, Event, Ref, callback)
+               self["key_yellow"].setText(_("Single EPG"))
+               self["key_blue"].setText(_("Multi EPG"))
+               self["epgactions"] = ActionMap(["EventViewEPGActions"],
+                       {
+                               "openSingleServiceEPG": singleEPGCB,
+                               "openMultiServiceEPG": multiEPGCB
+                       })
index 605a15fdce653ae314198b51f82c15dd1092b910..2da8a4bd04df032633cf2822e05acc3752123fa4 100644 (file)
@@ -18,7 +18,7 @@ from EpgSelection import EPGSelection
 from Screens.MessageBox import MessageBox
 from Screens.Dish import Dish
 from Screens.Standby import Standby
 from Screens.MessageBox import MessageBox
 from Screens.Dish import Dish
 from Screens.Standby import Standby
-from Screens.EventView import EventView
+from Screens.EventView import EventViewEPGSelect
 from Screens.MinuteInput import MinuteInput
 from Components.Harddisk import harddiskmanager
 
 from Screens.MinuteInput import MinuteInput
 from Components.Harddisk import harddiskmanager
 
@@ -305,59 +305,18 @@ class InfoBarEPG:
        def __init__(self):
                self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", 
                        {
        def __init__(self):
                self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", 
                        {
-                               "showEPGList": (self.showEPG, _("show EPG...")),
+                               "showEventInfo": (self.openEventView, _("show EPG...")),
                        })
 
                        })
 
-       def showEPG(self):
-               if currentConfigSelectionElement(config.usage.epgtoggle) == "yes":
-                       self.openSingleServiceEPG()
-               else:
-                       self.showEPGList()
-
-       def showEPGList(self):
-               bouquets = self.servicelist.getBouquetList()
-               if bouquets is None:
-                       cnt = 0
-               else:
-                       cnt = len(bouquets)
-               if cnt > 1: # show bouquet list
-                       self.session.open(BouquetSelector, bouquets, self.openBouquetEPG)
-               elif cnt == 1: # add to only one existing bouquet
-                       self.openBouquetEPG(bouquets[0][1])
-               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 openEventView(self):
-               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 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()
+       def zapToService(self, service):
+               if not service is None:
+                       if self.servicelist.getRoot() != self.epg_bouquet: #already in correct bouquet?
+                               self.servicelist.clearPath()
+                               if self.servicelist.bouquet_root != self.epg_bouquet:
+                                       self.servicelist.enterPath(self.servicelist.bouquet_root)
+                               self.servicelist.enterPath(self.epg_bouquet)
+                       self.servicelist.setCurrentSelection(service) #select the service in servicelist
+                       self.servicelist.zap()
 
        def openBouquetEPG(self, bouquet):
                ptr=eEPGCache.getInstance()
 
        def openBouquetEPG(self, bouquet):
                ptr=eEPGCache.getInstance()
@@ -372,28 +331,53 @@ class InfoBarEPG:
                                        continue
                                services.append(ServiceReference(service))
                if len(services):
                                        continue
                                services.append(ServiceReference(service))
                if len(services):
-                       self.session.openWithCallback(self.bouquetEPGCallback, EPGSelection, services)
+                       self.epg_bouquet = bouquet
+                       self.session.openWithCallback(self.closed, EPGSelection, services, self.zapToService)
+
+       def closed(self, ret):
+               if ret:
+                       self.close(ret)
 
 
-       def openSingleEPGSelector(self, ref):
+       def openMultiServiceEPG(self):
+               bouquets = self.servicelist.getBouquetList()
+               if bouquets is None:
+                       cnt = 0
+               else:
+                       cnt = len(bouquets)
+               if cnt > 1: # show bouquet list
+                       self.session.openWithCallback(self.closed, BouquetSelector, bouquets, self.openBouquetEPG)
+               elif cnt == 1: 
+                       self.openBouquetEPG(bouquets[0][1])
+
+       def openSingleServiceEPG(self):
+               ref=self.session.nav.getCurrentlyPlayingServiceReference()
                ptr=eEPGCache.getInstance()
                ptr=eEPGCache.getInstance()
-               if ptr.startTimeQuery(ref) != -1:
-                       self.session.open(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)
+               self.session.openWithCallback(self.closed, EPGSelection, ref)
+
+       def openEventView(self):
+               self.epglist = [ ]
+               service = self.session.nav.getCurrentService()
+               ref = self.session.nav.getCurrentlyPlayingServiceReference()
+               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:
+                       epg = eEPGCache.getInstance()
+                       ptr = epg.lookupEventTime(ref, -1)
+                       if ptr:
+                               self.epglist.append(ptr)
+                               ptr = epg.lookupEventTime(ref, ptr.getBeginTime(), +1)
                                if ptr:
                                        self.epglist.append(ptr)
                                if ptr:
                                        self.epglist.append(ptr)
-                               if len(self.epglist) > 0:
-                                       self.session.open(EventView, self.epglist[0], ServiceReference(ref), self.eventViewCallback)
-                       except:
-                               pass
+               if len(self.epglist) > 0:
+                       self.session.open(EventViewEPGSelect, self.epglist[0], ServiceReference(ref), self.eventViewCallback, self.openSingleServiceEPG, self.openMultiServiceEPG)
+               else:
+                       print "no epg for the service avail.. so we show multiepg instead of eventinfo"
+                       self.openMultiServiceEPG()
 
        def eventViewCallback(self, setEvent, setService, val): #used for now/next displaying
                if len(self.epglist) > 1:
 
        def eventViewCallback(self, setEvent, setService, val): #used for now/next displaying
                if len(self.epglist) > 1: