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 # assert self.session == None, "a screen can only exec one per time"
19 # self.session = session
20 for (name, val) in self.items():
24 for (name, val) in self.items():
26 # assert self.session != None, "execEnd on non-execing screen!"
29 # never call this directly - it will be called from the session!
34 for (name, val) in self.items():
35 print "%s -> %d" % (name, sys.getrefcount(val))
38 def close(self, retval=None):
41 class configTest(Screen):
43 def __init__(self, session):
44 Screen.__init__(self, session)
47 self["config"] = ConfigList(
49 configEntry("HKEY_LOCAL_ENIGMA/IMPORTANT/USER_ANNOYING_STUFF/SDTV/FLASHES/GREEN"),
50 configEntry("HKEY_LOCAL_ENIGMA/IMPORTANT/USER_ANNOYING_STUFF/HDTV/FLASHES/GREEN"),
53 self["actions"] = ActionMap(["OkCancelActions"],
55 "ok": self["config"].toggle,
60 class mainMenu(Screen):
63 self.session.open(configTest)
65 def goTimeshift(self):
66 self["title"].setText("JUST PRESS THE YELLOW BUTTON!")
69 self["title"].setText("HDTV GREEN FLASHES: ENABLED")
72 self.session.open(serviceScan)
75 self.session.open(clockDisplay, Clock())
77 def okbuttonClick(self):
78 selection = self["menu"].getCurrent()
81 def __init__(self, session):
82 Screen.__init__(self, session)
85 self["actions"] = ActionMap(["OkCancelActions"],
87 "ok": self.okbuttonClick,
91 b.onClick = [ self.okbuttonClick ]
93 self["title"] = Header("Main Menu! - press ok to leave!")
94 self["menu"] = MenuList(
96 ("Close Main Menu", self.close),
97 ("Service Scan", self.goScan),
98 ("Quit", quitMainloop),
99 ("setup", self.goSetup),
100 ("TIMESHIFT SETUP", self.goTimeshift),
101 ("HDTV PIP CONFIG", self.goHDTV),
102 ("wie spaet ists?!", self.goClock)
105 class channelSelection(Screen):
106 def __init__(self, session):
107 Screen.__init__(self, session)
109 self["list"] = ServiceList()
110 self["list"].setRoot(eServiceReference("""1:0:1:0:0:0:0:0:0:0:(provider=="ARD") && (type == 1)"""))
112 self["okbutton"] = Button("ok", [self.channelSelected])
114 class ChannelActionMap(ActionMap):
115 def action(self, contexts, action):
116 if action[:7] == "bouquet":
117 print "setting root to " + action[8:]
118 self.csel["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
120 ActionMap.action(self, contexts, action)
122 self["actions"] = ChannelActionMap(["ChannelSelectActions", "OkCancelActions"],
124 "cancel": self.close,
125 "ok": self.channelSelected,
128 self["actions"].csel = self
131 ref = self["list"].getCurrent()
132 if self["list"].isMarked(ref):
133 self["list"].removeMarked(ref)
135 self["list"].addMarked(ref)
137 def channelSelected(self):
138 self.session.nav.playService(self["list"].getCurrent())
142 class infoBar(Screen):
143 def __init__(self, session):
144 Screen.__init__(self, session)
146 self["actions"] = ActionMap( [ "InfobarActions" ],
148 "switchChannel": self.switchChannel,
149 "mainMenu": self.mainMenu
151 self["okbutton"] = Button("mainMenu", [self.mainMenu])
153 self["CurrentTime"] = Clock()
155 self["ServiceName"] = ServiceName(self.session.nav)
157 self["Event_Now"] = EventInfo(self.session.nav, EventInfo.Now)
158 self["Event_Next"] = EventInfo(self.session.nav, EventInfo.Next)
160 self["Event_Now_Duration"] = EventInfo(self.session.nav, EventInfo.Now_Duration)
161 self["Event_Next_Duration"] = EventInfo(self.session.nav, EventInfo.Next_Duration)
164 self.session.open(mainMenu)
166 def switchChannel(self):
167 self.session.open(channelSelection)
169 # a clock display dialog
170 class clockDisplay(Screen):
174 def __init__(self, session, clock):
175 Screen.__init__(self, session)
176 self["theClock"] = clock
178 b.onClick = [ self.okbutton ]
180 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
182 class serviceScan(Screen):
185 if self["scan"].isDone():
189 print "cancel not yet implemented ;)"
191 def __init__(self, session):
192 Screen.__init__(self, session)
194 self["scan_progress"] = ProgressBar()
195 self["scan_state"] = Label("scan state")
196 self["scan"] = ServiceScan(self["scan_progress"], self["scan_state"])
198 self["actions"] = ActionMap(["OkCancelActions"],
201 "cancel": self.cancel