update python
[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                 print "test dialog clicked!"
18                 if self.tries == 0:
19                         self["title"].setText("Hihi - no, this doesn't work!")
20                 else:
21                         self["title"].setText("You tried it %d times without success now!" % self.tries )
22
23                 self.tries += 1
24
25         def __init__(self):
26                 GUISkin.__init__(self)
27                 b = Button("ok")
28                 b.onClick = [ self.testDialogClick ]
29                 self["okbutton"] = b
30                 self["title"] = Header("Test Dialog - press ok to leave!")
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