add ServiceNameForegroundColor and ServiceNameBackgroundColor skin
[enigma2.git] / lib / python / Plugins / Extensions / GraphMultiEPG / GraphMultiEpg.py
index 72b694503a16807deaa698b0734d6c72a7d21491..eb95b99ce22957656f5eaf240e93b1803b732992 100644 (file)
@@ -49,6 +49,8 @@ class EPGList(HTMLComponent, GUIComponent):
                self.borderColor = None
                self.backColor = 0x586d88
                self.backColorSelected = 0x808080
+               self.foreColorService = None
+               self.backColorService = None
 
        def applySkin(self, desktop):
                if self.skinAttributes is not None:
@@ -64,6 +66,10 @@ class EPGList(HTMLComponent, GUIComponent):
                                        self.backColor = parseColor(value).argb()
                                elif attrib == "EntryBackgroundColorSelected":
                                        self.backColorSelected = parseColor(value).argb()
+                               elif attrib == "ServiceNameForegroundColor":
+                                       self.foreColorService = parseColor(value).argb()
+                               elif attrib == "ServiceNameBackgroundColor":
+                                       self.backColorService = parseColor(value).argb()
                                else:
                                        attribs.append((attrib,value))
                        self.skinAttributes = attribs
@@ -114,10 +120,13 @@ class EPGList(HTMLComponent, GUIComponent):
                old_service = self.cur_service  #(service, service_name, events)
                cur_service = self.cur_service = self.l.getCurrentSelection()
                last_time = 0;
+               time_base = self.getTimeBase()
                if old_service and self.cur_event is not None:
                        events = old_service[2]
                        cur_event = events[self.cur_event] #(event_id, event_title, begin_time, duration)
                        last_time = cur_event[2]
+                       if last_time < time_base:
+                               last_time = time_base
                if cur_service:
                        self.cur_event = 0
                        events = cur_service[2]
@@ -127,7 +136,10 @@ class EPGList(HTMLComponent, GUIComponent):
                                        best = len(events) #set invalid
                                        idx = 0
                                        for event in events: #iterate all events
-                                               diff = abs(event[2]-last_time)
+                                               ev_time = event[2]
+                                               if ev_time < time_base:
+                                                       ev_time = time_base
+                                               diff = abs(ev_time-last_time)
                                                if (best == len(events)) or (diff < best_diff):
                                                        best = idx
                                                        best_diff = diff
@@ -186,7 +198,7 @@ class EPGList(HTMLComponent, GUIComponent):
        def buildEntry(self, service, service_name, events):
                r1=self.service_rect
                r2=self.event_rect
-               res = [ None, MultiContentEntryText(pos = (r1.left(),r1.top()), size = (r1.width(), r1.height()), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = service_name) ]
+               res = [ None, MultiContentEntryText(pos = (r1.left(),r1.top()), size = (r1.width(), r1.height()), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_CENTER, text = service_name, color = self.foreColorService, backcolor = self.backColorService) ]
 
                if events:
                        start = self.time_base+self.offs*self.time_epoch*60