1 from components import *
3 from enigma import quitMainloop
7 screen["clock"] = Clock()
9 class Screen(dict, HTMLSkin, GUISkin):
12 def __init__(self, session):
13 self.skinName = self.__class__.__name__
14 self.session = session
15 GUISkin.__init__(self)
18 for (name, val) in self.items():
22 for (name, val) in self.items():
25 # never call this directly - it will be called from the session!
29 for (name, val) in self.items():
30 print "%s -> %d" % (name, sys.getrefcount(val))
33 def close(self, retval=None):
36 class mainMenu(Screen):
39 self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!")
41 def goTimeshift(self):
42 self["title"].setText("JUST PRESS THE YELLOW BUTTON!")
45 self["title"].setText("HDTV GREEN FLASHES: ENABLED")
48 self.session.open(serviceScan)
51 self.session.open(clockDisplay, Clock())
53 def okbuttonClick(self):
54 selection = self["menu"].getCurrent()
57 def __init__(self, session):
58 Screen.__init__(self, session)
61 self["actions"] = ActionMap("MainMenuActions",
63 "selected": self.okbuttonClick
66 b.onClick = [ self.okbuttonClick ]
68 self["title"] = Header("Main Menu! - press ok to leave!")
69 self["menu"] = MenuList(
71 ("Close Main Menu", self.close),
72 ("Service Scan", self.goScan),
73 ("Quit", quitMainloop),
74 ("EMU SETUP", self.goEmu),
75 ("TIMESHIFT SETUP", self.goTimeshift),
76 ("HDTV PIP CONFIG", self.goHDTV),
77 ("wie spaet ists?!", self.goClock)
80 #class mainMenu(Screen):
82 # GUISkin.__init__(self)
84 # self["title"] = Header("this is the\nMAIN MENU !!!");
85 # self["okbutton"] = Button("ok")
86 # self["okbutton"].onClick = [ self.close ]
88 class channelSelection(Screen):
89 def __init__(self, session):
90 Screen.__init__(self, session)
92 self["list"] = ServiceList()
93 self["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:PREMIERE"))
95 self["okbutton"] = Button("ok", [self.channelSelected])
97 class ChannelActionMap(ActionMap):
98 def action(self, context, action):
99 if action[:7] == "bouquet":
100 print "setting root to " + action[8:]
101 self.csel["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
103 ActionMap.action(self, context, action)
105 self["actions"] = ChannelActionMap("ChannelSelectActions",
107 "selectChannel": self.channelSelected,
109 self["actions"].csel = self
111 def channelSelected(self):
112 self.session.nav.playService(self["list"].getCurrent())
116 class infoBar(Screen):
117 def __init__(self, session):
118 Screen.__init__(self, session)
120 self["actions"] = ActionMap("InfobarActions",
122 "switchChannel": self.switchChannel,
123 "mainMenu": self.mainMenu
125 self["okbutton"] = Button("mainMenu", [self.mainMenu])
127 self["CurrentTime"] = Clock()
129 self["ServiceName"] = ServiceName(self.session.nav)
131 self["Event_Now"] = EventInfo(self.session.nav, EventInfo.Now)
132 self["Event_Next"] = EventInfo(self.session.nav, EventInfo.Next)
134 self["Event_Now_Duration"] = EventInfo(self.session.nav, EventInfo.Now_Duration)
135 self["Event_Next_Duration"] = EventInfo(self.session.nav, EventInfo.Next_Duration)
138 self.session.open(mainMenu)
140 def switchChannel(self):
141 self.session.open(channelSelection)
143 # a clock display dialog
144 class clockDisplay(Screen):
148 def __init__(self, session, clock):
149 Screen.__init__(self, session)
150 self["theClock"] = clock
152 b.onClick = [ self.okbutton ]
154 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
156 class serviceScan(Screen):
158 if self["scan"].isDone():
161 def __init__(self, session):
162 Screen.__init__(self, session)
164 self["scan_progress"] = ProgressBar()
165 self["scan_state"] = Label("scan state")
166 self["scan"] = ServiceScan(self["scan_progress"], self["scan_state"])
168 self["okbutton"] = Button("ok", [self.ok])
169 self["okbutton"].disable()