- added iStaticServiceInformation
[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 class mainMenu(Screen):
19         
20         def goEmu(self):
21                 self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!")
22         
23         def goTimeshift(self):
24                 self["title"].setText("JUST PRESS THE YELLOW BUTTON!")
25         
26         def goHDTV(self):
27                 self["title"].setText("HDTV GREEN FLASHES: ENABLED")
28         
29         def goClock(self):
30                 self.session.open(clockDisplay(Clock()))
31
32         def okbuttonClick(self):
33                 selection = self["menu"].getCurrent()
34                 selection[1]()
35
36         def __init__(self):
37                 GUISkin.__init__(self)
38                 b = Button("ok")
39
40                 b.onClick = [ self.okbuttonClick ]
41                 self["okbutton"] = b
42                 self["title"] = Header("Main Menu! - press ok to leave!")
43                 self["menu"] = MenuList(
44                         [
45                                 ("EMU SETUP", self.goEmu),
46                                 ("TIMESHIFT SETUP", self.goTimeshift),
47                                 ("HDTV PIP CONFIG", self.goHDTV),
48                                 ("wie spaet ists?!", self.goClock)
49                         ])
50
51 #class mainMenu(Screen):
52 #       def __init__(self):
53 #               GUISkin.__init__(self)
54 #               
55 #               self["title"] = Header("this is the\nMAIN MENU !!!");
56 #               self["okbutton"] = Button("ok")
57 #               self["okbutton"].onClick = [ self.close ]
58
59 class channelSelection(Screen):
60         def __init__(self):
61                 GUISkin.__init__(self)
62                 
63                 self["list"] = ServiceList()
64                 self["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:PREMIERE"))
65                 
66                 self["okbutton"] = Button("ok", [self.channelSelected, self.close])
67
68         def channelSelected(self):
69 #               print "channel selected!"
70                 pass
71
72 class infoBar(Screen):
73         def __init__(self):
74                 GUISkin.__init__(self)
75                 
76                 self["channelSwitcher"] = Button("switch Channel", [self.switchChannel])
77                 self["okbutton"] = Button("mainMenu", [self.mainMenu])
78         
79         def mainMenu(self):
80                 self.session.open(mainMenu())
81                 
82         def switchChannel(self):
83                 self.session.open(channelSelection())
84
85 # a clock display dialog
86 class clockDisplay(Screen):
87         def okbutton(self):
88                 self.session.close()
89         
90         def __init__(self, clock):
91                 GUISkin.__init__(self)
92                 self["theClock"] = clock
93                 b = Button("bye")
94                 b.onClick = [ self.okbutton ]
95                 self["okbutton"] = b
96                 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
97