cf1dac10ee4e0d355530b9eaa97b6b44a1ac7a58
[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                 self["title"].setText(self["menu"].getCurrent())
18
19                 self.tries += 1
20
21         def __init__(self):
22                 GUISkin.__init__(self)
23                 b = Button("ok")
24                 b.onClick = [ self.testDialogClick ]
25                 self["okbutton"] = b
26                 self["title"] = Header("Test Dialog - press ok to leave!")
27                 self["menu"] = MenuList()
28                 
29                 self.tries = 0
30
31 # a clock display dialog
32 class clockDisplay(Screen):
33         def okbutton(self):
34                 print "clockDisplay close"
35                 
36                 self.session.close()
37         
38         def __init__(self, clock):
39                 GUISkin.__init__(self)
40                 self["theClock"] = clock
41                 b = Button("bye")
42                 b.onClick = [ self.okbutton ]
43                 self["okbutton"] = b
44                 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
45
46 # defined screens
47 screens = {
48         "global": doGlobal,
49         "testDialog": testDialog,
50         "clockDisplay": clockDisplay }
51