allow changing titlebar offset / font by skin
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 3 May 2006 18:59:52 +0000 (18:59 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 3 May 2006 18:59:52 +0000 (18:59 +0000)
data/skin.xml
skin.py

index 80e38d6..995c51a 100644 (file)
@@ -13,6 +13,7 @@
                <color name="transpBlack" value="#80000000" />
        </colors>
        <windowstyle type="skinned">
                <color name="transpBlack" value="#80000000" />
        </colors>
        <windowstyle type="skinned">
+               <title offset="20,5" font="Regular;20" />
                <color name="Background" color="#33294a6b" />
                <color name="LabelForeground" color="#ffffff" />
                <color name="ListboxBackground" color="#33294a6b" />
                <color name="Background" color="#33294a6b" />
                <color name="LabelForeground" color="#ffffff" />
                <color name="ListboxBackground" color="#33294a6b" />
diff --git a/skin.py b/skin.py
index da97b88..c16d998 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -84,7 +84,7 @@ def applySingleAttribute(guiObject, desktop, attrib, value):
                elif attrib == "pixmap":
                        ptr = loadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, value))
                        # that __deref__ still scares me!
                elif attrib == "pixmap":
                        ptr = loadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, value))
                        # that __deref__ still scares me!
-                       desktop.makeCompatiblePixmap(ptr.__deref__())
+#                      desktop.makeCompatiblePixmap(ptr.__deref__())
                        guiObject.setPixmap(ptr.__deref__())
                        # guiObject.setPixmapFromFile(value)
                elif attrib == "alphatest": # used by ePixmap
                        guiObject.setPixmap(ptr.__deref__())
                        # guiObject.setPixmapFromFile(value)
                elif attrib == "alphatest": # used by ePixmap
@@ -131,6 +131,8 @@ def applySingleAttribute(guiObject, desktop, attrib, value):
                        guiObject.setBackgroundColor(parseColor(value))
                elif attrib == "foregroundColor":
                        guiObject.setForegroundColor(parseColor(value))
                        guiObject.setBackgroundColor(parseColor(value))
                elif attrib == "foregroundColor":
                        guiObject.setForegroundColor(parseColor(value))
+               elif attrib == "shadowColor":
+                       guiObject.setShadowColor(parseColor(value))
                elif attrib == "selectionDisabled":
                        guiObject.setSelectionEnable(0)
                elif attrib == "transparent":
                elif attrib == "selectionDisabled":
                        guiObject.setSelectionEnable(0)
                elif attrib == "transparent":
@@ -155,6 +157,8 @@ def applySingleAttribute(guiObject, desktop, attrib, value):
                        guiObject.setPointer(ptr.__deref__(), pos)
                elif attrib != 'name':
                        print "unsupported attribute " + attrib + "=" + value
                        guiObject.setPointer(ptr.__deref__(), pos)
                elif attrib != 'name':
                        print "unsupported attribute " + attrib + "=" + value
+               elif attrib == 'shadowOffset':
+                       guiObject.setShadowOffset(parsePosition(value))
        except int:
 # AttributeError:
                print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib)
        except int:
 # AttributeError:
                print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib)
@@ -182,8 +186,16 @@ def loadSingleSkinData(desktop, dom_skin):
        for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
                style = eWindowStyleSkinned()
                
        for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
                style = eWindowStyleSkinned()
                
-               style.setTitleFont(gFont("Regular", 20));
-               style.setTitleOffset(eSize(20, 5));
+               # defaults
+               font = gFont("Regular", 20)
+               offset = eSize(20, 5)
+               
+               for title in elementsWithTag(windowstyle.childNodes, "title"):
+                       offset = parseSize(title.getAttribute("offset"))
+                       font = parseFont(str(title.getAttribute("font")))
+
+               style.setTitleFont(font);
+               style.setTitleOffset(offset)
                
                for borderset in elementsWithTag(windowstyle.childNodes, "borderset"):
                        bsName = str(borderset.getAttribute("name"))
                
                for borderset in elementsWithTag(windowstyle.childNodes, "borderset"):
                        bsName = str(borderset.getAttribute("name"))