don't bluescreen on pressing up/down when cursor is on empty position in an input box
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 22 May 2006 03:41:17 +0000 (03:41 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 22 May 2006 03:41:17 +0000 (03:41 +0000)
lib/python/Components/Input.py

index d561c5d..0bd1305 100644 (file)
@@ -54,7 +54,7 @@ class Input(VariableText, HTMLComponent, GUIComponent):
                self.update()
                
        def up(self):
                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)
                        newNumber = "0"
                else:
                        newNumber = str(int(self.text[self.currPos]) + 1)
@@ -62,10 +62,11 @@ class Input(VariableText, HTMLComponent, GUIComponent):
                self.update()
                
        def down(self):
                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)
                        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()
                
                self.text = self.text[0:self.currPos] + newNumber + self.text[self.currPos + 1:]
                self.update()