aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-04-30 20:01:21 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-04-30 20:01:21 +0000
commitaf50298c0edc3e108433acc9106d9a022447d44e (patch)
tree0eec950ed239813597be312cd9df1a0bab0a773d /lib/python
parent81e5614daf0d2c301b9f3c646e1387482b56193e (diff)
downloadenigma2-af50298c0edc3e108433acc9106d9a022447d44e.tar.gz
enigma2-af50298c0edc3e108433acc9106d9a022447d44e.zip
ChoiceBox is now usable with number keys
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Makefile.am2
-rw-r--r--lib/python/Components/__init__.py2
-rw-r--r--lib/python/Screens/ChoiceBox.py25
3 files changed, 22 insertions, 7 deletions
diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am
index efb81c37..80393aef 100644
--- a/lib/python/Components/Makefile.am
+++ b/lib/python/Components/Makefile.am
@@ -13,4 +13,4 @@ install_PYTHON = \
BlinkingPixmap.py Pixmap.py ConditionalWidget.py Slider.py LanguageList.py \
PluginList.py PluginComponent.py RecordingConfig.py About.py UsageConfig.py \
FIFOList.py ServiceEventTracker.py Input.py TimerSanityCheck.py FileList.py \
- MultiContent.py MediaPlayer.py TunerInfo.py VideoWindow.py
+ MultiContent.py MediaPlayer.py TunerInfo.py VideoWindow.py ChoiceList.py
diff --git a/lib/python/Components/__init__.py b/lib/python/Components/__init__.py
index b6ad939c..5dd11a82 100644
--- a/lib/python/Components/__init__.py
+++ b/lib/python/Components/__init__.py
@@ -7,4 +7,4 @@ __all__ = ["ActionMap", "Button", "Clock", "ConfigList", "EventInfo",
"InputDevice", "ServicePosition", "IPAddress", "VariableIP", "IPGateway",
"IPNameserver", "Network", "RFmon", "DiskInfo", "NimManager", "TimerEntry",
"Lcd", "EpgList" "ScrollLabel", "Timezones", "HelpMenuList", "TimerSanityCheck",
- "FileList", "MultiContent", "TunerInfo" ]
+ "FileList", "MultiContent", "TunerInfo", "ChoiceList" ]
diff --git a/lib/python/Screens/ChoiceBox.py b/lib/python/Screens/ChoiceBox.py
index 7192a229..0be9385e 100644
--- a/lib/python/Screens/ChoiceBox.py
+++ b/lib/python/Screens/ChoiceBox.py
@@ -5,16 +5,30 @@ from Components.ActionMap import NumberActionMap
from Components.Label import Label
from Components.MenuList import MenuList
from Components.GUIComponent import *
+from Components.ChoiceList import ChoiceEntryComponent, ChoiceList
import os
class ChoiceBox(Screen):
- def __init__(self, session, title = "", list = []):
+ def __init__(self, session, title = "", list = [], keys = None):
Screen.__init__(self, session)
self["text"] = Label(title)
- self.list = list
- self["list"] = MenuList(list)
+ self.list = []
+ if keys is None:
+ self.keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ] + (len(list) - 10) * [""]
+ else:
+ self.keys = keys
+
+ self.keymap = {}
+ pos = 0
+ for x in list:
+ strpos = str(self.keys[pos])
+ self.list.append(ChoiceEntryComponent(strpos, x))
+ if self.keys[pos] != "":
+ self.keymap[self.keys[pos]] = list[pos]
+ pos += 1
+ self["list"] = ChoiceList(self.list)
self["actions"] = NumberActionMap(["WizardActions", "InputActions"],
{
@@ -40,10 +54,11 @@ class ChoiceBox(Screen):
def keyNumberGlobal(self, number):
print "pressed", number
- #self["input"].number(number)
+ if self.keymap.has_key(str(number)):
+ self.close(self.keymap[str(number)])
def go(self):
- self.close(self["list"].l.getCurrentSelection())
+ self.close(self["list"].l.getCurrentSelection()[0])
#self.close(self["input"].getText())
def cancel(self):