+ print "illegal flag %s!" % f
+ elif attrib == "backgroundColor":
+ guiObject.setBackgroundColor(parseColor(value))
+ elif attrib == "foregroundColor":
+ guiObject.setForegroundColor(parseColor(value))
+ elif attrib == "selectionDisabled":
+ guiObject.setSelectionEnable(0)
+ elif attrib == "transparent":
+ guiObject.setTransparent(int(value))
+ elif attrib == "borderColor":
+ guiObject.setBorderColor(parseColor(value))
+ elif attrib == "borderWidth":
+ guiObject.setBorderWidth(int(value))
+ elif attrib == "scrollbarMode":
+ guiObject.setScrollbarMode(
+ { "showOnDemand": guiObject.showOnDemand,
+ "showAlways": guiObject.showAlways,
+ "showNever": guiObject.showNever
+ }[value])
+ elif attrib != 'name':
+ print "unsupported attribute " + attrib + "=" + value
+ except int:
+# AttributeError:
+ print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib)
+
+def applyAllAttributes(guiObject, desktop, attributes):
+ for (attrib, value) in attributes:
+ applySingleAttribute(guiObject, desktop, attrib, value)
+
+def loadSkin(desktop):
+ print "loading skin..."
+
+ skin = dom.childNodes[0]
+ assert skin.tagName == "skin", "root element in skin must be 'skin'!"
+
+ for c in elementsWithTag(skin.childNodes, "colors"):
+ for color in elementsWithTag(c.childNodes, "color"):
+ name = str(color.getAttribute("name"))
+ color = str(color.getAttribute("value"))
+
+ if not len(color):
+ raise ("need color and name, got %s %s" % (name, color))
+
+ colorNames[name] = parseColor(color)
+
+ for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
+ style = eWindowStyleSkinned()
+
+ style.setTitleFont(gFont("Regular", 20));
+ style.setTitleOffset(eSize(20, 5));
+
+ for borderset in elementsWithTag(windowstyle.childNodes, "borderset"):
+ bsName = str(borderset.getAttribute("name"))
+ for pixmap in elementsWithTag(borderset.childNodes, "pixmap"):
+ bpName = str(pixmap.getAttribute("pos"))
+ filename = str(pixmap.getAttribute("filename"))
+
+ png = loadPNG(filename)
+
+ # adapt palette
+ desktop.makeCompatiblePixmap(png.__deref__())
+ style.setPixmap(eWindowStyleSkinned.__dict__[bsName], eWindowStyleSkinned.__dict__[bpName], png.__deref__())