X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/ed40f6f85c9c07c3c1224ae20601082c0309a631..a029953596adaed49a5b0346acd5a867eff91a57:/lib/python/Screens/Ci.py diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py index 27ca5aa3..75bdd5bc 100644 --- a/lib/python/Screens/Ci.py +++ b/lib/python/Screens/Ci.py @@ -1,15 +1,12 @@ -from Screen import * -from Components.MenuList import MenuList +from Screen import Screen from Components.ActionMap import ActionMap from Components.ActionMap import NumberActionMap -from Components.Header import Header -from Components.Button import Button from Components.Label import Label from Components.config import config, ConfigSubsection, ConfigSelection, ConfigSubList, getConfigListEntry, KEY_LEFT, KEY_RIGHT, KEY_0, ConfigNothing, ConfigPIN from Components.ConfigList import ConfigList -from enigma import eTimer, eDVBCI_UI, eListboxPythonStringContent, eListboxPythonConfigContent +from enigma import eTimer, eDVBCI_UI MAX_NUM_CI = 4 @@ -231,11 +228,10 @@ class CiMessageHandler: 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] + if slot in self.dlgs: + del self.dlgs[slot] def registerCIMessageHandler(self, slot, func): self.unregisterCIMessageHandler(slot) @@ -250,7 +246,6 @@ CiHandler = CiMessageHandler() class CiSelection(Screen): def __init__(self, session): Screen.__init__(self, session) - self["actions"] = ActionMap(["OkCancelActions", "CiSelectionActions"], { "left": self.keyLeft, @@ -273,6 +268,12 @@ class CiSelection(Screen): 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: @@ -308,7 +309,7 @@ class CiSelection(Screen): self.state[slot] = state slotidx=0 - while self.list[slotidx][2] != slot: + while len(self.list[slotidx]) < 3 or self.list[slotidx][3] != slot: slotidx += 1 slotidx += 1 # do not change Reset @@ -353,5 +354,8 @@ class CiSelection(Screen): self.dlg = self.session.openWithCallback(self.dlgClosed, CiMmi, slot, action) def cancel(self): - CiHandler.unregisterCIMessageHandler(0) + for slot in range(MAX_NUM_CI): + state = eDVBCI_UI.getInstance().getState(slot) + if state != -1: + CiHandler.unregisterCIMessageHandler(slot) self.close()