X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FScreens%2FInputBox.py;h=61ce356aa724aa32cee7a8acabe7a80805d74137;hp=55334d2f7f2c00e6dd38920b8bb0a770fffb3135;hb=3a4d44ac0f28fa87f1d8cde20b5e38dd644d5b37;hpb=76ab06c06bdf77f0b0cecd225367862ef0de0d2f diff --git a/lib/python/Screens/InputBox.py b/lib/python/Screens/InputBox.py index 55334d2..61ce356 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,9 @@ class InputBox(Screen): "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) - rcinput = eRCInput.getInstance() - rcinput.setKeyboardMode(rcinput.kmAscii) + if self["input"].type == Input.TEXT: + rcinput = eRCInput.getInstance() + rcinput.setKeyboardMode(rcinput.kmAscii) def gotAsciiCode(self): self["input"].handleAscii(getPrevAsciiCode()) @@ -101,13 +101,20 @@ 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) self["tries"] = Label("") self.onShown.append(self.showTries) + def gotAsciiCode(self): + if self["input"].currPos == len(self["input"]) - 1: + InputBox.gotAsciiCode(self) + self.go() + else: + InputBox.gotAsciiCode(self) + def keyNumberGlobal(self, number): if self["input"].currPos == len(self["input"]) - 1: InputBox.keyNumberGlobal(self, number)