- redraw now in idle
[vuplus_dvbapp] / mytest.py
1 from enigma import *
2
3 import sys
4 import time
5
6 from screens import *
7 from skin import applyGUIskin
8
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.
14
15 # we thus have one (static) hierarchy of screens (classes, not instances)
16 # and one with the instanciated components itself (both global and dynamic)
17
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__)
23
24 # defined components
25 components = {}
26
27 # do global
28 screens["global"](components)
29
30 # test our screens
31 components["$001"] = screens["testDialog"]()
32 components["$002"] = screens["clockDisplay"](components["clock"])
33
34 print "*** classes:"
35 dump(screens)
36
37 print "*** instances:"
38 dump(components)
39
40 # display
41
42 class OutputDevice:
43         def create(self, screen): pass
44
45 # display: HTML
46
47 class HTMLOutputDevice(OutputDevice):
48         def create(self, comp):
49                 print comp.produceHTML()
50
51 html = HTMLOutputDevice()
52
53 class GUIOutputDevice(OutputDevice):
54         parent = None
55         def create(self, comp):
56                 comp.createGUIScreen(self.parent)
57
58 def runScreenTest():
59         desktop = getDesktop()
60
61         wnd = eWindow(desktop)
62         mainwnd = wnd
63         wnd.setTitle("Screen from python!")
64         wnd.move(ePoint(300, 100))
65         wnd.resize(eSize(300, 300))
66
67         gui = GUIOutputDevice()
68         gui.parent = wnd
69         gui.create(components["$002"])
70
71         applyGUIskin(components["$002"], None, "clockDialog")
72
73         wnd.show()
74         
75 #       components["$002"].data["okbutton"]["instance"].push()
76         runMainloop()
77         
78         return 0
79
80
81 # first, setup a screen
82 runScreenTest()
83
84 # now, run the mainloop