X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/22d418a23b2792bb89fe6974fe24b01aba126a56..71dd5b32ca9f94f1a35ff6e82671d89642fec23b:/lib/python/Screens/VirtualKeyBoard.py diff --git a/lib/python/Screens/VirtualKeyBoard.py b/lib/python/Screens/VirtualKeyBoard.py index fc10a882..a8695439 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,17 +108,20 @@ 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.setLang() + self.onExecBegin.append(self.setKeyboardModeAscii) self.onLayoutFinish.append(self.buildVirtualKeyBoard) def switchLang(self): self.lang = self.nextLang - self.setLanq() + self.setLang() self.buildVirtualKeyBoard() - def setLanq(self): + def setLang(self): if self.lang == 'de_DE': self.keys_list = [ [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], @@ -362,3 +366,33 @@ 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 + + if char == " ": + char = "SPACE" + + selkey = 0 + for keylist in list: + for key in keylist: + if key == char: + self.selectedKey = selkey + self.okClicked() + self.showActiveKey() + return + else: + selkey += 1