git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
immediately apply to new downstream connections (ConditionalShowHide is a bit special...
[enigma2.git]
/
lib
/
python
/
Components
/
Input.py
diff --git
a/lib/python/Components/Input.py
b/lib/python/Components/Input.py
index b140ef516a7836026c3ac801e63c90234cd1a1cd..e0a7f44972549c961c9f116fff5597cfefcec5ef 100644
(file)
--- a/
lib/python/Components/Input.py
+++ b/
lib/python/Components/Input.py
@@
-1,47
+1,50
@@
-from HTMLComponent import
*
-from GUIComponent import
*
-from VariableText import
*
+from HTMLComponent import
HTMLComponent
+from GUIComponent import
GUIComponent
+from VariableText import
VariableText
-from enigma import eLabel
, isUTF8, convertUTF8DVB, convertDVBUTF8
+from enigma import eLabel
from Tools.NumericalTextInput import NumericalTextInput
from Tools.NumericalTextInput import NumericalTextInput
-class Input(VariableText, HTMLComponent, GUIComponent):
+class Input(VariableText, HTMLComponent, GUIComponent
, NumericalTextInput
):
TEXT = 0
PIN = 1
TEXT = 0
PIN = 1
- NUMBER = 2
-
+ NUMBER = 2
+
def __init__(self, text="", maxSize = False, type = TEXT):
def __init__(self, text="", maxSize = False, type = TEXT):
+ NumericalTextInput.__init__(self, self.right)
GUIComponent.__init__(self)
VariableText.__init__(self)
GUIComponent.__init__(self)
VariableText.__init__(self)
- self.numericalTextInput = NumericalTextInput(self.right)
self.type = type
self.maxSize = maxSize
self.currPos = 0
self.type = type
self.maxSize = maxSize
self.currPos = 0
- self.Text = text
self.overwrite = 0
self.overwrite = 0
- self.update()
+ self.setText(text)
+
+ def __len__(self):
+ return len(self.text)
+
def update(self):
self.setMarkedPos(self.currPos)
if self.type == self.PIN:
def update(self):
self.setMarkedPos(self.currPos)
if self.type == self.PIN:
- self.
message
= "*" * len(self.Text)
+ self.
text
= "*" * len(self.Text)
else:
else:
- self.message = convertDVBUTF8(self.Text, 0)
- 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
def setText(self, text):
if not len(text):
self.currPos = 0
- self.Text = ""
- elif isUTF8(text):
- self.Text = convertUTF8DVB(text, 0)
+ self.Text = u""
else:
else:
- self.Text = text
+ try:
+ self.Text = text.decode("utf-8")
+ except UnicodeDecodeError:
+ print "utf8 kaputt!"
+ self.Text = text
self.update()
def getText(self):
self.update()
def getText(self):
- return
convertDVBUTF8(self.Text, 0
)
+ return
self.Text.encode("utf-8"
)
def createWidget(self, parent):
return eLabel(parent, self.currPos)
def createWidget(self, parent):
return eLabel(parent, self.currPos)
@@
-87,7
+90,7
@@
class Input(VariableText, HTMLComponent, GUIComponent):
def end(self):
self.currPos = len(self.Text) - 1
self.update()
def end(self):
self.currPos = len(self.Text) - 1
self.update()
-
+
def tab(self):
if self.currPos == len(self.Text) - 1:
self.Text=self.Text+ " "
def tab(self):
if self.currPos == len(self.Text) - 1:
self.Text=self.Text+ " "
@@
-95,11
+98,11
@@
class Input(VariableText, HTMLComponent, GUIComponent):
else:
self.Text = self.Text[0:self.currPos] + " " + self.Text[self.currPos:]
self.update()
else:
self.Text = self.Text[0:self.currPos] + " " + self.Text[self.currPos:]
self.update()
-
+
def delete(self):
self.Text = self.Text[:self.currPos] + self.Text[self.currPos + 1:]
self.update()
def delete(self):
self.Text = self.Text[:self.currPos] + self.Text[self.currPos + 1:]
self.update()
-
+
def toggleOverwrite(self):
if self.overwrite==1:
self.overwrite=0
def toggleOverwrite(self):
if self.overwrite==1:
self.overwrite=0
@@
-113,7
+116,7
@@
class Input(VariableText, HTMLComponent, GUIComponent):
self.update()
def handleAscii(self, code):
self.update()
def handleAscii(self, code):
- newChar = chr(code)
+ newChar =
uni
chr(code)
if self.overwrite==1:
self.Text = self.Text[0:self.currPos] + newChar + self.Text[self.currPos + 1:]
else:
if self.overwrite==1:
self.Text = self.Text[0:self.currPos] + newChar + self.Text[self.currPos + 1:]
else:
@@
-122,7
+125,7
@@
class Input(VariableText, HTMLComponent, GUIComponent):
def number(self, number):
if self.type == self.TEXT:
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:]
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:]