add tag-types (list/menu/enq)
[enigma2.git] / lib / python / Screens / Ci.py
index e95672d61f7bd3a60e1bbb1c3e2866d7ac9765e5..8a330b86ca1f2a5cf008e467702684a0b8aa56a5 100644 (file)
@@ -33,7 +33,6 @@ class CiEntryList(HTMLComponent, GUIComponent):
                        self.invalidateCurrent()
                except: 
                        pass    
-                       
 
        def getCurrent(self):
                return self.l.getCurrentSelection()
@@ -57,11 +56,27 @@ class CiMmi(Screen):
                if entry[0] == "TEXT":          #handle every item (text / pin only?)
                        list.append( (entry[1], index) )
                if entry[0] == "PIN":
-                       x = configElement_nonSave("", configSequence, [1234], configsequencearg.get("INTEGER", (0, ((10**entry[1])-1))))
-                       list.append( getConfigListEntry(entry[2],x) )
+                       if entry[3] == 1:
+                               # masked pins:
+                               x = configElement_nonSave("", configSequence, [1234], configsequencearg.get("PINCODE", (entry[1], "-")))
+                       else:                           
+                               # unmasked pins:
+                               x = configElement_nonSave("", configSequence, [1234], configsequencearg.get("PINCODE", (entry[1], "")))                 
+                               
+                       self.pin = getConfigListEntry(entry[2],x)
+                       list.append( self.pin )
 
        def okbuttonClick(self):
-               print "actual:" + str(self["entries"].getCurrentIndex())
+               if self.tag == 0:       #ENQ
+                       print "enq- answer pin:" +  str(self.pin[1].parent.value[0])
+                       #ci[self.slotid]->getInstance().mmiEnqAnswer(self.pin[1].parent.value[0])
+               elif self.tag == 1:     #Menu
+                       print "answer - actual:" + str(self["entries"].getCurrentIndex())
+                       #ci[self.slotid]->getInstance().mmiAnswer(self["entries"].getCurrentIndex())
+               elif self.tag == 2:     #List
+                       print "answer on List - send 0"
+                       #ci[self.slotid]->getInstance().mmiAnswer(0)
+               self.close()
 
        def keyNumberGlobal(self, number):
                self["entries"].handleKey(config.key[str(number)])
@@ -76,10 +91,12 @@ class CiMmi(Screen):
                print "keyCancel"
                self.close()
                
-       def __init__(self, session, slotid, title, subtitle, bottom, entries):
+               #tag is 0=ENQ 1=Menu 2=List
+       def __init__(self, session, slotid, tag, title, subtitle, bottom, entries):
                Screen.__init__(self, session)
 
                self.slotid = slotid
+               self.tag = tag
                self["title"] = Label(title)
                self["subtitle"] = Label(subtitle)
                self["bottom"] = Label(bottom)
@@ -110,17 +127,26 @@ class CiMmi(Screen):
                                "0": self.keyNumberGlobal
                        }, -1)
 
-#just for testing - we need an cimanager? (or not?)
 class CiSelection(Screen):
        def okbuttonClick(self):
-               #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)
+       
+               if self["entries"].getCurrent()[1] == 0:                #reset
+                       print "ci reset requested"
+                       pass
+               if self["entries"].getCurrent()[1] == 1:                #init
+                       print "ci init requested"
+                       pass
+               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", 1) )
+                       self.session.open(CiMmi, 0, 0, "Wichtiges CI", "Mainmenu", "Footer", list)
                
        def __init__(self, session):
+               #FIXME support for one ci only
                Screen.__init__(self, session)
                
                self["actions"] = ActionMap(["OkCancelActions"], 
@@ -128,3 +154,10 @@ class CiSelection(Screen):
                                "ok": self.okbuttonClick,
                                "cancel": self.close
                        })
+                       
+               list = [ ]
+               list.append( ("Reset", 0) )
+               list.append( ("Init", 1) )
+               #add timer for "app-manager name" ?
+               list.append( ("Irdeto Blasel SE", 2) )
+               self["entries"] = CiEntryList(list)