+ 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()
+
+ 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 = getPNG(filename)
+
+ # adapt palette
+ desktop.makeCompatiblePixmap(png)
+ style.setPixmap(eWindowStyleSkinned.__dict__[bsName], eWindowStyleSkinned.__dict__[bpName], png)
+
+ for color in elementsWithTag(windowstyle.childNodes, "color"):
+ type = str(color.getAttribute("name"))
+ color = parseColor(color.getAttribute("color"))
+
+ try:
+ style.setColor(eWindowStyleSkinned.__dict__["col" + type], color)
+ except:
+ raise ("Unknown color %s" % (type))
+
+ x = eWindowStyleManagerPtr()
+ eWindowStyleManager.getInstance(x)
+ x.setStyle(style)
+
+def readSkin(screen, skin, name, desktop):