X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/13e74ce7d8fcccc12bed3ce65c4f35987f206799..394e2b2e2488ae3fa5edc6a9a512bcf0414cc562:/lib/python/Components/Input.py diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py index a3ab764e..42426114 100644 --- a/lib/python/Components/Input.py +++ b/lib/python/Components/Input.py @@ -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 @@ -26,8 +26,15 @@ class Input(HTMLComponent, GUIComponent, VariableText): 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,11 +57,12 @@ class Input(HTMLComponent, GUIComponent, VariableText): 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": + if self.text[self.currPos] == "9" or self.text[self.currPos] == " ": newNumber = "0" else: newNumber = str(int(self.text[self.currPos]) + 1) @@ -62,17 +70,24 @@ 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 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)