- fixed dvb scan
[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.session.open(screens["mainMenu"]())
26                 
27         def goEmu(self):
28                 self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!")
29         
30         def goTimeshift(self):
31                 self["title"].setText("JUST PRESS THE YELLOW BUTTON!")
32         
33         def goHDTV(self):
34                 self["title"].setText("HDTV GREEN FLASHES: ENABLED")
35         
36         def goClock(self):
37                 self.session.open(screens["clockDisplay"](Clock()))
38
39         def __init__(self):
40                 GUISkin.__init__(self)
41                 b = Button("ok")
42                 b.onClick = [ self.testDialogClick ]
43                 self["okbutton"] = b
44                 self["title"] = Header("Test Dialog - press ok to leave!")
45 #               self["menu"] = MenuList(
46 #                       [
47 #                               ("MAIN MENU", self.goMain), 
48 #                               ("EMU SETUP", self.goEmu),
49 #                               ("TIMESHIFT SETUP", self.goTimeshift),
50 #                               ("HDTV PIP CONFIG", self.goHDTV),
51 #                               ("wie spaet ists?!", self.goClock)
52 #                       ])
53                 self["menu"] = ServiceList()
54                 
55                 self["menu"].setRoot(eServiceReference("2:0:1:0:0:0:0:0:0:0:/"))
56
57 class mainMenu(Screen):
58         def __init__(self):
59                 GUISkin.__init__(self)
60                 
61                 self["title"] = Header("this is the\nMAIN MENU !!!");
62                 self["okbutton"] = Button("ok")
63                 self["okbutton"].onClick = [ self.close ]
64
65         
66 # a clock display dialog
67 class clockDisplay(Screen):
68         def okbutton(self):
69                 self.session.close()
70         
71         def __init__(self, clock):
72                 GUISkin.__init__(self)
73                 self["theClock"] = clock
74                 b = Button("bye")
75                 b.onClick = [ self.okbutton ]
76                 self["okbutton"] = b
77                 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
78
79 # defined screens (evtl. kann man sich das sparen, ich seh den sinn gerade nicht mehr)
80 screens = {
81         "global": doGlobal,
82         "testDialog": testDialog,
83         "clockDisplay": clockDisplay ,
84         "mainMenu": mainMenu }
85