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(VariableText, HTMLComponent, GUIComponent):
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" or self.text[self.currPos] == " ":
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" or self.text[self.currPos] == " ":
68 newNumber = str(int(self.text[self.currPos]) - 1)
70 self.text = self.text[0:self.currPos] + newNumber + self.text[self.currPos + 1:]
74 self.text = self.text[:self.currPos] + self.text[self.currPos + 1:]
77 def number(self, number):
78 if self.type == self.TEXT:
79 newChar = self.numericalTextInput.getKey(number)
80 elif self.type == self.PIN or self.type == self.NUMBER:
82 self.text = self.text[0:self.currPos] + newChar + self.text[self.currPos + 1:]
83 if self.type == self.PIN or self.type == self.NUMBER: