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 mainMenu(Screen):
44 self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!")
46 def goTimeshift(self):
47 self["title"].setText("JUST PRESS THE YELLOW BUTTON!")
50 self["title"].setText("HDTV GREEN FLASHES: ENABLED")
53 self.session.open(serviceScan)
56 self.session.open(clockDisplay, Clock())
58 def okbuttonClick(self):
59 selection = self["menu"].getCurrent()
62 def __init__(self, session):
63 Screen.__init__(self, session)
66 self["actions"] = ActionMap(["OkCancelActions"],
68 "ok": self.okbuttonClick,
72 b.onClick = [ self.okbuttonClick ]
74 self["title"] = Header("Main Menu! - press ok to leave!")
75 self["menu"] = MenuList(
77 ("Close Main Menu", self.close),
78 ("Service Scan", self.goScan),
79 ("Quit", quitMainloop),
80 ("EMU SETUP", self.goEmu),
81 ("TIMESHIFT SETUP", self.goTimeshift),
82 ("HDTV PIP CONFIG", self.goHDTV),
83 ("wie spaet ists?!", self.goClock)
86 class channelSelection(Screen):
87 def __init__(self, session):
88 Screen.__init__(self, session)
90 self["list"] = ServiceList()
91 self["list"].setRoot(eServiceReference("""1:0:1:0:0:0:0:0:0:0:(provider=="ARD") && (type == 1)"""))
93 self["okbutton"] = Button("ok", [self.channelSelected])
95 class ChannelActionMap(ActionMap):
96 def action(self, contexts, action):
97 if action[:7] == "bouquet":
98 print "setting root to " + action[8:]
99 self.csel["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
101 ActionMap.action(self, contexts, action)
103 self["actions"] = ChannelActionMap(["ChannelSelectActions", "OkCancelActions"],
105 "cancel": self.close,
106 "ok": self.channelSelected,
109 self["actions"].csel = self
112 ref = self["list"].getCurrent()
113 if self["list"].isMarked(ref):
114 self["list"].removeMarked(ref)
116 self["list"].addMarked(ref)
118 def channelSelected(self):
119 self.session.nav.playService(self["list"].getCurrent())
123 class infoBar(Screen):
124 def __init__(self, session):
125 Screen.__init__(self, session)
127 self["actions"] = ActionMap( [ "InfobarActions" ],
129 "switchChannel": self.switchChannel,
130 "mainMenu": self.mainMenu
132 self["okbutton"] = Button("mainMenu", [self.mainMenu])
134 self["CurrentTime"] = Clock()
136 self["ServiceName"] = ServiceName(self.session.nav)
138 self["Event_Now"] = EventInfo(self.session.nav, EventInfo.Now)
139 self["Event_Next"] = EventInfo(self.session.nav, EventInfo.Next)
141 self["Event_Now_Duration"] = EventInfo(self.session.nav, EventInfo.Now_Duration)
142 self["Event_Next_Duration"] = EventInfo(self.session.nav, EventInfo.Next_Duration)
145 self.session.open(mainMenu)
147 def switchChannel(self):
148 self.session.open(channelSelection)
150 # a clock display dialog
151 class clockDisplay(Screen):
155 def __init__(self, session, clock):
156 Screen.__init__(self, session)
157 self["theClock"] = clock
159 b.onClick = [ self.okbutton ]
161 self["title"] = Header("clock dialog: here you see the current uhrzeit!")
163 class serviceScan(Screen):
166 if self["scan"].isDone():
170 print "cancel not yet implemented ;)"
172 def __init__(self, session):
173 Screen.__init__(self, session)
175 self["scan_progress"] = ProgressBar()
176 self["scan_state"] = Label("scan state")
177 self["scan"] = ServiceScan(self["scan_progress"], self["scan_state"])
179 self["actions"] = ActionMap(["OkCancelActions"],
182 "cancel": self.cancel