1 from HTMLComponent import *
2 from GUIComponent import *
3 from VariableText import *
5 from enigma import eLabel
7 from Tools.NumericalTextInput import NumericalTextInput
9 class Input(HTMLComponent, GUIComponent, VariableText):
14 def __init__(self, text="", maxSize = False, type = TEXT):
15 GUIComponent.__init__(self)
16 VariableText.__init__(self)
17 self.numericalTextInput = NumericalTextInput(self.right)
19 self.maxSize = maxSize
25 self.setMarkedPos(self.currPos)
27 if self.type == self.PIN:
28 text = "*" * len(self.text)
30 #self.setText(self.text[0:self.currPos] + "_" + self.text[self.currPos] + "_" + self.text[self.currPos + 1:])
35 def createWidget(self, parent):
36 return eLabel(parent, self.currPos)
39 s = self.instance.calculateSize()
40 return (s.width(), s.height())
44 if self.currPos == len(self.text):
48 self.text = self.text + " "
57 if self.text[self.currPos] == "9":
60 newNumber = str(int(self.text[self.currPos]) + 1)
61 self.text = self.text[0:self.currPos] + newNumber + self.text[self.currPos + 1:]
65 if self.text[self.currPos] == "0":
68 newNumber = str(int(self.text[self.currPos]) - 1)
69 self.text = self.text[0:self.currPos] + newNumber + self.text[self.currPos + 1:]
72 def number(self, number):
73 if self.type == self.TEXT:
74 newChar = self.numericalTextInput.getKey(number)
75 elif self.type == self.PIN or self.type == self.NUMBER:
77 self.text = self.text[0:self.currPos] + newChar + self.text[self.currPos + 1:]
78 if self.type == self.PIN or self.type == self.NUMBER: