fix typo and resize text in image upgrade wizard
[enigma2.git] / lib / python / Screens / ChoiceBox.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.MenuList import MenuList
7 from Components.GUIComponent import *
8
9 import os
10
11 class ChoiceBox(Screen):
12         def __init__(self, session, title = "", list = []):
13                 Screen.__init__(self, session)
14
15                 self["text"] = Label(title)
16                 self.list = list
17                 self["list"] = MenuList(list)
18                                 
19                 self["actions"] = NumberActionMap(["WizardActions", "InputActions"], 
20                 {
21                         "ok": self.go,
22                         "back": self.cancel,
23                         "1": self.keyNumberGlobal,
24                         "2": self.keyNumberGlobal,
25                         "3": self.keyNumberGlobal,
26                         "4": self.keyNumberGlobal,
27                         "5": self.keyNumberGlobal,
28                         "6": self.keyNumberGlobal,
29                         "7": self.keyNumberGlobal,
30                         "8": self.keyNumberGlobal,
31                         "9": self.keyNumberGlobal,
32                         "0": self.keyNumberGlobal
33                 }, -1)
34                 
35         def keyLeft(self):
36                 pass
37         
38         def keyRight(self):
39                 pass
40         
41         def keyNumberGlobal(self, number):
42                 print "pressed", number
43                 #self["input"].number(number)
44                 
45         def go(self):
46                 self.close(self["list"].l.getCurrentSelection())
47                 #self.close(self["input"].getText())
48                 
49         def cancel(self):
50                 self.close(None)