2 from Screens.Screen import Screen
3 from Screens.MessageBox import MessageBox
4 from Components.ActionMap import NumberActionMap
5 from Components.Label import Label
6 from Components.Input import Input
7 from Components.GUIComponent import *
11 class InputBox(Screen):
12 def __init__(self, session, title = "", **kwargs):
13 Screen.__init__(self, session)
15 self["text"] = Label(title)
16 self["input"] = Input(**kwargs)
18 self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions", "InputAsciiActions"],
20 "gotAsciiCode": self.gotAsciiCode,
24 "right": self.keyRight,
25 "delete": self.keyDelete,
26 "1": self.keyNumberGlobal,
27 "2": self.keyNumberGlobal,
28 "3": self.keyNumberGlobal,
29 "4": self.keyNumberGlobal,
30 "5": self.keyNumberGlobal,
31 "6": self.keyNumberGlobal,
32 "7": self.keyNumberGlobal,
33 "8": self.keyNumberGlobal,
34 "9": self.keyNumberGlobal,
35 "0": self.keyNumberGlobal
37 rcinput = eRCInput.getInstance()
38 rcinput.setKeyboardMode(rcinput.kmAscii)
40 def gotAsciiCode(self):
41 self["input"].handleAscii(getPrevAsciiCode())
49 def keyNumberGlobal(self, number):
50 self["input"].number(number)
53 self["input"].delete()
56 rcinput = eRCInput.getInstance()
57 rcinput.setKeyboardMode(rcinput.kmNone)
58 self.close(self["input"].getText())
61 rcinput = eRCInput.getInstance()
62 rcinput.setKeyboardMode(rcinput.kmNone)