- add listbox
[enigma2.git] / screens.py
1 from components import *
2 import sys
3
4 # some screens
5 def doGlobal(screen):
6         screen["clock"] = Clock()
7
8 class Screen(dict, HTMLSkin, GUISkin):
9         """ bla """
10         
11         def close(self):
12                 GUISkin.close(self)
13         
14 # a test dialog
15 class testDialog(Screen):
16         def testDialogClick(self):
17                 if self.tries == 0:
18                         self["title"].setText("Hihi - no, this doesn't work!")
19                 else:
20                         self["title"].setText("You tried it %d times without success now!" % self.tries )
21
22                 self.tries += 1
23
24         def __init__(self):
25                 GUISkin.__init__(self)
26                 b = Button("ok")
27                 b.onClick = [ self.testDialogClick ]
28                 self["okbutton"] = b
29                 self["title"] = Header("Test Dialog - press ok to leave!")
30                 self["menu"] = MenuList()
31                 
32                 self.tries = 0
33
34 # a clock display dialog
35 class clockDisplay(Screen):
36         def okbutton(self):
37                 print "clockDisplay close"
38                 
39                 self.session.close()
40         
41         def __init__(self, clock):
42                 GUISkin.__init__(self)
43                 self["theClock"] = clock
44                 b = Button("bye")
45                 b.onClick = [ self.okbutton ]
46                 self["okbutton"] = b
47                 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
48
49 # defined screens
50 screens = {
51         "global": doGlobal,
52         "testDialog": testDialog,
53         "clockDisplay": clockDisplay }
54