X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/7c8c5bc3e04718569b1b848d252d515b81545130..41558bc41a72c62a0c9fd4fbf28df23a2fc2fa44:/skin.py diff --git a/skin.py b/skin.py index da97b88a..f8fcb122 100644 --- a/skin.py +++ b/skin.py @@ -14,7 +14,7 @@ def dump(x, i=0): except: None -from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE +from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS dom_skins = [ ] @@ -131,6 +131,8 @@ def applySingleAttribute(guiObject, desktop, attrib, 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": @@ -153,6 +155,8 @@ def applySingleAttribute(guiObject, desktop, attrib, value): ptr = loadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, name)) desktop.makeCompatiblePixmap(ptr.__deref__()) guiObject.setPointer(ptr.__deref__(), pos) + elif attrib == 'shadowOffset': + guiObject.setShadowOffset(parsePosition(value)) elif attrib != 'name': print "unsupported attribute " + attrib + "=" + value except int: @@ -179,11 +183,27 @@ def loadSingleSkinData(desktop, dom_skin): colorNames[name] = parseColor(color) + for c in elementsWithTag(skin.childNodes, "fonts"): + for font in elementsWithTag(c.childNodes, "font"): + filename = str(font.getAttribute("filename") or "") + name = str(font.getAttribute("name") or "Regular") + scale = int(font.getAttribute("scale") or "100") + is_replacement = font.getAttribute("replacement") != "" + addFont(resolveFilename(SCOPE_FONTS, filename), name, scale, is_replacement) + 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"))