aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-06-07 15:31:51 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-06-07 15:31:51 +0000
commitfce04ebed510a97e17f019a35c327dce78b6d916 (patch)
treeca21275f30cedcd9e2b7627dea7a0e5d9f27d812 /lib/python
parent45442377fc854e7224605085375e75f958aa5722 (diff)
downloadenigma2-fce04ebed510a97e17f019a35c327dce78b6d916.tar.gz
enigma2-fce04ebed510a97e17f019a35c327dce78b6d916.zip
more work on keyboard support
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Input.py13
-rw-r--r--lib/python/Screens/InputBox.py16
-rw-r--r--lib/python/enigma_python.i2
3 files changed, 25 insertions, 6 deletions
diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py
index 0bd13059..311e42a9 100644
--- a/lib/python/Components/Input.py
+++ b/lib/python/Components/Input.py
@@ -50,8 +50,9 @@ class Input(VariableText, HTMLComponent, GUIComponent):
self.update()
def left(self):
- self.currPos -= 1
- self.update()
+ if self.currPos > 0:
+ self.currPos -= 1
+ self.update()
def up(self):
if self.text[self.currPos] == "9" or self.text[self.currPos] == " ":
@@ -73,7 +74,13 @@ class Input(VariableText, HTMLComponent, GUIComponent):
def delete(self):
self.text = self.text[:self.currPos] + self.text[self.currPos + 1:]
self.update()
-
+
+ def handleAscii(self, code):
+ newChar = chr(code)
+ self.text = self.text[0:self.currPos] + newChar + self.text[self.currPos + 1:]
+ self.right()
+ self.update()
+
def number(self, number):
if self.type == self.TEXT:
newChar = self.numericalTextInput.getKey(number)
diff --git a/lib/python/Screens/InputBox.py b/lib/python/Screens/InputBox.py
index 47b800df..f3f97752 100644
--- a/lib/python/Screens/InputBox.py
+++ b/lib/python/Screens/InputBox.py
@@ -15,8 +15,9 @@ class InputBox(Screen):
self["text"] = Label(title)
self["input"] = Input(**kwargs)
- self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions"],
+ self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions", "AsciiActions"],
{
+ "gotAsciiCode": self.gotAsciiCode,
"ok": self.go,
"back": self.cancel,
"left": self.keyLeft,
@@ -33,7 +34,12 @@ class InputBox(Screen):
"9": self.keyNumberGlobal,
"0": self.keyNumberGlobal
}, -1)
-
+ rcinput = eRCInput.getInstance()
+ rcinput.setKeyboardMode(rcinput.kmAscii)
+
+ def gotAsciiCode(self):
+ self["input"].handleAscii(getPrevAsciiCode())
+
def keyLeft(self):
self["input"].left()
@@ -47,7 +53,11 @@ class InputBox(Screen):
self["input"].delete()
def go(self):
+ rcinput = eRCInput.getInstance()
+ rcinput.setKeyboardMode(rcinput.kmNone)
self.close(self["input"].getText())
def cancel(self):
- self.close(None) \ No newline at end of file
+ rcinput = eRCInput.getInstance()
+ rcinput.setKeyboardMode(rcinput.kmNone)
+ self.close(None)
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
index ce776320..06d84473 100644
--- a/lib/python/enigma_python.i
+++ b/lib/python/enigma_python.i
@@ -94,6 +94,7 @@ extern void quitMainloop(int exit_code);
extern eApplication *getApplication();
extern PSignal1<void,int> &keyPressedSignal();
+extern int getPrevAsciiCode();
%}
%feature("ref") iObject "$this->AddRef(); /* eDebug(\"AddRef (%s:%d)!\", __FILE__, __LINE__); */ "
@@ -254,6 +255,7 @@ void addFont(const char *filename, const char *alias, int scale_factor, int is_r
/************** debug **************/
+int getPrevAsciiCode();
void runMainloop();
void quitMainloop(int exit_code);
eApplication *getApplication();