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)
31 self.instance.setText(self.message)
33 def setText(self, text):
42 def createWidget(self, parent):
43 return eLabel(parent, self.currPos)
46 s = self.instance.calculateSize()
47 return (s.width(), s.height())
51 if self.currPos == len(self.text):
55 self.text = self.text + " "
65 if self.text[self.currPos] == "9" or self.text[self.currPos] == " ":
68 newNumber = str(int(self.text[self.currPos]) + 1)
69 self.text = self.text[0:self.currPos] + newNumber + self.text[self.currPos + 1:]
73 if self.text[self.currPos] == "0" or self.text[self.currPos] == " ":
76 newNumber = str(int(self.text[self.currPos]) - 1)
78 self.text = self.text[0:self.currPos] + newNumber + self.text[self.currPos + 1:]
82 self.text = self.text[:self.currPos] + self.text[self.currPos + 1:]
85 def handleAscii(self, code):
87 self.text = self.text[0:self.currPos] + newChar + self.text[self.currPos + 1:]
91 def number(self, number):
92 if self.type == self.TEXT:
93 newChar = self.numericalTextInput.getKey(number)
94 elif self.type == self.PIN or self.type == self.NUMBER:
96 self.text = self.text[0:self.currPos] + newChar + self.text[self.currPos + 1:]
97 if self.type == self.PIN or self.type == self.NUMBER: