7 from skin import applyGUIskin
9 # A screen is a function which instanciates all components of a screen into a temporary component.
10 # Thus, the global stuff is a screen, too.
11 # In a screen, components can either be instanciated from the class-tree, cloned (copied) or
12 # "linked" from the instance tree.
13 # A screen itself lives as the container of the components, so a screen is a component, too.
15 # we thus have one (static) hierarchy of screens (classes, not instances)
16 # and one with the instanciated components itself (both global and dynamic)
18 def dump(dir, p = ""):
19 if isinstance(dir, dict):
20 for (entry, val) in dir.items():
21 dump(val, p + "/" + entry)
22 print p + ":" + str(dir.__class__)
28 screens["global"](components)
31 components["$001"] = screens["testDialog"]()
32 components["$002"] = screens["clockDisplay"](components["clock"])
37 print "*** instances:"
43 def create(self, screen): pass
47 class HTMLOutputDevice(OutputDevice):
48 def create(self, comp):
49 print comp.produceHTML()
51 html = HTMLOutputDevice()
53 class GUIOutputDevice(OutputDevice):
55 def create(self, comp):
56 comp.createGUIScreen(self.parent)
61 desktop = getDesktop()
62 print "desktop: " + str(desktop)
64 wnd = eWindow(desktop)
65 print "window " + str(wnd)
66 wnd.setTitle("python")
67 wnd.move(ePoint(300, 100))
68 wnd.resize(eSize(300, 300))
71 gui = GUIOutputDevice()
73 gui.create(components["$002"])
74 # for (x,y) in components["$001"].data.items():
75 # print str(x) + " -> " + str(y) + " (" + y["instance"].getText() + ")"
77 # print components["$001"].data["okbutton"]["instance"].doClick()
79 # diese sachen gehoeren in den skin! :)
80 applyGUIskin(components["$002"], None, "clockDialog")
82 # das ist dann schon die echte funktionalitaet ;)
83 components["clock"].doClock()
84 components["clock"].doClock()
88 print "--------------------------------------"
89 html.create(components["$001"])
90 print "--------------------------------------"
91 html.create(components["$002"])
92 print "--------------------------------------"
95 # direkter test der GUI aus python:
96 # label1 = eLabel(wnd)
97 # label1.setText("hello world!\nfrom python!")
98 # label1.move(ePoint(10, 10))
99 # label1.resize(eSize(80, 50))
101 # label2 = eLabel(wnd)
102 # label2.setText("the second\nlabel works\nas well!")
103 # label2.move(ePoint(90, 10))
104 # label2.resize(eSize(80, 50))
106 # button = eButton(wnd)
107 # button.setText("OK")
108 # button.move(ePoint(200, 10))
109 # button.resize(eSize(80, 50))
113 components["clock"].doClock()
118 # components["$002"]["okbutton"].setValue(r)
122 # print "delete label1"