2 from Components.MenuList import MenuList
3 from Components.ActionMap import ActionMap
4 from Components.ActionMap import NumberActionMap
5 from Components.Header import Header
6 from Components.Button import Button
7 from Components.Label import Label
9 from Components.HTMLComponent import *
10 from Components.GUIComponent import *
11 from Components.config import *
15 class CiConfigList(HTMLComponent, GUIComponent):
16 def __init__(self, list):
17 GUIComponent.__init__(self)
18 self.l = eListboxPythonConfigContent()
20 self.l.setSeperation(100)
26 def handleKey(self, key):
27 selection = self.getCurrent()
28 selection[1].handleKey(key)
29 self.invalidateCurrent()
32 return self.l.getCurrentSelection()
34 def invalidateCurrent(self):
35 self.l.invalidateEntry(self.l.getCurrentSelectionIndex())
37 def invalidate(self, entry):
40 if (entry.getConfigPath() == x[1].parent.getConfigPath()):
41 self.l.invalidateEntry(i)
45 def GUIcreate(self, parent):
46 self.instance = eListbox(parent)
47 self.instance.setContent(self.l)
50 self.instance.setContent(None)
54 def addEntry(self, list, entry):
55 if entry[0] == "TEXT": #handle every item (text / pin only?)
56 #list.append( (entry[1], entry[2]) )
57 list.append( (entry[1], entry[2]) )
61 x = configElement_nonSave("", configSequence, [1234], configsequencearg.get("PINCODE", (entry[1], "-")))
64 x = configElement_nonSave("", configSequence, [1234], configsequencearg.get("PINCODE", (entry[1], "")))
66 list.append( (entry[2], 0) )
67 self.pin = getConfigListEntry("",x)
68 list.append( self.pin )
70 def okbuttonClick(self):
72 if self.tag == "WAIT":
73 print "do nothing - wait"
74 elif self.tag == "MENU":
76 eDVBCI_UI.getInstance().answerMenu(self.slotid, self["entries"].getCurrent()[1])
78 elif self.tag == "LIST":
80 eDVBCI_UI.getInstance().answerMenu(self.slotid, 0)
82 elif self.tag == "ENQ":
84 eDVBCI_UI.getInstance().answerEnq(self.slotid, str(self.pin[1].parent.value))
93 if self.tag == "WAIT":
95 elif self.tag == "MENU":
96 eDVBCI_UI.getInstance().answerMenu(self.slotid, 0)
98 elif self.tag == "LIST":
99 eDVBCI_UI.getInstance().answerMenu(self.slotid, 0)
101 elif self.tag == "ENQ":
102 eDVBCI_UI.getInstance().cancelEnq(self.slotid)
105 print "give cancel action to ci"
107 def keyNumberGlobal(self, number):
108 self["entries"].handleKey(config.key[str(number)])
111 self["entries"].handleKey(config.key["prevElement"])
114 self["entries"].handleKey(config.key["nextElement"])
116 def updateList(self, list):
117 self["entries"].list = list
118 self["entries"].l.setList(list)
122 self["title"].setText("")
123 self["subtitle"].setText("")
124 self["bottom"].setText("")
126 list.append( ("wait for ci...", 0) )
127 self.updateList(list)
129 def showScreen(self):
130 screen = eDVBCI_UI.getInstance().getMMIScreen(self.slotid)
134 self.tag = screen[0][0]
137 if entry[0] == "TITLE":
138 self["title"].setText(entry[1])
139 elif entry[0] == "SUBTITLE":
140 self["subtitle"].setText(entry[1])
141 elif entry[0] == "BOTTOM":
142 self["bottom"].setText(entry[1])
143 elif entry[0] == "TEXT":
144 self.addEntry(list, entry)
145 elif entry[0] == "PIN":
146 self.addEntry(list, entry)
148 self.updateList(list)
150 def TimerCheck(self):
152 if self.action == 0: #reset
154 if self.action == 1: #init
157 #module still there ?
158 if eDVBCI_UI.getInstance().getState(self.slotid) != 2:
161 #mmi session still active ?
162 if eDVBCI_UI.getInstance().getMMIState(self.slotid) != 1:
165 #new screen available?
166 if eDVBCI_UI.getInstance().availableMMI(self.slotid) == 1:
169 #FIXME: check for mmi-session closed
171 def __init__(self, session, slotid, action):
172 Screen.__init__(self, session)
174 print "ciMMI with action" + str(action)
178 self.Timer = eTimer()
179 self.Timer.timeout.get().append(self.TimerCheck)
180 self.Timer.start(1000)
182 #else the skins fails
183 self["title"] = Label("")
184 self["subtitle"] = Label("")
185 self["bottom"] = Label("")
186 self["entries"] = MenuList([ ])
187 #self["entries"] = CiConfigList([ ])
189 self["actions"] = NumberActionMap(["SetupActions"],
191 "ok": self.okbuttonClick,
192 "cancel": self.keyCancel,
194 "left": self.keyLeft,
195 "right": self.keyRight,
196 "1": self.keyNumberGlobal,
197 "2": self.keyNumberGlobal,
198 "3": self.keyNumberGlobal,
199 "4": self.keyNumberGlobal,
200 "5": self.keyNumberGlobal,
201 "6": self.keyNumberGlobal,
202 "7": self.keyNumberGlobal,
203 "8": self.keyNumberGlobal,
204 "9": self.keyNumberGlobal,
205 "0": self.keyNumberGlobal
210 if action == 0: #reset
211 eDVBCI_UI.getInstance().setReset(self.slotid)
213 elif action == 1: #init
216 elif action == 2: #start MMI
217 eDVBCI_UI.getInstance().startMMI(self.slotid)
219 elif action == 3: #mmi already there (called from infobar)
222 class CiSelection(Screen):
223 def createMenu(self):
225 self.list.append( ("Reset", 0) )
226 self.list.append( ("Init", 1) )
228 self.state = eDVBCI_UI.getInstance().getState(0)
229 if self.state == 0: #no module
230 self.list.append( ("no module found", 2) )
231 elif self.state == 1: #module in init
232 self.list.append( ("init module", 2) )
233 elif self.state == 2: #module ready
235 appname = eDVBCI_UI.getInstance().getAppName(0)
236 self.list.append( (appname, 2) )
238 self["entries"] .list = self.list
239 self["entries"] .l.setList(self.list)
241 def TimerCheck(self):
242 state = eDVBCI_UI.getInstance().getState(0)
243 if self.state != state:
244 #print "something happens"
248 def okbuttonClick(self):
252 self.session.open(CiMmi, 0, self["entries"].getCurrent()[1])
254 #generate menu / list
256 #list.append( ("TEXT", "CA-Info") )
257 #list.append( ("TEXT", "Card Status") )
258 #list.append( ("PIN", 6, "Card Pin", 1) )
259 #self.session.open(CiMmi, 0, 0, "Wichtiges CI", "Mainmenu", "Footer", list)
265 def __init__(self, session):
266 #FIXME support for one ci only
267 Screen.__init__(self, session)
269 self["actions"] = ActionMap(["OkCancelActions"],
271 "ok": self.okbuttonClick,
272 "cancel": self.cancel
276 self["entries"] = MenuList(list)
279 self.Timer = eTimer()
280 self.Timer.timeout.get().append(self.TimerCheck)
281 self.Timer.start(1000)