slightly better example of using the signals (eButton::selected -> Button::onClick...
[enigma2.git] / screens.py
1 from components import *
2
3 # some screens
4 def doGlobal(screen):
5         screen["clock"] = Clock()
6
7 class Screen(dict, HTMLSkin, GUISkin):
8         """ bla """
9         
10 # a test dialog
11 class testDialog(Screen):
12         def testDialogClick(self):
13                 print "test dialog clicked!"
14                 self["title"].setText("bla")
15
16         def __init__(self):
17                 HTMLSkin.__init__(self, ("title", "okbutton"))
18                 b = Button("ok")
19                 b.onClick = [ self.testDialogClick ]
20                 self["okbutton"] = b
21                 self["title"] = Header("Test Dialog - press ok to leave!")
22
23 # a clock display dialog
24 class clockDisplay(Screen):
25         def okbutton(self):
26                 print "clockDisplay close"
27         
28         def __init__(self, clock):
29                 HTMLSkin.__init__(self, ("title", "theClock", "okbutton"))
30                 self["theClock"] = clock
31                 b = Button("bye")
32                 b.onClick = [ self.okbutton ]
33                 self["okbutton"] = b
34                 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
35
36 # defined screens
37 screens = {
38         "global": doGlobal,
39         "testDialog": testDialog,
40         "clockDisplay": clockDisplay }
41