- print "valign must be either top, center or bottom!"
- elif attrib == "halign":
- try:
- guiObject.setHAlign(
- { "left": guiObject.alignLeft,
- "center": guiObject.alignCenter,
- "right": guiObject.alignRight,
- "block": guiObject.alignBlock
- }[value])
- except KeyError:
- print "halign must be either left, center, right or block!"
- elif attrib == "flags":
- flags = value.split(',')
- for f in flags:
- try:
- fv = eWindow.__dict__[f]
- guiObject.setFlag(fv)
- except KeyError:
- print "illegal flag %s!" % f
- elif attrib == "backgroundColor":
- guiObject.setBackgroundColor(parseColor(value))
- elif attrib != 'name':
- print "unsupported attribute " + attrib + "=" + value
- except AttributeError:
- print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib)
-
-def loadSkin():
- print "loading skin..."
-
- def getPNG(x):
- g = gPixmapPtr()
- loadPNG(g, x)
- g = g.grabRef()
- return g
-
- skin = dom.childNodes[0]
- assert skin.tagName == "skin", "root element in skin must be 'skin'!"
-
- for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
+ print "illegal flag %s!" % f
+ elif attrib == "backgroundColor":
+ guiObject.setBackgroundColor(parseColor(value))
+ elif attrib == "backgroundColorSelected":
+ guiObject.setBackgroundColorSelected(parseColor(value))
+ elif attrib == "foregroundColor":
+ guiObject.setForegroundColor(parseColor(value))
+ elif attrib == "foregroundColorSelected":
+ guiObject.setForegroundColorSelected(parseColor(value))
+ elif attrib == "shadowColor":
+ guiObject.setShadowColor(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 == "enableWrapAround":
+ guiObject.setWrapAround(True)
+ elif attrib == "pointer" or attrib == "seek_pointer":
+ (name, pos) = value.split(':')
+ pos = parsePosition(pos)
+ ptr = loadPixmap(name, desktop)
+ guiObject.setPointer({"pointer": 0, "seek_pointer": 1}[attrib], ptr, pos)
+ elif attrib == 'shadowOffset':
+ guiObject.setShadowOffset(parsePosition(value))
+ elif attrib == 'noWrap':
+ guiObject.setNoWrap(1)
+ else:
+ raise SkinError("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 loadSingleSkinData(desktop, dom_skin, path_prefix):
+ """loads skin data like colors, windowstyle etc."""
+ skin = dom_skin.getroot()
+ assert skin.tag == "skin", "root element in skin must be 'skin'!"
+
+ #print "***SKIN: ", path_prefix
+
+ for c in skin.getiterator("output"):
+ id = int(c.get('id') or "0")
+ if id == 0: # framebuffer
+ for res in c.getiterator("resolution"):
+ xres = int(res.get("xres" or "720"))
+ yres = int(res.get("yres" or "576"))
+ bpp = int(res.get("bpp" or "32"))
+
+ #print "Resolution:", xres,yres,bpp
+
+ from enigma import gFBDC
+ i = gFBDC.getInstance()
+ i.setResolution(xres, yres)
+
+ if bpp != 32:
+ # load palette (not yet implemented)
+ pass
+
+ for c in skin.getiterator("colors"):
+ for color in c.getiterator("color"):
+ name = str(color.get("name"))
+ color = str(color.get("value"))
+
+ if not len(color):
+ raise ("need color and name, got %s %s" % (name, color))
+
+ colorNames[name] = parseColor(color)
+ #print "Color:", name, color
+
+ for c in skin.getiterator("fonts"):
+ for font in c.getiterator("font"):
+ filename = str(font.attrib.get("filename", "<NONAME>"))
+ name = str(font.get("name", "Regular"))
+ scale = int(font.get("scale", "100"))
+ is_replacement = font.get("replacement") != ""
+ resolved_font = resolveFilename(SCOPE_FONTS, filename, path_prefix=path_prefix)
+ if not fileExists(resolved_font): #when font is not available look at current skin path
+ pos = config.skin.primary_skin.value.rfind('/')
+ if pos != -1:
+ skin_path = resolveFilename(SCOPE_SKIN, config.skin.primary_skin.value[:pos+1]+filename, path_prefix=path_prefix)
+ if fileExists(skin_path):
+ resolved_font = skin_path
+ addFont(resolved_font, name, scale, is_replacement)
+ #print "Font: ", resolved_font, name, scale, is_replacement
+
+ for windowstyle in skin.getiterator("windowstyle"):