X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=skin.py;h=9d4b757168273b00f86dd51fec793661ab09c370;hp=5706507618e2f2d056f8695a0392af1875dcdf99;hb=1b2f75903244b6c03e1f123533d4385c0c271c78;hpb=98c4b5bb004e9297bffa8e1c3572572741fda933 diff --git a/skin.py b/skin.py index 5706507..9d4b757 100644 --- a/skin.py +++ b/skin.py @@ -14,130 +14,16 @@ def dump(x, i=0): except: None -dom = xml.dom.minidom.parseString( - """ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - """ """ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# this should be factored out into some helper code, but currently demonstrated applets. -from enigma import eSize, ePoint - -orgwidth = self.instance.size().width() -orgpos = self.instance.position() -textsize = self["text"].getSize() - -# y size still must be fixed in font stuff... -textsize = (textsize[0], textsize[1] + 20) -wsize = (textsize[0] + 20, textsize[1] + 20) - -# resize -self.instance.resize(eSize(*wsize)) - -# resize label -self["text"].instance.resize(eSize(*textsize)) +# read the skin +try: + # first we search in the current path + skinfile = file('data/skin.xml', 'r') +except: + # if not found in the current path, we use the global datadir-path + skinfile = file('/usr/share/enigma2/skin.xml', 'r') +dom = xml.dom.minidom.parseString(skinfile.read()) +skinfile.close() -# center window -newwidth = wsize[0] -self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - - - """) def parsePosition(str): x, y = str.split(',') @@ -170,7 +56,7 @@ def collectAttributes(skinAttributes, node): # TODO: localization? as in e1? value = str(a.value) - skinAttributes[attrib] = value + skinAttributes.append((attrib, value)) def applySingleAttribute(guiObject, desktop, attrib, value): # and set attributes @@ -232,7 +118,7 @@ def applySingleAttribute(guiObject, desktop, attrib, value): print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib) def applyAllAttributes(guiObject, desktop, attributes): - for (attrib, value) in attributes.items(): + for (attrib, value) in attributes: applySingleAttribute(guiObject, desktop, attrib, value) def loadSkin(desktop): @@ -298,7 +184,7 @@ def readSkin(screen, skin, name, desktop): assert myscreen != None, "no skin for screen '" + name + "' found!" - screen.skinAttributes = { } + screen.skinAttributes = [ ] collectAttributes(screen.skinAttributes, myscreen) screen.additionalWidgets = [ ] @@ -312,7 +198,7 @@ def readSkin(screen, skin, name, desktop): # get corresponding gui object try: - attributes = screen[wname].skinAttributes = { } + attributes = screen[wname].skinAttributes = [ ] except: raise str("component with name '" + wname + "' was not found in skin of screen '" + name + "'!") @@ -345,7 +231,7 @@ def readSkin(screen, skin, name, desktop): else: raise str("unsupported stuff : %s" % widget.tagName) - w.skinAttributes = { } + w.skinAttributes = [ ] collectAttributes(w.skinAttributes, widget) # applyAttributes(guiObject, widget, desktop)