ChoiceBox is now usable with number keys
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sun, 30 Apr 2006 20:01:21 +0000 (20:01 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sun, 30 Apr 2006 20:01:21 +0000 (20:01 +0000)
14 files changed:
data/key_0-fs8.png [new file with mode: 0644]
data/key_1-fs8.png [new file with mode: 0644]
data/key_2-fs8.png [new file with mode: 0644]
data/key_3-fs8.png [new file with mode: 0644]
data/key_4-fs8.png [new file with mode: 0644]
data/key_5-fs8.png [new file with mode: 0644]
data/key_6-fs8.png [new file with mode: 0644]
data/key_7-fs8.png [new file with mode: 0644]
data/key_8-fs8.png [new file with mode: 0644]
data/key_9-fs8.png [new file with mode: 0644]
data/skin_default.xml
lib/python/Components/Makefile.am
lib/python/Components/__init__.py
lib/python/Screens/ChoiceBox.py

diff --git a/data/key_0-fs8.png b/data/key_0-fs8.png
new file mode 100644 (file)
index 0000000..ea5485e
Binary files /dev/null and b/data/key_0-fs8.png differ
diff --git a/data/key_1-fs8.png b/data/key_1-fs8.png
new file mode 100644 (file)
index 0000000..dbce1fa
Binary files /dev/null and b/data/key_1-fs8.png differ
diff --git a/data/key_2-fs8.png b/data/key_2-fs8.png
new file mode 100644 (file)
index 0000000..1a7bf90
Binary files /dev/null and b/data/key_2-fs8.png differ
diff --git a/data/key_3-fs8.png b/data/key_3-fs8.png
new file mode 100644 (file)
index 0000000..5c280d3
Binary files /dev/null and b/data/key_3-fs8.png differ
diff --git a/data/key_4-fs8.png b/data/key_4-fs8.png
new file mode 100644 (file)
index 0000000..9509f0e
Binary files /dev/null and b/data/key_4-fs8.png differ
diff --git a/data/key_5-fs8.png b/data/key_5-fs8.png
new file mode 100644 (file)
index 0000000..18e2990
Binary files /dev/null and b/data/key_5-fs8.png differ
diff --git a/data/key_6-fs8.png b/data/key_6-fs8.png
new file mode 100644 (file)
index 0000000..42f6f58
Binary files /dev/null and b/data/key_6-fs8.png differ
diff --git a/data/key_7-fs8.png b/data/key_7-fs8.png
new file mode 100644 (file)
index 0000000..a98d711
Binary files /dev/null and b/data/key_7-fs8.png differ
diff --git a/data/key_8-fs8.png b/data/key_8-fs8.png
new file mode 100644 (file)
index 0000000..4e154b9
Binary files /dev/null and b/data/key_8-fs8.png differ
diff --git a/data/key_9-fs8.png b/data/key_9-fs8.png
new file mode 100644 (file)
index 0000000..46e3a31
Binary files /dev/null and b/data/key_9-fs8.png differ
index 3c8fc4921741b6c379e11a54a9f11345b58b05fa..31f7fb90a88c5da6e29b7275a3ada94e39c6b9b4 100644 (file)
@@ -296,8 +296,8 @@ if count > 6:
 offset = 30 * count
 wsizex = textsize[0] + 60
 wsizey = textsize[1] + offset
-if (400 > wsizex):
-       wsizex = 400
+if (450 > wsizex):
+       wsizex = 450
 wsize = (wsizex, wsizey)
 
 
index efb81c37fd9048eca413d7f5d01654efb1916c8d..80393aeffe9413b402ae27a5e9d9ab6353feeff3 100644 (file)
@@ -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
index b6ad939cd39850a32e0b6f347aef09e784cc0c96..5dd11a82803d2404f67bc4a03aa3568001aec0c5 100644 (file)
@@ -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" ]
index 7192a229c596721b14f6d73e02fb7888c3f1527c..0be9385e9268e93d4edb69539bd601ccbd0b86a5 100644 (file)
@@ -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):