display clock png in single epg list for fitting timers (we have a problem with the...
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Wed, 1 Mar 2006 02:37:17 +0000 (02:37 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Wed, 1 Mar 2006 02:37:17 +0000 (02:37 +0000)
RecordTimer.py
data/epgclock-fs8.png [new file with mode: 0644]
lib/python/Components/EpgList.py
lib/python/Screens/EpgSelection.py

index 4c3304c..9f78ff2 100644 (file)
@@ -328,8 +328,8 @@ class RecordTimer(timer.Timer):
                
        def isInTimer(self, eventid, begin, duration, service):
                time_match = 0
                
        def isInTimer(self, eventid, begin, duration, service):
                time_match = 0
-               for x in self.timer:
-                       if x.service_ref == service:
+               for x in self.timer_list:
+                       if str(x.service_ref) == str(service):
                                if x.eit is not None and x.repeated == 0:
                                        if x.eit == eventid:
                                                return duration
                                if x.eit is not None and x.repeated == 0:
                                        if x.eit == eventid:
                                                return duration
diff --git a/data/epgclock-fs8.png b/data/epgclock-fs8.png
new file mode 100644 (file)
index 0000000..e69de29
index 542f5d9..7e5dca1 100644 (file)
@@ -5,6 +5,7 @@ from enigma import *
 from re import *
 from time import localtime, time
 from ServiceReference import ServiceReference
 from re import *
 from time import localtime, time
 from ServiceReference import ServiceReference
+from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
 
 EPG_TYPE_SINGLE = 0
 EPG_TYPE_MULTI = 1
 
 EPG_TYPE_SINGLE = 0
 EPG_TYPE_MULTI = 1
@@ -42,7 +43,8 @@ class Rect:
                return self.__width
 
 class EPGList(HTMLComponent, GUIComponent):
                return self.__width
 
 class EPGList(HTMLComponent, GUIComponent):
-       def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None):
+       def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None, timer = None):
+               self.timer = timer
                self.onSelChanged = [ ]
                if selChangedCB is not None:
                        self.onSelChanged.append(selChangedCB)
                self.onSelChanged = [ ]
                if selChangedCB is not None:
                        self.onSelChanged.append(selChangedCB)
@@ -135,13 +137,17 @@ class EPGList(HTMLComponent, GUIComponent):
                                w = width/10*5;
                                self.descr_rect = Rect(xpos, 0, width, height)
 
                                w = width/10*5;
                                self.descr_rect = Rect(xpos, 0, width, height)
 
-       def buildSingleEntry(self, eventId, beginTime, duration, EventName):
+       def buildSingleEntry(self, eventId, beginTime, duration, EventName, rec=False):
                r1=self.datetime_rect
                r2=self.descr_rect
                res = [ eventId ]
                t = localtime(beginTime)
                res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_LEFT, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4])))
                r1=self.datetime_rect
                r2=self.descr_rect
                res = [ eventId ]
                t = localtime(beginTime)
                res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_LEFT, "%02d.%02d, %02d:%02d"%(t[2],t[1],t[3],t[4])))
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r2.height(), 0, RT_HALIGN_LEFT, EventName))
+               if rec:
+                       res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, r2.left(), r2.top(), 21, 21, loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, 'epgclock-fs8.png'))))
+                       res.append((eListboxPythonMultiContent.TYPE_TEXT, r2.left() + 25, r2.top(), r2.width(), r2.height(), 0, RT_HALIGN_LEFT, EventName))
+               else:
+                       res.append((eListboxPythonMultiContent.TYPE_TEXT, r2.left(), r2.top(), r2.width(), r2.height(), 0, RT_HALIGN_LEFT, EventName))
                return res
 
        def buildMultiEntry(self, changecount, service, eventId, begTime, duration, EventName, nowTime, service_name):
                return res
 
        def buildMultiEntry(self, changecount, service, eventId, begTime, duration, EventName, nowTime, service_name):
@@ -232,7 +238,7 @@ 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.buildSingleEntry(x[0], x[1], x[2], x[3]))
+                               self.list.append(self.buildSingleEntry(x[0], x[1], x[2], x[3], (self.timer.isInTimer(eventid=x[0], begin=x[1], duration=x[2], service=service) > 0)))
 #                              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
index 378e0d8..bf841fa 100644 (file)
@@ -46,7 +46,7 @@ class EPGSelection(Screen):
                        self.zapFunc = zapFunc
 
                self["key_green"] = Button(_("Add timer"))
                        self.zapFunc = zapFunc
 
                self["key_green"] = Button(_("Add timer"))
-               self["list"] = EPGList(self.type, self.onSelectionChanged)
+               self["list"] = EPGList(type = self.type, selChangedCB = self.onSelectionChanged, timer = self.session.nav.RecordTimer)
 
                class ChannelActionMap(ActionMap):
                        def action(self, contexts, action):
 
                class ChannelActionMap(ActionMap):
                        def action(self, contexts, action):