-
- skin = dom_skin.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 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"):
+ assert skin.tag == "skin", "root element in skin must be 'skin'!"
+
+ #print "***SKIN: ", path_prefix
+
+ for c in skin.findall("output"):
+ id = c.attrib.get('id')
+ if id:
+ id = int(id)
+ else:
+ id = 0
+ if id == 0: # framebuffer
+ for res in c.findall("resolution"):
+ get_attr = res.attrib.get
+ xres = get_attr("xres")
+ if xres:
+ xres = int(xres)
+ else:
+ xres = 720
+ yres = get_attr("yres")
+ if yres:
+ yres = int(yres)
+ else:
+ yres = 576
+ bpp = get_attr("bpp")
+ if bpp:
+ bpp = int(bpp)
+ else:
+ bpp = 32
+ #print "Resolution:", xres,yres,bpp
+ from enigma import gFBDC
+ gFBDC.getInstance().setResolution(xres, yres)
+ desktop.resize(eSize(xres, yres))
+ if bpp != 32:
+ # load palette (not yet implemented)
+ pass
+
+ for c in skin.findall("colors"):
+ for color in c.findall("color"):
+ get_attr = color.attrib.get
+ name = get_attr("name")
+ color = get_attr("value")
+ if name and color:
+ colorNames[name] = parseColor(color)
+ #print "Color:", name, color
+ else:
+ raise SkinError("need color and name, got %s %s" % (name, color))
+
+ for c in skin.findall("fonts"):
+ for font in c.findall("font"):
+ get_attr = font.attrib.get
+ filename = get_attr("filename", "<NONAME>")
+ name = get_attr("name", "Regular")
+ scale = get_attr("scale")
+ if scale:
+ scale = int(scale)
+ else:
+ scale = 100
+ is_replacement = get_attr("replacement") and True or False
+ 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
+ skin_path = resolveFilename(SCOPE_CURRENT_SKIN, filename)
+ if fileExists(skin_path):
+ resolved_font = skin_path
+ addFont(resolved_font, name, scale, is_replacement)
+ #print "Font: ", resolved_font, name, scale, is_replacement
+
+ for c in skin.findall("subtitles"):
+ from enigma import eWidget, eSubtitleWidget
+ scale = ((1,1),(1,1))
+ for substyle in c.findall("sub"):
+ get_attr = substyle.attrib.get
+ font = parseFont(get_attr("font"), scale)
+ col = get_attr("foregroundColor")
+ if col:
+ foregroundColor = parseColor(col)
+ haveColor = 1
+ else:
+ foregroundColor = gRGB(0xFFFFFF)
+ haveColor = 0
+ col = get_attr("shadowColor")
+ if col:
+ shadowColor = parseColor(col)
+ else:
+ shadowColor = gRGB(0)
+ shadowOffset = parsePosition(get_attr("shadowOffset"), scale)
+ face = eSubtitleWidget.__dict__[get_attr("name")]
+ eSubtitleWidget.setFontStyle(face, font, haveColor, foregroundColor, shadowColor, shadowOffset)
+
+ for windowstyle in skin.findall("windowstyle"):