Adapted ChoiceList to fully skineable
authorims <ims21@users.sourceforge.net>
Fri, 16 Jan 2015 13:04:48 +0000 (14:04 +0100)
committerlittlesat <littlesat99@yahoo.com>
Fri, 16 Jan 2015 14:17:12 +0000 (15:17 +0100)
Signed-off-by: littlesat <littlesat99@yahoo.com>

lib/python/Components/ChoiceList.py

index 95c4860..61376e5 100644 (file)
@@ -4,17 +4,14 @@ from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont
 from Tools.LoadPixmap import LoadPixmap
 import skin
 
-def row_delta_y():
-       font = skin.fonts["ChoiceList"]
-       return (int(font[2]) - int(font[1]))/2
-
 def ChoiceEntryComponent(key = None, text = ["--"]):
-       y = row_delta_y()
        res = [ text ]
        if text[0] == "--":
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, y, 800, 25, 0, RT_HALIGN_LEFT, "-"*200))
+               x, y, w, h = skin.parameters.get("ChoicelistDash",(0, 4, 800, 25))
+               res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, "-"*200))
        else:
-               res.append((eListboxPythonMultiContent.TYPE_TEXT, 45, y, 800, 25, 0, RT_HALIGN_LEFT, text[0]))
+               x, y, w, h = skin.parameters.get("ChoicelistName",(45, 4, 800, 25))
+               res.append((eListboxPythonMultiContent.TYPE_TEXT, x, y, w, h, 0, RT_HALIGN_LEFT, text[0]))
                if key:
                        if key == "expandable":
                                png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/expandable.png"))
@@ -27,13 +24,14 @@ def ChoiceEntryComponent(key = None, text = ["--"]):
                        else:
                                png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/key_%s.png" % key))
                        if png:
-                               res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, y, 35, 25, png))
+                               x, y, w, h = skin.parameters.get("ChoicelistIcon",(5, 4, 35, 25))
+                               res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, x, y, w, h, png))
        return res
 
 class ChoiceList(MenuList):
        def __init__(self, list, selection = 0, enableWrapAround=False):
                MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
-               font = skin.fonts["ChoiceList"]
+               font = skin.fonts.get("ChoiceList", ("Regular", 20, 30))
                self.l.setFont(0, gFont(font[0], font[1]))
                self.l.setItemHeight(font[2])
                self.selection = selection