+ for slot in range(4):
+ state = eDVBCI_UI.getInstance().getState(slot)
+ self.appendEntries(slot, state) # FIXME more than one CI
+ CiHandler.registerCIMessageHandler(slot, self.ciStateChanged)
+
+ menuList = MenuList(list)
+ menuList.list = self.list
+ menuList.l.setList(self.list)
+ self["entries"] = menuList
+
+ def appendEntries(self, slot, state):
+ self.state[slot] = state
+ self.list.append( (_("Reset"), 0, slot) )
+ self.list.append( (_("Init"), 1, slot) )
+
+ if self.state[slot] == 0: #no module
+ self.list.append( (_("no module found"), 2, slot) )
+ elif self.state[slot] == 1: #module in init
+ self.list.append( (_("init module"), 2, slot) )
+ elif self.state[slot] == 2: #module ready
+ #get appname
+ appname = eDVBCI_UI.getInstance().getAppName(slot)
+ self.list.append( (appname, 2, slot) )
+
+ def updateState(self, slot):
+ state = eDVBCI_UI.getInstance().getState(slot)
+ self.state[slot] = state
+
+ slotidx=0
+ while self.list[slotidx][2] != 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"), 2, slot)
+ elif state == 1: #module in init
+ self.list[slotidx] = (_("init module"), 2, slot)
+ elif state == 2: #module ready
+ #get appname
+ appname = eDVBCI_UI.getInstance().getAppName(slot)
+ self.list[slotidx] = (appname, 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:
+ action = cur[1]
+ slot = cur[2]
+ 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, CiMmi, slot, action)
+
+ def cancel(self):
+ CiHandler.unregisterCIMessageHandler(0)
+ self.close()