X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/27ac653dea3ebb218d915604a8fce4b0d34d9278..687353c5fefbeea8486cbb28dedf52a53dc65e9b:/lib/python/Screens/Ci.py diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py index 10e33cfe..b3653d21 100644 --- a/lib/python/Screens/Ci.py +++ b/lib/python/Screens/Ci.py @@ -22,6 +22,7 @@ class CiMmi(Screen): print "ciMMI with action" + str(action) + self.tag = None self.slotid = slotid self.timer = eTimer() @@ -79,6 +80,8 @@ class CiMmi(Screen): def okbuttonClick(self): self.timer.stop() + if not self.tag: + return if self.tag == "WAIT": print "do nothing - wait" elif self.tag == "MENU": @@ -108,6 +111,8 @@ class CiMmi(Screen): def keyCancel(self): self.timer.stop() + if not self.tag: + return if self.tag == "WAIT": eDVBCI_UI.getInstance().stopMMI(self.slotid) self.closeMmi() @@ -149,7 +154,7 @@ class CiMmi(Screen): List.l.setList(list) return - if self.tag == "ENQ": + if self.tag and self.tag == "ENQ": type = TYPE_CONFIG else: type = TYPE_MENU @@ -268,19 +273,22 @@ class CiSelection(Screen): self.dlg = None self.state = { } self.list = [ ] - self["entries"] = MenuList(list) - self.clearMenu() - self.createMenu(0) # FIXME more than one CI - CiHandler.registerCIMessageHandler(0, self.ciStateChanged) - def clearMenu(self): - self.list = [ ] + 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 createMenu(self, slot): + def appendEntries(self, slot, state): + self.state[slot] = state self.list.append( (_("Reset"), 0, slot) ) self.list.append( (_("Init"), 1, slot) ) - self.state[slot] = eDVBCI_UI.getInstance().getState(slot) if self.state[slot] == 0: #no module self.list.append( (_("no module found"), 2, slot) ) elif self.state[slot] == 1: #module in init @@ -290,8 +298,29 @@ class CiSelection(Screen): appname = eDVBCI_UI.getInstance().getAppName(slot) self.list.append( (appname, 2, slot) ) - self["entries"].list = self.list - self["entries"].l.setList(self.list) + 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: @@ -301,8 +330,7 @@ class CiSelection(Screen): if self.state[slot] != state: #print "something happens" self.state[slot] = state - self.clearMenu() - self.createMenu(slot) + self.updateState(slot) def dlgClosed(self, slot): self.dlg = None @@ -319,13 +347,6 @@ class CiSelection(Screen): elif self.state[slot] == 2: self.dlg = self.session.openWithCallback(self.dlgClosed, CiMmi, slot, action) - #generate menu / list - #list = [ ] - #list.append( ("TEXT", "CA-Info") ) - #list.append( ("TEXT", "Card Status") ) - #list.append( ("PIN", 6, "Card Pin", 1) ) - #self.session.open(CiMmi, 0, 0, "Wichtiges CI", "Mainmenu", "Footer", list) - def cancel(self): CiHandler.unregisterCIMessageHandler(0) self.close()