- add rcconsole key input (for now)
[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                 
31                 self.tries = 0
32
33 # a clock display dialog
34 class clockDisplay(Screen):
35         def okbutton(self):
36                 print "clockDisplay close"
37                 
38                 self.session.close()
39         
40         def __init__(self, clock):
41                 GUISkin.__init__(self)
42                 self["theClock"] = clock
43                 b = Button("bye")
44                 b.onClick = [ self.okbutton ]
45                 self["okbutton"] = b
46                 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
47
48 # defined screens
49 screens = {
50         "global": doGlobal,
51         "testDialog": testDialog,
52         "clockDisplay": clockDisplay }
53