+ 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 c in elementsWithTag(skin.childNodes, "fonts"):
+ for font in elementsWithTag(c.childNodes, "font"):
+ filename = str(font.getAttribute("filename") or "<NONAME>")
+ name = str(font.getAttribute("name") or "Regular")
+ scale = int(font.getAttribute("scale") or "100")
+ is_replacement = font.getAttribute("replacement") != ""
+ addFont(resolveFilename(SCOPE_FONTS, filename, path_prefix=path_prefix), name, scale, is_replacement)
+
+ for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
+ style = eWindowStyleSkinned()
+ id = int(windowstyle.getAttribute("id") or "0")
+
+ # 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 pixmap in elementsWithTag(borderset.childNodes, "pixmap"):
+ bpName = str(pixmap.getAttribute("pos"))
+ filename = str(pixmap.getAttribute("filename"))
+
+ png = loadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, filename, path_prefix=path_prefix))
+
+ # 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 = eWindowStyleManager.getInstance()
+ x.setStyle(id, style)
+
+def loadSkinData(desktop):
+ skins = dom_skins[:]
+ skins.reverse()
+ for (path, dom_skin) in skins:
+ loadSingleSkinData(desktop, dom_skin, path)
+
+def lookupScreen(name):
+ for (path, dom_skin) in dom_skins:
+ # first, find the corresponding screen element
+ skin = dom_skin.childNodes[0]
+ for x in elementsWithTag(skin.childNodes, "screen"):
+ if x.getAttribute('name') == name:
+ return x, path
+ return None, None
+
+def readSkin(screen, skin, name, desktop):
+
+ myscreen, path = lookupScreen(name)
+
+ # otherwise try embedded skin
+ myscreen = myscreen or getattr(screen, "parsedSkin", None)