X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/7e6f15005ac50206ace23e1d3496e8c6550c14f5..0923ac50c8dc0d3f77363adb093b6e7e29f030ed:/skin.py diff --git a/skin.py b/skin.py index 3b448127..d40c593b 100644 --- a/skin.py +++ b/skin.py @@ -6,6 +6,7 @@ from enigma import eSize, ePoint, gFont, eWindow, eLabel, ePixmap, eWindowStyleM from Components.config import ConfigSubsection, ConfigText, config from Components.Converter.Converter import Converter +from Components.Sources.Source import Source from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS from Tools.Import import my_import @@ -13,6 +14,9 @@ from Tools.XMLTools import elementsWithTag, mergeText colorNames = dict() +def queryColor(colorName): + return colorNames.get(colorName) + def dump(x, i=0): print " " * i + str(x) try: @@ -286,9 +290,15 @@ def lookupScreen(name): return None, None def readSkin(screen, skin, name, desktop): - - myscreen, path = lookupScreen(name) - + if not isinstance(name, list): + name = [name] + + # try all skins, first existing one have priority + for n in name: + myscreen, path = lookupScreen(n) + if myscreen is not None: + break + # otherwise try embedded skin myscreen = myscreen or getattr(screen, "parsedSkin", None) @@ -296,7 +306,7 @@ def readSkin(screen, skin, name, desktop): if myscreen is None and getattr(screen, "skin", None): myscreen = screen.parsedSkin = xml.dom.minidom.parseString(screen.skin).childNodes[0] - assert myscreen is not None, "no skin for screen '" + name + "' found!" + assert myscreen is not None, "no skin for screen '" + repr(name) + "' found!" screen.skinAttributes = [ ] @@ -339,7 +349,13 @@ def readSkin(screen, skin, name, desktop): # get corresponding source source = screen.get(wsource) if source is None: - raise SkinError("source '" + wsource + "' was not found in screen '" + name + "'!") + if wsource == "fake": + if screen.get("fake"): + raise SkinError("screen '" + name + "has a element named 'fake' but its not a Source!!") + source = Source() + screen["fake"] = source + else: + raise SkinError("source '" + wsource + "' was not found in screen '" + name + "'!") wrender = widget.getAttribute('render')