- if self["entries"].getCurrent()[1] == 2: #mmi open
- #ci->getInstance().mmiOpen() and wait for list of elments ???
- #generate menu / list
- list = [ ]
- list.append( ("TEXT", "CA-Info") )
- list.append( ("TEXT", "Card Status") )
- list.append( ("PIN", 6, "Card Pin") )
- self.session.open(CiMmi, 0, "Wichtiges CI", "Mainmenu", "Footer", list)
-
+
+ def keyNumberGlobal(self, number):
+ self.timer.stop()
+ self.keyConfigEntry(config.key[str(number)])
+
+ def keyLeft(self):
+ self.timer.stop()
+ self.keyConfigEntry(config.key["prevElement"])
+
+ def keyRight(self):
+ self.timer.stop()
+ self.keyConfigEntry(config.key["nextElement"])
+
+ def updateList(self, list):
+ List = self["entries"]
+ try:
+ List.instance.moveSelectionTo(0)
+ except:
+ List.l.setList(list)
+ return
+
+ if self.tag and self.tag == "ENQ":
+ type = TYPE_CONFIG
+ else:
+ type = TYPE_MENU
+
+ if type != self.listtype:
+ if type == TYPE_CONFIG:
+ List.l = eListboxPythonConfigContent()
+ else:
+ List.l = eListboxPythonStringContent()
+ List.instance.setContent(List.l)
+ self.listtype = type
+
+ List.l.setList(list)
+
+ def showWait(self):
+ self.tag = "WAIT"
+ self["title"].setText("")
+ self["subtitle"].setText("")
+ self["bottom"].setText("")
+ list = [ ]
+ list.append( ("wait for ci...", 0) )
+ self.updateList(list)
+
+ def showScreen(self):
+ screen = eDVBCI_UI.getInstance().getMMIScreen(self.slotid)
+
+ list = [ ]
+
+ self.timer.stop()
+ if len(screen) > 0 and screen[0][0] == "CLOSE":
+ timeout = screen[0][1]
+ if timeout > 0:
+ self.timer.start(timeout*1000, True)
+ else:
+ self.keyCancel()
+ else:
+ self.tag = screen[0][0]
+ for entry in screen:
+ if entry[0] == "PIN":
+ self.addEntry(list, entry)
+ else:
+ if entry[0] == "TITLE":
+ self["title"].setText(entry[1])
+ elif entry[0] == "SUBTITLE":
+ self["subtitle"].setText(entry[1])
+ elif entry[0] == "BOTTOM":
+ self["bottom"].setText(entry[1])
+ elif entry[0] == "TEXT":
+ self.addEntry(list, entry)
+ self.updateList(list)
+
+ def ciStateChanged(self):
+ if self.action == 0: #reset
+ self.closeMmi()
+ if self.action == 1: #init
+ self.closeMmi()
+
+ #module still there ?
+ if eDVBCI_UI.getInstance().getState(self.slotid) != 2:
+ self.closeMmi()
+
+ #mmi session still active ?
+ if eDVBCI_UI.getInstance().getMMIState(self.slotid) != 1:
+ self.closeMmi()
+
+ if self.action > 1 and eDVBCI_UI.getInstance().availableMMI(self.slotid) == 1:
+ self.showScreen()
+
+ #FIXME: check for mmi-session closed
+
+class CiMessageHandler:
+ def __init__(self):
+ self.session = None
+ self.ci = { }
+ self.dlgs = { }
+ eDVBCI_UI.getInstance().ciStateChanged.get().append(self.ciStateChanged)
+
+ def setSession(self, session):
+ self.session = session
+
+ def ciStateChanged(self, slot):
+ if slot in self.ci:
+ self.ci[slot](slot)
+ else:
+ if slot in self.dlgs:
+ self.dlgs[slot].ciStateChanged()
+ elif eDVBCI_UI.getInstance().availableMMI(slot) == 1:
+ if self.session:
+ self.dlgs[slot] = self.session.openWithCallback(self.dlgClosed, CiMmi, slot, 3)
+ else:
+ print "no session"
+
+ def dlgClosed(self, slot):
+ del self.dlgs[slot]
+
+ def registerCIMessageHandler(self, slot, func):
+ self.unregisterCIMessageHandler(slot)
+ self.ci[slot] = func
+
+ def unregisterCIMessageHandler(self, slot):
+ if slot in self.ci:
+ del self.ci[slot]
+
+CiHandler = CiMessageHandler()
+
+class CiSelection(Screen):