3 from xml.dom import EMPTY_NAMESPACE
13 dom = xml.dom.minidom.parseString(
14 "<screen name=\"clockDialog\" position=\"300,100\" size=\"300,300\"> \
15 <widget name=\"okbutton\" position=\"10,10\" size=\"280,40\" /> \
16 <widget name=\"theClock\" position=\"10,60\" size=\"280,50\" /> \
17 <widget name=\"title\" position=\"10,120\" size=\"280,50\" /> \
20 def parsePosition(str):
22 return ePoint(int(x), int(y))
26 return eSize(int(x), int(y))
28 def applyAttributes(guiObject, node):
30 for p in range(node.attributes.length):
31 a = node.attributes.item(p)
34 if a.name == 'position':
35 guiObject.move(parsePosition(a.value))
36 elif a.name == 'size':
37 guiObject.resize(parseSize(a.value))
38 elif a.name != 'name':
39 print "unsupported attribute " + a.name
41 def applyGUIskin(screen, skin, name):
45 # first, find the corresponding screen element
46 screens = dom.getElementsByTagName("screen")
48 if x.getAttribute('name') == name:
52 print "no skin for screen " + name + " found!"
55 # now walk all widgets
56 for widget in myscreen.getElementsByTagName("widget"):
57 name = widget.getAttribute('name')
59 print "widget has no name!"
62 # get corresponding gui object
63 guiObject = screen.data[name]["instance"]
64 applyAttributes(guiObject, widget)