X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/96a171a3f8daf3ebae2990c1bfa10bdeb0c5e87c..958cfa17e6c409ffadf945101dc104923ec5d418:/lib/python/Screens/InputBox.py diff --git a/lib/python/Screens/InputBox.py b/lib/python/Screens/InputBox.py index fe21ea0a..13797687 100644 --- a/lib/python/Screens/InputBox.py +++ b/lib/python/Screens/InputBox.py @@ -8,12 +8,14 @@ from Tools.BoundFunction import boundFunction from time import time class InputBox(Screen): - def __init__(self, session, title = "", windowTitle = _("Input"), **kwargs): + def __init__(self, session, title = "", windowTitle = _("Input"), useableChars = None, **kwargs): Screen.__init__(self, session) self["text"] = Label(title) self["input"] = Input(**kwargs) self.onShown.append(boundFunction(self.setTitle, windowTitle)) + if useableChars is not None: + self["input"].setUseableChars(useableChars) self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions"], { @@ -22,15 +24,12 @@ class InputBox(Screen): "back": self.cancel, "left": self.keyLeft, "right": self.keyRight, - "moveLeft": self.keyLeft, - "moveRight": self.keyRight, - "moveHome": self.keyHome, - "moveEnd": self.keyEnd, + "home": self.keyHome, + "end": self.keyEnd, "deleteForward": self.keyDelete, "deleteBackward": self.keyBackspace, "tab": self.keyTab, "toggleOverwrite": self.keyInsert, - "accept": self.go, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, @@ -42,8 +41,11 @@ class InputBox(Screen): "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) - rcinput = eRCInput.getInstance() - rcinput.setKeyboardMode(rcinput.kmAscii) + + if self["input"].type == Input.TEXT: + self.onShow.append(self.setKeyboardModeAscii) + else: + self.onShow.append(self.setKeyboardModeNone) def gotAsciiCode(self): self["input"].handleAscii(getPrevAsciiCode()) @@ -61,13 +63,9 @@ class InputBox(Screen): self["input"].delete() def go(self): - rcinput = eRCInput.getInstance() - rcinput.setKeyboardMode(rcinput.kmNone) self.close(self["input"].getText()) def cancel(self): - rcinput = eRCInput.getInstance() - rcinput.setKeyboardMode(rcinput.kmNone) self.close(None) def keyHome(self): @@ -101,7 +99,7 @@ class PinInput(InputBox): remaining = (self.triesEntry.time.value + (self.waitTime * 60)) - time() remainingMinutes = int(remaining / 60) remainingSeconds = int(remaining % 60) - self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.closePinCancel, MessageBox, _("You have to wait for") + " " + str(remainingMinutes) + " " + _("minutes and") + " " + str(remainingSeconds) + " " + _("seconds."), MessageBox.TYPE_ERROR)) + self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.closePinCancel, MessageBox, _("You have to wait %s!") % (str(remainingMinutes) + " " + _("minutes") + ", " + str(remainingSeconds) + " " + _("seconds")), MessageBox.TYPE_ERROR)) else: self.setTries(3) @@ -142,19 +140,13 @@ class PinInput(InputBox): pass def closePinWrong(self, *args): - rcinput = eRCInput.getInstance() - rcinput.setKeyboardMode(rcinput.kmNone) print "args:", args self.close(False) def closePinCorrect(self, *args): - rcinput = eRCInput.getInstance() - rcinput.setKeyboardMode(rcinput.kmNone) self.close(True) def closePinCancel(self, *args): - rcinput = eRCInput.getInstance() - rcinput.setKeyboardMode(rcinput.kmNone) self.close(None) def cancel(self):