aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens/VirtualKeyBoard.py
diff options
context:
space:
mode:
authorMladen Horvat <acid-burn@opendreambox.org>2011-04-19 11:54:22 +0200
committerMladen Horvat <acid-burn@opendreambox.org>2011-04-19 11:54:22 +0200
commitd3c621480a77115a11fea85742ca85ae163c0d4b (patch)
treed9f207f5bd641fa6c1d1a898b73f5e14b37dddb7 /lib/python/Screens/VirtualKeyBoard.py
parentff51af1d6d5547b8e8be08bd5660598e02a56eb6 (diff)
downloadenigma2-d3c621480a77115a11fea85742ca85ae163c0d4b.tar.gz
enigma2-d3c621480a77115a11fea85742ca85ae163c0d4b.zip
VirtualKeyBoard.py: add modified patch from Homey to allow keyboard inputs. refs #750
Diffstat (limited to 'lib/python/Screens/VirtualKeyBoard.py')
-rwxr-xr-xlib/python/Screens/VirtualKeyBoard.py39
1 files changed, 35 insertions, 4 deletions
diff --git a/lib/python/Screens/VirtualKeyBoard.py b/lib/python/Screens/VirtualKeyBoard.py
index fc10a882..ebc347c6 100755
--- a/lib/python/Screens/VirtualKeyBoard.py
+++ b/lib/python/Screens/VirtualKeyBoard.py
@@ -1,4 +1,6 @@
# -*- coding: UTF-8 -*-
+from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_CENTER, RT_VALIGN_CENTER, getPrevAsciiCode
+from Screen import Screen
from Components.Language import language
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
@@ -6,8 +8,6 @@ from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.MenuList import MenuList
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
-from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_CENTER, RT_VALIGN_CENTER
-from Screen import Screen
from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
from Tools.LoadPixmap import LoadPixmap
@@ -97,8 +97,9 @@ class VirtualKeyBoard(Screen):
self["text"] = Label(self.text)
self["list"] = VirtualKeyBoardList([])
- self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions"],
+ self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions"],
{
+ "gotAsciiCode": self.keyGotAscii,
"ok": self.okClicked,
"cancel": self.exit,
"left": self.left,
@@ -107,9 +108,12 @@ class VirtualKeyBoard(Screen):
"down": self.down,
"red": self.backClicked,
"green": self.ok,
- "yellow": self.switchLang
+ "yellow": self.switchLang,
+ "deleteBackward": self.backClicked,
+ "back": self.exit
}, -2)
self.setLanq()
+ self.onExecBegin.append(self.setKeyboardModeAscii)
self.onLayoutFinish.append(self.buildVirtualKeyBoard)
def switchLang(self):
@@ -362,3 +366,30 @@ class VirtualKeyBoard(Screen):
def showActiveKey(self):
self.buildVirtualKeyBoard(self.selectedKey)
+
+ def inShiftKeyList(self,key):
+ for KeyList in self.shiftkeys_list:
+ for char in KeyList:
+ if char == key:
+ return True
+ return False
+
+ def keyGotAscii(self):
+ char = str(unichr(getPrevAsciiCode()).encode('utf-8'))
+ if self.inShiftKeyList(char):
+ self.shiftMode = True
+ list = self.shiftkeys_list
+ else:
+ self.shiftMode = False
+ list = self.keys_list
+
+ selkey = 0
+ for keylist in list:
+ for key in keylist:
+ if key == char:
+ self.selectedKey = selkey
+ self.okClicked()
+ self.showActiveKey()
+ return
+ else:
+ selkey += 1