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"]()
36 print "*** instances:"
42 def create(self, screen): pass
46 class HTMLOutputDevice(OutputDevice):
47 def create(self, comp):
48 print comp.produceHTML()
50 html = HTMLOutputDevice()
52 class GUIOutputDevice(OutputDevice):
54 def create(self, comp):
55 comp.createGUIScreen(self.parent)
60 self.delayTimer = eTimer()
61 self.delayTimer.timeout.get().append(self.processDelay)
63 def processDelay(self):
64 components[self.screenname].close()
65 if self.currentWindow != None:
66 self.currentWindow.hide()
68 del components[self.screenname]
69 del self.currentWindow
72 def open(self, screenname, screen):
73 components[screenname] = screen
74 self.screenname = screenname
77 if self.desktop != None:
78 self.currentWindow = wnd = eWindow(self.desktop)
79 wnd.setTitle("Screen from python!")
80 wnd.move(ePoint(300, 100))
81 wnd.resize(eSize(300, 300))
83 gui = GUIOutputDevice()
85 gui.create(components["$002"])
87 applyGUIskin(components["$002"], None, "clockDialog")
91 self.currentWindow = None
94 self.delayTimer.start(0, 1)
98 session.desktop = getDesktop()
100 # components["$002"] = screens["clockDisplay"](components["clock"])
102 session.open("$002", screens["clockDisplay"](components["clock"]))
106 # x = components["$002"]
107 components["$002"].data["okbutton"]["instance"].push()
109 # print "session, close screen " + str(sys.getrefcount(x))
113 tmr.timeout.get().append(blub)
121 # first, setup a screen
124 # now, run the mainloop