Skip to content

Commit

Permalink
[InputBox] add VirtualKeyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Huevos committed Dec 1, 2022
1 parent a9e98d1 commit d31adc2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/python/Screens/InputBox.py
Expand Up @@ -2,6 +2,7 @@
from Screens.HelpMenu import HelpableScreen
from Screens.MessageBox import MessageBox
from Screens.Screen import Screen
from Screens.VirtualKeyBoard import VirtualKeyBoard
from Components.ActionMap import HelpableNumberActionMap
from Components.config import config
from Components.Input import Input
Expand All @@ -18,6 +19,7 @@ def __init__(self, session, title="", windowTitle=None, useableChars=None, **kwa

self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("Save"))
self["key_text"] = StaticText(_("TEXT"))
self["text"] = Label(title)
self["input"] = Input(**kwargs)

Expand All @@ -29,8 +31,9 @@ def __init__(self, session, title="", windowTitle=None, useableChars=None, **kwa
if useableChars is not None:
self["input"].setUseableChars(useableChars)

self["actions"] = HelpableNumberActionMap(self, ["WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions", "ColorActions"],
self["actions"] = HelpableNumberActionMap(self, ["WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions", "ColorActions", "VirtualKeyboardActions"],
{
"showVirtualKeyboard": (self.keyText, _("Open VirtualKeyboard")),
"gotAsciiCode": (self.gotAsciiCode, _("Handle ASCII")),
"green": (self.go, _("Save")),
"ok": (self.go, _("Save")),
Expand Down Expand Up @@ -97,6 +100,14 @@ def keyTab(self):
def keyInsert(self):
self["input"].toggleOverwrite()

def keyText(self):
self.session.openWithCallback(self.VirtualKeyBoardCallback, VirtualKeyBoard, title=self["text"].text, text=self["input"].getText())

def VirtualKeyBoardCallback(self, callback=None):
if callback is not None and len(callback):
self["input"].setText(callback)
self.keyEnd()


class PinInput(InputBox):
def __init__(self, session, service="", triesEntry=None, pinList=None, popup=False, simple=True, *args, **kwargs):
Expand Down

0 comments on commit d31adc2

Please sign in to comment.