+ for slot in range(MAX_NUM_CI):
+ state = eDVBCI_UI.getInstance().getState(slot)
+ if state != -1:
+ self.appendEntries(slot, state)
+ CiHandler.registerCIMessageHandler(slot, self.ciStateChanged)
+
+ menuList = ConfigList(self.list)
+ menuList.list = self.list
+ menuList.l.setList(self.list)
+ self["entries"] = menuList
+ self["entries"].onSelectionChanged.append(self.selectionChanged)
+ self["text"] = Label(_("Slot %d")%(1))
+
+ def selectionChanged(self):
+ cur_idx = self["entries"].getCurrentIndex()
+ self["text"].setText(_("Slot %d")%((cur_idx / 4)+1))
+
+ def keyConfigEntry(self, key):
+ try:
+ self["entries"].handleKey(key)
+ self["entries"].getCurrent()[1].save()
+ except:
+ pass
+
+ def keyLeft(self):
+ self.keyConfigEntry(KEY_LEFT)
+
+ def keyRight(self):
+ self.keyConfigEntry(KEY_RIGHT)
+
+ def appendEntries(self, slot, state):
+ self.state[slot] = state
+ self.list.append( (_("Reset"), ConfigNothing(), 0, slot) )
+ self.list.append( (_("Init"), ConfigNothing(), 1, slot) )
+
+ if self.state[slot] == 0: #no module
+ self.list.append( (_("no module found"), ConfigNothing(), 2, slot) )
+ elif self.state[slot] == 1: #module in init
+ self.list.append( (_("init module"), ConfigNothing(), 2, slot) )
+ elif self.state[slot] == 2: #module ready
+ #get appname
+ appname = eDVBCI_UI.getInstance().getAppName(slot)
+ self.list.append( (appname, ConfigNothing(), 2, slot) )
+
+ self.list.append(getConfigListEntry(_("Multiple service support"), config.ci[slot].canDescrambleMultipleServices))
+
+ def updateState(self, slot):
+ state = eDVBCI_UI.getInstance().getState(slot)
+ self.state[slot] = state
+
+ slotidx=0
+ while len(self.list[slotidx]) < 3 or self.list[slotidx][3] != slot:
+ slotidx += 1
+
+ slotidx += 1 # do not change Reset
+ slotidx += 1 # do not change Init
+
+ if state == 0: #no module
+ self.list[slotidx] = (_("no module found"), ConfigNothing(), 2, slot)
+ elif state == 1: #module in init
+ self.list[slotidx] = (_("init module"), ConfigNothing(), 2, slot)
+ elif state == 2: #module ready
+ #get appname
+ appname = eDVBCI_UI.getInstance().getAppName(slot)
+ self.list[slotidx] = (appname, ConfigNothing(), 2, slot)
+
+ lst = self["entries"]
+ lst.list = self.list
+ lst.l.setList(self.list)
+
+ def ciStateChanged(self, slot):
+ if self.dlg:
+ self.dlg.ciStateChanged()
+ else:
+ state = eDVBCI_UI.getInstance().getState(slot)
+ if self.state[slot] != state:
+ #print "something happens"
+ self.state[slot] = state
+ self.updateState(slot)
+
+ def dlgClosed(self, slot):
+ self.dlg = None
+
+ def okbuttonClick(self):
+ cur = self["entries"].getCurrent()
+ if cur and len(cur) > 2:
+ action = cur[2]
+ slot = cur[3]
+ if action == 0: #reset
+ eDVBCI_UI.getInstance().setReset(slot)
+ elif action == 1: #init
+ eDVBCI_UI.getInstance().setInit(slot)
+ elif self.state[slot] == 2:
+ self.dlg = self.session.openWithCallback(self.dlgClosed, MMIDialog, slot, action)
+
+ def cancel(self):
+ for slot in range(MAX_NUM_CI):
+ state = eDVBCI_UI.getInstance().getState(slot)
+ if state != -1:
+ CiHandler.unregisterCIMessageHandler(slot)
+ self.close()