don't bluescreen on pressing up/down when cursor is on empty position in an input box
[enigma2.git] / lib / python / Components / Input.py
index f1a17d90b8f042453d18418a4c9ff9af4b648506..0bd13059e3ad69d75bcb7dbb4a0ce26afcab7309 100644 (file)
@@ -6,7 +6,7 @@ from enigma import eLabel
 
 from Tools.NumericalTextInput import NumericalTextInput
 
-class Input(HTMLComponent, GUIComponent, VariableText):
+class Input(VariableText, HTMLComponent, GUIComponent):
        TEXT = 0
        PIN = 1
        NUMBER = 2      
@@ -54,7 +54,7 @@ class Input(HTMLComponent, GUIComponent, VariableText):
                self.update()
                
        def up(self):
-               if self.text[self.currPos] == "9":
+               if self.text[self.currPos] == "9" or self.text[self.currPos] == " ":
                        newNumber = "0"
                else:
                        newNumber = str(int(self.text[self.currPos]) + 1)
@@ -62,13 +62,18 @@ class Input(HTMLComponent, GUIComponent, VariableText):
                self.update()
                
        def down(self):
-               if self.text[self.currPos] == "0":
+               if self.text[self.currPos] == "0" or self.text[self.currPos] == " ":
                        newNumber = "9"
                else:
                        newNumber = str(int(self.text[self.currPos]) - 1)
+
                self.text = self.text[0:self.currPos] + newNumber + self.text[self.currPos + 1:]
                self.update()
                
+       def delete(self):
+               self.text = self.text[:self.currPos] + self.text[self.currPos + 1:]
+               self.update()
+               
        def number(self, number):
                if self.type == self.TEXT:
                        newChar = self.numericalTextInput.getKey(number)