From: kos Date: Mon, 9 Jan 2012 07:41:54 +0000 (+0900) Subject: fix rc-keyboard. X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=7432d2553c305b2f292e5d6fcc08d5777cae44ad fix rc-keyboard. --- diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py index 4d3c8a1..017d109 100644 --- a/lib/python/Components/Input.py +++ b/lib/python/Components/Input.py @@ -225,7 +225,12 @@ class Input(VariableText, HTMLComponent, GUIComponent, NumericalTextInput): if self.allmarked: self.deleteAllChars() self.allmarked = False - self.insertChar(unichr(code), self.currPos, False, False); + #self.insertChar(unichr(code), self.currPos, False, False); + from Components.config import getCharValue + newcode = getCharValue(code) + if newcode is None: + return + self.insertChar(newcode, self.currPos, False, False); self.innerright() self.update() diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 2090aee..090faf2 100644 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -1581,8 +1581,9 @@ class IPKGSource(Screen): else: self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions", "InputAsciiActions"], { + "gotAsciiCode": self.gotAsciiCode, "ok": self.go, "back": self.close, "red": self.close, @@ -1607,6 +1608,9 @@ class IPKGSource(Screen): self.onLayoutFinish.append(self.layoutFinished) + def gotAsciiCode(self): + self["text"].handleAscii(getPrevAsciiCode()) + def layoutFinished(self): self.setWindowTitle() self["text"].right() @@ -1728,7 +1732,13 @@ class PacketManager(Screen, NumericalTextInput): self.setNextIdx(keyvalue[0]) def keyGotAscii(self): - keyvalue = unichr(getPrevAsciiCode()).encode("utf-8") + from Components.config import getCharValue + unichar = getCharValue(getPrevAsciiCode()) + if unichar is None: + return + if len(str(unichar)) > 1: + return + keyvalue = unichar.encode("utf-8") if len(keyvalue) == 1: self.setNextIdx(keyvalue[0]) diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 912d678..688fe50 100755 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -1074,7 +1074,13 @@ class ChannelSelectionBase(Screen): self.servicelist.moveToChar(charstr[0]) def keyAsciiCode(self): - unichar = unichr(getPrevAsciiCode()) + #unichar = unichr(getPrevAsciiCode()) + from Components.config import getCharValue + unichar = getCharValue(getPrevAsciiCode()) + if unichar is None: + return + if len(str(unichar)) > 1: + return charstr = unichar.encode("utf-8") if len(charstr) == 1: self.servicelist.moveToChar(charstr[0]) diff --git a/lib/python/Screens/VirtualKeyBoard.py b/lib/python/Screens/VirtualKeyBoard.py index a869543..a2710df 100755 --- a/lib/python/Screens/VirtualKeyBoard.py +++ b/lib/python/Screens/VirtualKeyBoard.py @@ -232,19 +232,21 @@ class VirtualKeyBoard(Screen): if self.shiftMode: self.k_list = self.shiftkeys_list for keys in self.k_list: - if selectedKey < 12 and selectedKey > -1: + keyslen = len(keys) + if selectedKey < keyslen and selectedKey > -1: list.append(VirtualKeyBoardEntryComponent(keys, selectedKey,True)) else: list.append(VirtualKeyBoardEntryComponent(keys, -1,True)) - selectedKey -= 12 + selectedKey -= keyslen else: self.k_list = self.keys_list for keys in self.k_list: - if selectedKey < 12 and selectedKey > -1: + keyslen = len(keys) + if selectedKey < keyslen and selectedKey > -1: list.append(VirtualKeyBoardEntryComponent(keys, selectedKey)) else: list.append(VirtualKeyBoardEntryComponent(keys, -1)) - selectedKey -= 12 + selectedKey -= keyslen self["list"].setList(list) @@ -263,12 +265,13 @@ class VirtualKeyBoard(Screen): text = None for x in list: - if selectedKey < 12: + xlen = len(x) + if selectedKey < xlen: if selectedKey < len(x): text = x[selectedKey] break else: - selectedKey -= 12 + selectedKey -= xlen if text is None: return @@ -375,7 +378,11 @@ class VirtualKeyBoard(Screen): return False def keyGotAscii(self): - char = str(unichr(getPrevAsciiCode()).encode('utf-8')) + #char = str(unichr(getPrevAsciiCode()).encode('utf-8')) + from Components.config import getCharValue + char = getCharValue(getPrevAsciiCode()) + if len(str(char)) == 1: + char = char.encode("utf-8") if self.inShiftKeyList(char): self.shiftMode = True list = self.shiftkeys_list