aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Input.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/Components/Input.py')
-rw-r--r--lib/python/Components/Input.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py
new file mode 100644
index 00000000..d3b06612
--- /dev/null
+++ b/lib/python/Components/Input.py
@@ -0,0 +1,46 @@
+from HTMLComponent import *
+from GUIComponent import *
+from VariableText import *
+
+from enigma import eLabel
+
+from Tools.NumericalTextInput import NumericalTextInput
+
+class Input(HTMLComponent, GUIComponent, VariableText):
+ def __init__(self, text=""):
+ GUIComponent.__init__(self)
+ VariableText.__init__(self)
+ self.numericalTextInput = NumericalTextInput(self.right)
+ self.currPos = 0
+ self.text = text
+ self.update()
+
+ def update(self):
+ self.setText(self.text[0:self.currPos] + "_" + self.text[self.currPos] + "_" + self.text[self.currPos + 1:])
+
+ def createWidget(self, parent):
+ return eLabel(parent)
+
+ def getSize(self):
+ s = self.instance.calculateSize()
+ return (s.width(), s.height())
+
+ def right(self):
+ self.currPos += 1
+ if self.currPos == len(self.text):
+ self.text = self.text + " "
+ self.update()
+
+ def left(self):
+ self.currPos -= 1
+ self.update()
+
+ def number(self, number):
+ self.text = self.text[0:self.currPos] + self.numericalTextInput.getKey(number) + self.text[self.currPos + 1:]
+ self.update()
+
+ def show(self):
+ self.instance.show()
+
+ def hide(self):
+ self.instance.hide() \ No newline at end of file