wnd.setTitle("python")
wnd.move(ePoint(300, 100))
wnd.resize(eSize(300, 300))
- wnd.show()
gui = GUIOutputDevice()
gui.parent = wnd
# button.move(ePoint(200, 10))
# button.resize(eSize(80, 50))
+ wnd.show()
+
for x in range(200):
time.sleep(0.1)
components["clock"].doClock()
r = 200 - x
else:
r = x
-# components["$002"]["okbutton"].setValue(r)
+ components["$002"]["okbutton"].setValue(r)
desktop.paint()
#
# print "delete wnd"
# del wnd
# print "bye"
+
return 0
from enigma import *
import xml.dom.minidom
+from xml.dom import EMPTY_NAMESPACE
def dump(x, i=0):
print " " * i + str(x)
None
dom = xml.dom.minidom.parseString(
- "<screen name=\"clockDialog\"> \
+ "<screen name=\"clockDialog\" position=\"300,100\" size=\"300,300\"> \
<widget name=\"okbutton\" position=\"10,10\" size=\"280,40\" /> \
<widget name=\"theClock\" position=\"10,60\" size=\"280,50\" /> \
<widget name=\"title\" position=\"10,120\" size=\"280,50\" /> \
</screen>")
-def applyGUIskin(screen, skin, name):
- dump(dom[screen])
- screen.data["okbutton"]["instance"].move(ePoint(10, 10))
- screen.data["okbutton"]["instance"].resize(eSize(280, 40))
+def parsePosition(str):
+ x, y = str.split(',')
+ return ePoint(int(x), int(y))
+
+def parseSize(str):
+ x, y = str.split(',')
+ return eSize(int(x), int(y))
- screen.data["theClock"]["instance"].move(ePoint(10, 60))
- screen.data["theClock"]["instance"].resize(eSize(280, 50))
+def applyAttributes(guiObject, node):
+ # walk all attributes
+ for p in range(node.attributes.length):
+ a = node.attributes.item(p)
+
+ # 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
- screen.data["title"]["instance"].move(ePoint(10, 120))
- screen.data["title"]["instance"].resize(eSize(280, 50))
+def applyGUIskin(screen, skin, name):
+
+ myscreen = None
+
+ # first, find the corresponding screen element
+ screens = dom.getElementsByTagName("screen")
+ for x in screens:
+ if x.getAttribute('name') == name:
+ myscreen = x
+
+ if myscreen == None:
+ print "no skin for screen " + name + " found!"
+ return;
+
+ # now walk all widgets
+ for widget in myscreen.getElementsByTagName("widget"):
+ name = widget.getAttribute('name')
+ if name == None:
+ print "widget has no name!"
+ continue
+
+ # get corresponding gui object
+ guiObject = screen.data[name]["instance"]
+ applyAttributes(guiObject, widget)