2 from Components.MenuList import MenuList
3 from Components.ActionMap import ActionMap
4 from Components.ActionMap import NumberActionMap
5 from Components.Header import Header
6 from Components.Button import Button
7 from Components.Label import Label
9 from Components.HTMLComponent import *
10 from Components.GUIComponent import *
11 from Components.config import *
13 from enigma import eListbox, eListboxPythonConfigContent
15 class CiEntryList(HTMLComponent, GUIComponent):
16 def __init__(self, list):
17 GUIComponent.__init__(self)
18 self.l = eListboxPythonConfigContent()
20 self.l.setSeperation(100)
24 selection = self.getCurrent()
26 self.invalidateCurrent()
28 def handleKey(self, key):
29 #not every element got an .handleKey
31 selection = self.getCurrent()
32 selection[1].handleKey(key)
33 self.invalidateCurrent()
39 return self.l.getCurrentSelection()
41 def getCurrentIndex(self):
42 return self.l.getCurrentSelectionIndex()
44 def invalidateCurrent(self):
45 self.l.invalidateEntry(self.l.getCurrentSelectionIndex())
47 def GUIcreate(self, parent):
48 self.instance = eListbox(parent)
49 self.instance.setContent(self.l)
52 self.instance.setContent(None)
56 def addEntry(self, list, entry, index):
57 if entry[0] == "TEXT": #handle every item (text / pin only?)
58 list.append( (entry[1], index) )
60 x = configElement_nonSave("", configSequence, [1234], configsequencearg.get("INTEGER", (0, ((10**entry[1])-1))))
61 list.append( getConfigListEntry(entry[2],x) )
63 def okbuttonClick(self):
64 print "actual:" + str(self["entries"].getCurrentIndex())
66 def keyNumberGlobal(self, number):
67 self["entries"].handleKey(config.key[str(number)])
70 self["entries"].handleKey(config.key["prevElement"])
73 self["entries"].handleKey(config.key["nextElement"])
79 def __init__(self, session, slotid, title, subtitle, bottom, entries):
80 Screen.__init__(self, session)
83 self["title"] = Label(title)
84 self["subtitle"] = Label(subtitle)
85 self["bottom"] = Label(bottom)
90 self.addEntry(list, entry, cnt)
92 self["entries"] = CiEntryList(list)
94 self["actions"] = NumberActionMap(["SetupActions"],
96 "ok": self.okbuttonClick,
97 "cancel": self.keyCancel,
100 "right": self.keyRight,
101 "1": self.keyNumberGlobal,
102 "2": self.keyNumberGlobal,
103 "3": self.keyNumberGlobal,
104 "4": self.keyNumberGlobal,
105 "5": self.keyNumberGlobal,
106 "6": self.keyNumberGlobal,
107 "7": self.keyNumberGlobal,
108 "8": self.keyNumberGlobal,
109 "9": self.keyNumberGlobal,
110 "0": self.keyNumberGlobal
113 class CiSelection(Screen):
114 def okbuttonClick(self):
116 if self["entries"].getCurrent()[1] == 0: #reset
117 print "ci reset requested"
119 if self["entries"].getCurrent()[1] == 1: #init
120 print "ci init requested"
122 if self["entries"].getCurrent()[1] == 2: #mmi open
123 #ci->getInstance().mmiOpen() and wait for list of elments ???
124 #generate menu / list
126 list.append( ("TEXT", "CA-Info") )
127 list.append( ("TEXT", "Card Status") )
128 list.append( ("PIN", 6, "Card Pin") )
129 self.session.open(CiMmi, 0, "Wichtiges CI", "Mainmenu", "Footer", list)
131 def __init__(self, session):
132 #FIXME support for one ci only
133 Screen.__init__(self, session)
135 self["actions"] = ActionMap(["OkCancelActions"],
137 "ok": self.okbuttonClick,
142 list.append( ("Reset", 0) )
143 list.append( ("Init", 1) )
144 #add timer for "app-manager name" ?
145 list.append( ("Irdeto Blasel SE", 2) )
146 self["entries"] = CiEntryList(list)