small timer fixes by adenin
authorghost <andreas.monzner@multimedia-labs.de>
Sat, 3 Jan 2009 09:36:40 +0000 (10:36 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Sat, 3 Jan 2009 09:36:40 +0000 (10:36 +0100)
lib/python/Components/EpgList.py
lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py
lib/python/Screens/EpgSelection.py

index 01157842e05b1a2482cf4fb5df7d34227be8b1b6..30f566fdb45093d73da2afcbf594be8d379ffa4b 100644 (file)
@@ -55,6 +55,7 @@ class EPGList(HTMLComponent, GUIComponent):
                self.clock_add_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_add.png'))
                self.clock_pre_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_pre.png'))
                self.clock_post_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_post.png'))
+               self.clock_prepost_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_prepost.png'))
 
        def getEventFromId(self, service, eventid):
                event = None
@@ -63,7 +64,7 @@ class EPGList(HTMLComponent, GUIComponent):
                return event
 
        def getCurrentChangeCount(self):
-               if self.type == EPG_TYPE_MULTI:
+               if self.type == EPG_TYPE_MULTI and self.l.getCurrentSelection() is not None:
                        return self.l.getCurrentSelection()[0]
                return 0
 
@@ -95,11 +96,12 @@ class EPGList(HTMLComponent, GUIComponent):
        def selectionChanged(self):
                for x in self.onSelChanged:
                        if x is not None:
-                               try:
-                                       x()
-                               except: # FIXME!!!
-                                       print "FIXME in EPGList.selectionChanged"
-                                       pass
+                               x()
+#                              try:
+#                                      x()
+#                              except: # FIXME!!!
+#                                      print "FIXME in EPGList.selectionChanged"
+#                                      pass
 
        GUI_WIDGET = eListbox
 
@@ -139,18 +141,28 @@ class EPGList(HTMLComponent, GUIComponent):
                        self.service_rect = Rect(width/20*7, 0, width/20*13, height)
 
        def getClockPixmap(self, refstr, beginTime, duration, eventId):
+               pre_clock = 1
+               post_clock = 2
+               clock_type = 0
                endTime = beginTime + duration
                for x in self.timer.timer_list:
                        if x.service_ref.ref.toString() == refstr:
-                               beg = x.begin
-                               end = x.end
                                if x.eit == eventId:
                                        return self.clock_pixmap
-                               elif beginTime > beg and beginTime < end and endTime > end:
-                                       return self.clock_post_pixmap
+                               beg = x.begin
+                               end = x.end
+                               if beginTime > beg and beginTime < end and endTime > end:
+                                       clock_type |= pre_clock
                                elif beginTime < beg and endTime > beg and endTime < end:
-                                       return self.clock_pre_pixmap
-               return self.clock_add_pixmap
+                                       clock_type |= post_clock
+               if clock_type == 0:
+                       return self.clock_add_pixmap
+               elif clock_type == pre_clock:
+                       return self.clock_pre_pixmap
+               elif clock_type == post_clock:
+                       return self.clock_post_pixmap
+               else:
+                       return self.clock_prepost_pixmap
 
        def buildSingleEntry(self, service, eventId, beginTime, duration, EventName):
                rec=beginTime and (self.timer.isInTimer(eventId, beginTime, duration, service))
index 441cb5d89b03f97839015514421124d201e2bb84..afae6b3a6dfeb4bd5d5de2b7a6bd1a3a297327d0 100644 (file)
@@ -155,11 +155,12 @@ class EPGList(HTMLComponent, GUIComponent):
        def selectionChanged(self):
                for x in self.onSelChanged:
                        if x is not None:
-                               try:
-                                       x()
-                               except: # FIXME!!!
-                                       print "FIXME in EPGList.selectionChanged"
-                                       pass
+                               x()
+#                              try:
+#                                      x()
+#                              except: # FIXME!!!
+#                                      print "FIXME in EPGList.selectionChanged"
+#                                      pass
 
        GUI_WIDGET = eListbox
 
@@ -291,13 +292,13 @@ class EPGList(HTMLComponent, GUIComponent):
                        self.time_base = int(stime)
                        test = [ (service.ref.toString(), 0, self.time_base, self.time_epoch) for service in services ]
                test.insert(0, 'XRnITBD')
-               print "BEFORE:"
-               for x in test:
-                       print x
+#              print "BEFORE:"
+#              for x in test:
+#                      print x
                epg_data = self.queryEPG(test)
-               print "EPG:"
-               for x in epg_data:
-                       print x
+#              print "EPG:"
+#              for x in epg_data:
+#                      print x
                self.list = [ ]
                tmp_list = None
                service = ""
@@ -535,7 +536,7 @@ class GraphMultiEPG(Screen):
                                else:
                                        self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
                else:
-                       print "Timeredit aborted"               
+                       print "Timeredit aborted"
        
        def finishSanityCorrection(self, answer):
                self.finishedAdd(answer)
index b40f445f1022a2c821786e176db4774f63d6e3ab..f6793269cc519493b67a7363946c8c2f0b6f822e 100644 (file)
@@ -285,7 +285,7 @@ class EPGSelection(Screen):
                        else:
                                self.applyButtonState(1)
                        days = [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]
-                       datastr = ""
+                       datestr = ""
                        event = cur[0]
                        if event is not None:
                                now = time()
@@ -306,14 +306,14 @@ class EPGSelection(Screen):
                serviceref = cur[1]
                eventid = event.getEventId()
                refstr = serviceref.ref.toString()
-
+               isRecordEvent = False
                for timer in self.session.nav.RecordTimer.timer_list:
-                       if self.key_green_choice != self.REMOVE_TIMER:
-                               if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
-                                       self["key_green"].setText(_("Remove timer"))
-                                       self.key_green_choice = self.REMOVE_TIMER
-                                       break
-               else:
-                       if self.key_green_choice != self.ADD_TIMER:
-                               self["key_green"].setText(_("Add timer"))
-                               self.key_green_choice = self.ADD_TIMER
+                       if timer.eit == eventid and timer.service_ref.ref.toString() == refstr:
+                               isRecordEvent = True
+                               break
+               if isRecordEvent and self.key_green_choice != self.REMOVE_TIMER:
+                       self["key_green"].setText(_("Remove timer"))
+                       self.key_green_choice = self.REMOVE_TIMER
+               elif not isRecordEvent and self.key_green_choice != self.ADD_TIMER:
+                       self["key_green"].setText(_("Add timer"))
+                       self.key_green_choice = self.ADD_TIMER