speedup opening of long movielists
[enigma2.git] / lib / python / Screens / InputBox.py
1 from enigma import *
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 *
8
9 import os
10
11 class InputBox(Screen):
12         def __init__(self, session, title = "", **kwargs):
13                 Screen.__init__(self, session)
14
15                 self["text"] = Label(title)
16                 self["input"] = Input(**kwargs)
17                                 
18                 self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions"], 
19                 {
20                         "ok": self.go,
21                         "back": self.cancel,
22                         "left": self.keyLeft,
23                         "right": self.keyRight,
24                         "delete": self.keyDelete,
25                         "1": self.keyNumberGlobal,
26                         "2": self.keyNumberGlobal,
27                         "3": self.keyNumberGlobal,
28                         "4": self.keyNumberGlobal,
29                         "5": self.keyNumberGlobal,
30                         "6": self.keyNumberGlobal,
31                         "7": self.keyNumberGlobal,
32                         "8": self.keyNumberGlobal,
33                         "9": self.keyNumberGlobal,
34                         "0": self.keyNumberGlobal
35                 }, -1)
36                 
37         def keyLeft(self):
38                 self["input"].left()
39         
40         def keyRight(self):
41                 self["input"].right()
42         
43         def keyNumberGlobal(self, number):
44                 self["input"].number(number)
45                 
46         def keyDelete(self):
47                 self["input"].delete()
48                 
49         def go(self):
50                 self.close(self["input"].getText())
51                 
52         def cancel(self):
53                 self.close(None)