use color actions in ChoiceBox
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sun, 30 Apr 2006 20:22:36 +0000 (20:22 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Sun, 30 Apr 2006 20:22:36 +0000 (20:22 +0000)
lib/python/Screens/ChoiceBox.py

index 0be9385e9268e93d4edb69539bd601ccbd0b86a5..f38f0363dd7f1e00e0edc4bc6acfa0a7b977bb73 100644 (file)
@@ -16,7 +16,7 @@ class ChoiceBox(Screen):
                self["text"] = Label(title)
                self.list = []
                if keys is None:
-                       self.keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ] + (len(list) - 10) * [""]
+                       self.keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue" ] + (len(list) - 10) * [""]
                else:
                        self.keys = keys
                        
@@ -30,7 +30,7 @@ class ChoiceBox(Screen):
                        pos += 1
                self["list"] = ChoiceList(self.list)
                                
-               self["actions"] = NumberActionMap(["WizardActions", "InputActions"], 
+               self["actions"] = NumberActionMap(["WizardActions", "InputActions", "ColorActions"], 
                {
                        "ok": self.go,
                        "back": self.cancel,
@@ -43,7 +43,11 @@ class ChoiceBox(Screen):
                        "7": self.keyNumberGlobal,
                        "8": self.keyNumberGlobal,
                        "9": self.keyNumberGlobal,
-                       "0": self.keyNumberGlobal
+                       "0": self.keyNumberGlobal,
+                       "red": self.keyRed,
+                       "green": self.keyGreen,
+                       "yellow": self.keyYellow,
+                       "blue": self.keyBlue
                }, -1)
                
        def keyLeft(self):
@@ -60,6 +64,22 @@ class ChoiceBox(Screen):
        def go(self):
                self.close(self["list"].l.getCurrentSelection()[0])
                #self.close(self["input"].getText())
-               
+
+       def keyRed(self):
+               if self.keymap.has_key("red"):
+                       self.close(self.keymap["red"])
+
+       def keyGreen(self):
+               if self.keymap.has_key("green"):
+                       self.close(self.keymap["green"])
+       
+       def keyYellow(self):
+               if self.keymap.has_key("yellow"):
+                       self.close(self.keymap["yellow"])
+                       
+       def keyBlue(self):
+               if self.keymap.has_key("blue"):
+                       self.close(self.keymap["blue"])
+                       
        def cancel(self):
                self.close(None)
\ No newline at end of file