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