a04772db3620e9d9a1bee435dc5c66904c9f0c1f
[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         # never call this directly - it will be called from the session!
12         def doClose(self):
13                 GUISkin.close(self)
14         
15         def close(self, retval=None):
16                 self.session.close()
17         
18 # a test dialog
19 class testDialog(Screen):
20         def testDialogClick(self):
21                 selection = self["menu"].getCurrent()
22                 selection[1]()
23         
24         def goMain(self):
25 #               self.close(0)
26                 self["title"].setText("you selected the main menu!");
27                 
28         def goEmu(self):
29 #               self.close(1)
30                 self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!");
31         
32         def goTimeshift(self):
33 #               self.close(2)
34                 self["title"].setText("JUST PRESS THE YELLOW BUTTON!");
35         
36         def goHDTV(self):
37 #               self.close(3)
38                 self["title"].setText("HDTV GREEN FLASHES: ENABLED");
39
40         def __init__(self):
41                 GUISkin.__init__(self)
42                 b = Button("ok")
43                 b.onClick = [ self.testDialogClick ]
44                 self["okbutton"] = b
45                 self["title"] = Header("Test Dialog - press ok to leave!")
46                 self["menu"] = MenuList(
47                         [
48                                 ("MAIN MENU", self.goMain), 
49                                 ("EMU SETUP", self.goEmu),
50                                 ("TIMESHIFT SETUP", self.goTimeshift),
51                                 ("HDTV PIP CONFIG", self.goHDTV)
52                         ])
53
54
55 class MainMenu(Screen):
56         def __init__(self):
57                 GUISkin.__init__(self)
58                 
59                 self["ok"] = Button("ok")
60                 self["ok"].onClick = [ self.close ]
61
62         
63 # a clock display dialog
64 class clockDisplay(Screen):
65         def okbutton(self):
66                 print "clockDisplay close"
67                 
68                 self.session.close()
69         
70         def __init__(self, clock):
71                 GUISkin.__init__(self)
72                 self["theClock"] = clock
73                 b = Button("bye")
74                 b.onClick = [ self.okbutton ]
75                 self["okbutton"] = b
76                 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
77
78 # defined screens
79 screens = {
80         "global": doGlobal,
81         "testDialog": testDialog,
82         "clockDisplay": clockDisplay }
83