X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/51d5a73e196435b2f7d9de9e2d007c422293f071..a029953596adaed49a5b0346acd5a867eff91a57:/lib/python/Screens/Ci.py diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py index d23fb044..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, @@ -265,7 +260,6 @@ class CiSelection(Screen): for slot in range(MAX_NUM_CI): state = eDVBCI_UI.getInstance().getState(slot) - print "slot", slot, "state", state if state != -1: self.appendEntries(slot, state) CiHandler.registerCIMessageHandler(slot, self.ciStateChanged) @@ -274,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: @@ -309,7 +309,7 @@ class CiSelection(Screen): self.state[slot] = state slotidx=0 - while self.list[slotidx][3] != slot: + while len(self.list[slotidx]) < 3 or self.list[slotidx][3] != slot: slotidx += 1 slotidx += 1 # do not change Reset @@ -354,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()