many keyboard improvements by Anders Holst
[vuplus_dvbapp] / lib / python / Screens / InputBox.py
index bb8b63d..fe21ea0 100644 (file)
@@ -1,15 +1,12 @@
-from enigma import *
+from enigma import eRCInput, getPrevAsciiCode
 from Screens.Screen import Screen
 from Screens.MessageBox import MessageBox
 from Components.ActionMap import NumberActionMap
 from Components.Label import Label
 from Components.Input import Input
-from Components.GUIComponent import *
 from Tools.BoundFunction import boundFunction
 from time import time
 
-import os
-
 class InputBox(Screen):
        def __init__(self, session, title = "", windowTitle = _("Input"), **kwargs):
                Screen.__init__(self, session)
@@ -25,7 +22,6 @@ class InputBox(Screen):
                        "back": self.cancel,
                        "left": self.keyLeft,
                        "right": self.keyRight,
-                       "delete": self.keyDelete,
                        "moveLeft": self.keyLeft,
                        "moveRight": self.keyRight,
                        "moveHome": self.keyHome,
@@ -91,7 +87,7 @@ class InputBox(Screen):
 
 class PinInput(InputBox):
        def __init__(self, session, service = "", triesEntry = None, pinList = [], *args, **kwargs):
-               InputBox.__init__(self, session = session, text="9876", maxSize=True, type=Input.PIN, *args, **kwargs)
+               InputBox.__init__(self, session = session, text="    ", maxSize=True, type=Input.PIN, *args, **kwargs)
                
                self.waitTime = 15
                
@@ -112,6 +108,13 @@ class PinInput(InputBox):
                self["tries"] = Label("")
                self.onShown.append(self.showTries)
 
+       def gotAsciiCode(self):
+               if self["input"].currPos == len(self["input"]) - 1:
+                       InputBox.gotAsciiCode(self)
+                       self.go()
+               else:
+                       InputBox.gotAsciiCode(self)
+
        def keyNumberGlobal(self, number):
                if self["input"].currPos == len(self["input"]) - 1:
                        InputBox.keyNumberGlobal(self, number)
@@ -120,7 +123,7 @@ class PinInput(InputBox):
                        InputBox.keyNumberGlobal(self, number)
                
        def checkPin(self, pin):
-               if pin is not None and int(pin) in self.pinList:
+               if pin is not None and pin.find(" ") == -1 and int(pin) in self.pinList:
                        return True
                return False
                
@@ -139,18 +142,22 @@ class PinInput(InputBox):
                                pass
        
        def closePinWrong(self, *args):
+               rcinput = eRCInput.getInstance()
+               rcinput.setKeyboardMode(rcinput.kmNone)
                print "args:", args
                self.close(False)
                
        def closePinCorrect(self, *args):
+               rcinput = eRCInput.getInstance()
+               rcinput.setKeyboardMode(rcinput.kmNone)
                self.close(True)
                
        def closePinCancel(self, *args):
+               rcinput = eRCInput.getInstance()
+               rcinput.setKeyboardMode(rcinput.kmNone)
                self.close(None)
                        
        def cancel(self):
-               rcinput = eRCInput.getInstance()
-               rcinput.setKeyboardMode(rcinput.kmNone)
                self.closePinCancel()
                
        def getTries(self):
@@ -165,4 +172,4 @@ class PinInput(InputBox):
                self.triesEntry.tries.save()
                                
        def showTries(self):
-               self["tries"].setText(_("Tries left:") + " " + str(self.getTries()))
\ No newline at end of file
+               self["tries"].setText(_("Tries left:") + " " + str(self.getTries()))