aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/config.py
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-08-24 12:16:56 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-08-24 12:16:56 +0000
commit65e19746f08f1287005861692322cdf868b06dc6 (patch)
tree67674e5b2a111f7674f80b3957e10358b914b5d5 /lib/python/Components/config.py
parente09309bd7f69dbc98f471e28e01e2ad21ab7a757 (diff)
downloadenigma2-65e19746f08f1287005861692322cdf868b06dc6.tar.gz
enigma2-65e19746f08f1287005861692322cdf868b06dc6.zip
some NumericalInput and uncode/utf-8 fixes
Diffstat (limited to 'lib/python/Components/config.py')
-rw-r--r--lib/python/Components/config.py39
1 files changed, 19 insertions, 20 deletions
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