fix setText("")
[enigma2.git] / lib / python / Components / Input.py
index 0bd13059e3ad69d75bcb7dbb4a0ce26afcab7309..4242611403c6294a845f42e68e9319f1efbcd1c7 100644 (file)
@@ -26,8 +26,15 @@ class Input(VariableText, HTMLComponent, GUIComponent):
                text = self.text
                if self.type == self.PIN:
                        text = "*" * len(self.text)
-               self.setText(text)
-               #self.setText(self.text[0:self.currPos] + "_" + self.text[self.currPos] + "_" + self.text[self.currPos + 1:])
+               self.message = text
+               if self.instance:
+                       self.instance.setText(self.message)
+
+       def setText(self, text):
+               if not len(text):
+                       self.currPos = 0
+               self.text = text
+               self.update()
 
        def getText(self):
                return self.text
@@ -50,8 +57,9 @@ class Input(VariableText, HTMLComponent, GUIComponent):
                self.update()
                
        def left(self):
-               self.currPos -= 1
-               self.update()
+               if self.currPos > 0:
+                       self.currPos -= 1
+                       self.update()
                
        def up(self):
                if self.text[self.currPos] == "9" or self.text[self.currPos] == " ":
@@ -73,7 +81,13 @@ class Input(VariableText, HTMLComponent, GUIComponent):
        def delete(self):
                self.text = self.text[:self.currPos] + self.text[self.currPos + 1:]
                self.update()
-               
+
+       def handleAscii(self, code):
+               newChar = chr(code)
+               self.text = self.text[0:self.currPos] + newChar + self.text[self.currPos + 1:]
+               self.right()
+               self.update()
+
        def number(self, number):
                if self.type == self.TEXT:
                        newChar = self.numericalTextInput.getKey(number)