X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/6b7b7977a92c9a092763bf699cba85347f9f2ec6..54bd4123728628a6f77bad2584b70d1353a91666:/skin.py?ds=sidebyside diff --git a/skin.py b/skin.py index 9fbdfeb4..936dcc96 100644 --- a/skin.py +++ b/skin.py @@ -13,7 +13,7 @@ def dump(x, i=0): dom = xml.dom.minidom.parseString( """ - + @@ -23,9 +23,17 @@ dom = xml.dom.minidom.parseString( - - + + + + + + + + + + """) @@ -45,15 +53,23 @@ def applyAttributes(guiObject, node): for p in range(node.attributes.length): a = node.attributes.item(p) + # convert to string (was: unicode) + attrib = str(a.name) + # TODO: proper UTF8 translation?! (for value) + # TODO: localization? as in e1? + value = str(a.value) + # and set attributes - if a.name == 'position': - guiObject.move(parsePosition(a.value)) - elif a.name == 'size': - guiObject.resize(parseSize(a.value)) - elif a.name != 'name': - print "unsupported attribute " + a.name + if attrib == 'position': + guiObject.move(parsePosition(value)) + elif attrib == 'size': + guiObject.resize(parseSize(value)) + elif attrib == 'title': + guiObject.setTitle(value) + elif attrib != 'name': + print "unsupported attribute " + attrib + "=" + value -def applyGUIskin(screen, skin, name): +def applyGUIskin(screen, parent, skin, name): myscreen = None @@ -67,6 +83,8 @@ def applyGUIskin(screen, skin, name): assert myscreen != None, "no skin for screen '" + name + "' found!" + applyAttributes(parent, myscreen) + # now walk all widgets for widget in myscreen.getElementsByTagName("widget"): wname = widget.getAttribute('name')