add possibility to redefine multiepg colors in skin
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 21 Sep 2007 17:22:19 +0000 (17:22 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 21 Sep 2007 17:22:19 +0000 (17:22 +0000)
GraphEpg.Foreground, GraphEpg.Background, GrapgEpg.BackgroundSelected,
GraphEpg.Border

lib/gui/elistboxcontent.cpp
lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py
skin.py

index 0378aef..09b1cb5 100644 (file)
@@ -748,7 +748,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c
                        case TYPE_PIXMAP: // pixmap
                        {
                        /*
                        case TYPE_PIXMAP: // pixmap
                        {
                        /*
-                               (2, x, y, width, height, pixmap [, foreColor, backColor, backColorSelected] )
+                               (2, x, y, width, height, pixmap [, backColor, backColorSelected] )
                        */
 
                                ePyObject px = PyTuple_GET_ITEM(item, 1),
                        */
 
                                ePyObject px = PyTuple_GET_ITEM(item, 1),
index 2499251..0edc468 100644 (file)
@@ -1,3 +1,4 @@
+from skin import queryColor
 from Components.config import config, ConfigClock, ConfigInteger
 from Components.Pixmap import Pixmap
 from Components.Button import Button
 from Components.config import config, ConfigClock, ConfigInteger
 from Components.Pixmap import Pixmap
 from Components.Button import Button
@@ -42,6 +43,27 @@ class EPGList(HTMLComponent, GUIComponent):
                self.list = None
                self.event_rect = None
 
                self.list = None
                self.event_rect = None
 
+               #query skin colors
+               col = queryColor("GraphEpg.Foreground")
+               self.foreColor = col and col.argb()
+
+               col = queryColor("GraphEpg.Border")
+               self.borderColor = col and col.argb()
+
+               col = queryColor("GraphEpg.Background")
+               if col is None:
+                       self.backColor = 0x586d88
+               else:
+                       self.backColor = col.argb()
+
+               col = queryColor("GraphEpg.BackgroundSelected")
+               if col is None:
+                       self.backColorSelected = 0x808080
+               else:
+                       self.backColorSelected = col.argb()
+
+               print "foreColor", self.foreColor, "borderColor", self.borderColor, "backColor", self.backColor, "backColorSel", self.backColorSelected
+
        def isSelectable(self, service, sname, event_list):
                return (event_list and len(event_list) and True) or False
 
        def isSelectable(self, service, sname, event_list):
                return (event_list and len(event_list) and True) or False
 
@@ -161,19 +183,28 @@ class EPGList(HTMLComponent, GUIComponent):
                r2=self.event_rect
                res = [ None ] # no private data needed
                res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, service_name))
                r2=self.event_rect
                res = [ None ] # no private data needed
                res.append((eListboxPythonMultiContent.TYPE_TEXT, r1.left(), r1.top(), r1.width(), r1.height(), 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, service_name))
-               start = self.time_base+self.offs*self.time_epoch*60
-               end = start + self.time_epoch * 60
-               left = r2.left()
-               top = r2.top()
-               width = r2.width()
-               height = r2.height()
+
                if events:
                if events:
+                       start = self.time_base+self.offs*self.time_epoch*60
+                       end = start + self.time_epoch * 60
+                       left = r2.left()
+                       top = r2.top()
+                       width = r2.width()
+                       height = r2.height()
+                       foreColor = self.foreColor
+                       backColor = self.backColor
+                       backColorSelected = self.backColorSelected
+                       borderColor = self.borderColor
+
                        for ev in events:  #(event_id, event_title, begin_time, duration)
                                rec=self.timer.isInTimer(ev[0], ev[2], ev[3], service) > ((ev[3]/10)*8)
                                xpos, ewidth = self.calcEntryPosAndWidthHelper(ev[2], ev[3], start, end, width)
                        for ev in events:  #(event_id, event_title, begin_time, duration)
                                rec=self.timer.isInTimer(ev[0], ev[2], ev[3], service) > ((ev[3]/10)*8)
                                xpos, ewidth = self.calcEntryPosAndWidthHelper(ev[2], ev[3], start, end, width)
-                               res.append((eListboxPythonMultiContent.TYPE_TEXT, left+xpos, top, ewidth, height, 1, RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, ev[1], None, 0x586d88, 0x808080, 1))
+                               if self.borderColor is None:
+                                       res.append((eListboxPythonMultiContent.TYPE_TEXT, left+xpos, top, ewidth, height, 1, RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, ev[1], foreColor, backColor, backColorSelected, 1))
+                               else:
+                                       res.append((eListboxPythonMultiContent.TYPE_TEXT, left+xpos, top, ewidth, height, 1, RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, ev[1], foreColor, backColor, backColorSelected, 1, borderColor))
                                if rec and ewidth > 23:
                                if rec and ewidth > 23:
-                                       res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, left+xpos+ewidth-22, top+height-22, 21, 21, self.clock_pixmap, 0x586d88, 0x808080))
+                                       res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, left+xpos+ewidth-22, top+height-22, 21, 21, self.clock_pixmap, backColor, backColorSelected))
                return res
 
        def selEntry(self, dir, visible=True):
                return res
 
        def selEntry(self, dir, visible=True):
diff --git a/skin.py b/skin.py
index 13d56cf..0e0ec41 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -13,6 +13,9 @@ from Tools.XMLTools import elementsWithTag, mergeText
 
 colorNames = dict()
 
 
 colorNames = dict()
 
+def queryColor(colorName):
+       return colorNames.get(colorName)
+
 def dump(x, i=0):
        print " " * i + str(x)
        try:
 def dump(x, i=0):
        print " " * i + str(x)
        try: