aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Input.py6
-rw-r--r--lib/python/Components/config.py39
2 files changed, 22 insertions, 23 deletions
diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py
index e7713d6d..710ad0bc 100644
--- a/lib/python/Components/Input.py
+++ b/lib/python/Components/Input.py
@@ -6,19 +6,19 @@ from enigma import eLabel
from Tools.NumericalTextInput import NumericalTextInput
-class Input(VariableText, HTMLComponent, GUIComponent):
+class Input(VariableText, HTMLComponent, GUIComponent, NumericalTextInput):
TEXT = 0
PIN = 1
NUMBER = 2
def __init__(self, text="", maxSize = False, type = TEXT):
+ NumericalTextInput.__init__(self, self.right)
GUIComponent.__init__(self)
VariableText.__init__(self)
self.type = type
self.maxSize = maxSize
self.currPos = 0
self.overwrite = 0
- self.numericalTextInput = NumericalTextInput(self.right)
self.setText(text)
def update(self):
@@ -122,7 +122,7 @@ class Input(VariableText, HTMLComponent, GUIComponent):
def number(self, number):
if self.type == self.TEXT:
- newChar = self.numericalTextInput.getKey(number)
+ newChar = self.getKey(number)
elif self.type == self.PIN or self.type == self.NUMBER:
newChar = str(number)
self.Text = self.Text[0:self.currPos] + newChar + self.Text[self.currPos + 1:]
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py
index c17e5aa1..7478653c 100644
--- a/lib/python/Components/config.py
+++ b/lib/python/Components/config.py
@@ -1,5 +1,5 @@
from time import *
-from Tools.NumericalTextInput import *
+from Tools.NumericalTextInput import NumericalTextInput
from Tools.Directories import *
class configFile:
@@ -335,30 +335,34 @@ class configNothing:
def __call__(self, selected): #needed by configlist
return ("text", "")
-class configText:
+class configText(NumericalTextInput):
# used as first parameter
# is the text of a fixed size or is the user able to extend the length of the text
extendableSize = 1
fixedSize = 2
def __init__(self, parent):
+ NumericalTextInput.__init__(self, self.nextEntry)
self.parent = parent
self.markedPos = 0
self.mode = self.parent.vals[0]
- self.textInput = NumericalTextInput(self.nextEntry)
+ try:
+ self.parent.value = self.parent.value.decode("utf-8")
+ except UnicodeDecodeError:
+ print "utf8 kaputt!"
def checkValues(self):
if (self.markedPos < 0):
self.markedPos = 0
if (self.markedPos >= len(self.parent.value)):
self.markedPos = len(self.parent.value) - 1
-
+
def cancel(self):
self.parent.reload()
def save(self):
self.parent.save()
-
+
def nextEntry(self):
self.parent.vals[1](self.parent.getConfigPath())
@@ -367,30 +371,25 @@ class configText:
#so we can handle it here in gui element
if key == config.key["delete"]:
self.parent.value = self.parent.value[0:self.markedPos] + self.parent.value[self.markedPos + 1:]
- if key == config.key["prevElement"]:
- self.textInput.nextKey()
+ elif key == config.key["prevElement"]:
+ self.nextKey()
self.markedPos -= 1
-
- if key == config.key["nextElement"]:
- self.textInput.nextKey()
+ elif key == config.key["nextElement"]:
+ self.nextKey()
self.markedPos += 1
if (self.mode == self.extendableSize):
if (self.markedPos >= len(self.parent.value)):
self.parent.value = self.parent.value.ljust(len(self.parent.value) + 1)
-
-
- if key >= config.key["0"] and key <= config.key["9"]:
+ elif key >= config.key["0"] and key <= config.key["9"]:
number = 9 - config.key["9"] + key
+ self.parent.value = self.parent.value[0:self.markedPos] + self.getKey(number) + self.parent.value[self.markedPos + 1:]
- self.parent.value = self.parent.value[0:self.markedPos] + str(self.textInput.getKey(number)) + self.parent.value[self.markedPos + 1:]
-
- self.checkValues()
-
- self.parent.change()
+ self.checkValues()
+ self.parent.change()
def __call__(self, selected): #needed by configlist
- return ("mtext"[1-selected:], str(self.parent.value), [self.markedPos])
-
+ return ("mtext"[1-selected:], self.parent.value.encode("utf-8"), [self.markedPos])
+
class configValue:
def __init__(self, obj):
self.obj = obj