diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-08-23 23:53:30 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-08-23 23:53:30 +0000 |
| commit | e09309bd7f69dbc98f471e28e01e2ad21ab7a757 (patch) | |
| tree | 21af9921d44c9345cb47a204719f08f4b56aa728 /lib/python/Components/Input.py | |
| parent | faad4b5742736187c288a274a10bc28dd6f96f60 (diff) | |
| download | enigma2-e09309bd7f69dbc98f471e28e01e2ad21ab7a757.tar.gz enigma2-e09309bd7f69dbc98f471e28e01e2ad21ab7a757.zip | |
use uncode for textinput component
Diffstat (limited to 'lib/python/Components/Input.py')
| -rw-r--r-- | lib/python/Components/Input.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py index e27ef524..e7713d6d 100644 --- a/lib/python/Components/Input.py +++ b/lib/python/Components/Input.py @@ -2,48 +2,46 @@ from HTMLComponent import * from GUIComponent import * from VariableText import * -from enigma import eLabel, isUTF8, convertUTF8DVB, convertDVBUTF8 +from enigma import eLabel from Tools.NumericalTextInput import NumericalTextInput class Input(VariableText, HTMLComponent, GUIComponent): TEXT = 0 PIN = 1 - NUMBER = 2 + NUMBER = 2 def __init__(self, text="", maxSize = False, type = TEXT): GUIComponent.__init__(self) VariableText.__init__(self) - self.table = 0 - self.numericalTextInput = NumericalTextInput(self.right) self.type = type self.maxSize = maxSize self.currPos = 0 - self.Text = text self.overwrite = 0 - self.update() + self.numericalTextInput = NumericalTextInput(self.right) + self.setText(text) def update(self): self.setMarkedPos(self.currPos) if self.type == self.PIN: - self.message = "*" * len(self.Text) + self.text = "*" * len(self.Text) else: - self.message = convertDVBUTF8(self.Text, self.table) - if self.instance: - self.instance.setText(self.message) + self.text = self.Text.encode("utf-8") def setText(self, text): if not len(text): self.currPos = 0 - self.Text = "" - elif isUTF8(text): - self.Text = convertUTF8DVB(text, self.table) + self.Text = u"" else: - self.Text = text + try: + self.Text = text.decode("utf-8") + except UnicodeDecodeError: + print "utf8 kaputt!" + self.Text = text self.update() def getText(self): - return convertDVBUTF8(self.Text, self.table) + return self.Text.encode("utf-8") def createWidget(self, parent): return eLabel(parent, self.currPos) @@ -115,7 +113,7 @@ class Input(VariableText, HTMLComponent, GUIComponent): self.update() def handleAscii(self, code): - newChar = chr(code) + newChar = unichr(code) if self.overwrite==1: self.Text = self.Text[0:self.currPos] + newChar + self.Text[self.currPos + 1:] else: |
