display choices and selection of ChoiceBoxes on summary screen
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>
Tue, 21 Oct 2008 22:27:30 +0000 (22:27 +0000)
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>
Tue, 21 Oct 2008 22:27:30 +0000 (22:27 +0000)
data/skin_default.xml
lib/python/Screens/ChoiceBox.py

index 8715c192330b865e3d22512abb41309181d6e646..68a3641e0136d8586663e975a9a181fed26db9e8 100644 (file)
@@ -158,6 +158,9 @@ self.instance.move(ePoint((720-wsizex)/2, (576-wsizey)/(count &gt; 7 and 2 or 3)
 
                </applet>
        </screen>
 
                </applet>
        </screen>
+       <screen name="ChoiceBox_summary" position="0,0" size="132,64">
+               <widget source="parent.summary_list" render="Label" position="6,0" size="126,64" font="Regular;11" />
+       </screen>       
        <!-- Common interface -->
        <screen name="MMIDialog" position="135,153" size="450,270">
                <widget name="title" position="10,10" size="430,25" font="Regular;23" />
        <!-- Common interface -->
        <screen name="MMIDialog" position="135,153" size="450,270">
                <widget name="title" position="10,10" size="430,25" font="Regular;23" />
index 0436f66d0152993fff3076e0614b07bf27f86f8b..4739b7e1d5bb1b5e10476581eaddd98649ceb865 100644 (file)
@@ -2,6 +2,7 @@ from Screens.Screen import Screen
 from Components.ActionMap import NumberActionMap
 from Components.Label import Label
 from Components.ChoiceList import ChoiceEntryComponent, ChoiceList
 from Components.ActionMap import NumberActionMap
 from Components.Label import Label
 from Components.ChoiceList import ChoiceEntryComponent, ChoiceList
+from Components.Sources.StaticText import StaticText
 
 class ChoiceBox(Screen):
        def __init__(self, session, title = "", list = [], keys = None, selection = 0):
 
 class ChoiceBox(Screen):
        def __init__(self, session, title = "", list = [], keys = None, selection = 0):
@@ -9,6 +10,7 @@ class ChoiceBox(Screen):
 
                self["text"] = Label(title)
                self.list = []
 
                self["text"] = Label(title)
                self.list = []
+               self.summarylist = []
                if keys is None:
                        self.__keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue" ] + (len(list) - 10) * [""]
                else:
                if keys is None:
                        self.__keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue" ] + (len(list) - 10) * [""]
                else:
@@ -21,8 +23,11 @@ class ChoiceBox(Screen):
                        self.list.append(ChoiceEntryComponent(key = strpos, text = x))
                        if self.__keys[pos] != "":
                                self.keymap[self.__keys[pos]] = list[pos]
                        self.list.append(ChoiceEntryComponent(key = strpos, text = x))
                        if self.__keys[pos] != "":
                                self.keymap[self.__keys[pos]] = list[pos]
+                       self.summarylist.append((self.__keys[pos],x[0]))
                        pos += 1
                self["list"] = ChoiceList(list = self.list, selection = selection)
                        pos += 1
                self["list"] = ChoiceList(list = self.list, selection = selection)
+               self["summary_list"] = StaticText()
+               self.updateSummary()
                                
                self["actions"] = NumberActionMap(["WizardActions", "InputActions", "ColorActions", "DirectionActions"], 
                {
                                
                self["actions"] = NumberActionMap(["WizardActions", "InputActions", "ColorActions", "DirectionActions"], 
                {
@@ -56,6 +61,7 @@ class ChoiceBox(Screen):
                if len(self["list"].list) > 0:
                        while 1:
                                self["list"].instance.moveSelection(self["list"].instance.moveUp)
                if len(self["list"].list) > 0:
                        while 1:
                                self["list"].instance.moveSelection(self["list"].instance.moveUp)
+                               self.updateSummary(self["list"].l.getCurrentSelectionIndex())
                                if self["list"].l.getCurrentSelection()[0][0] != "--" or self["list"].l.getCurrentSelectionIndex() == 0:
                                        break
 
                                if self["list"].l.getCurrentSelection()[0][0] != "--" or self["list"].l.getCurrentSelectionIndex() == 0:
                                        break
 
@@ -63,6 +69,7 @@ class ChoiceBox(Screen):
                if len(self["list"].list) > 0:
                        while 1:
                                self["list"].instance.moveSelection(self["list"].instance.moveDown)
                if len(self["list"].list) > 0:
                        while 1:
                                self["list"].instance.moveSelection(self["list"].instance.moveDown)
+                               self.updateSummary(self["list"].l.getCurrentSelectionIndex())
                                if self["list"].l.getCurrentSelection()[0][0] != "--" or self["list"].l.getCurrentSelectionIndex() == len(self["list"].list) - 1:
                                        break
 
                                if self["list"].l.getCurrentSelection()[0][0] != "--" or self["list"].l.getCurrentSelectionIndex() == len(self["list"].list) - 1:
                                        break
 
@@ -106,5 +113,18 @@ class ChoiceBox(Screen):
        def keyBlue(self):
                self.goKey("blue")
 
        def keyBlue(self):
                self.goKey("blue")
 
+       def updateSummary(self, curpos=0):
+               pos = 0
+               summarytext = ""
+               for entry in self.summarylist:
+                       if pos > curpos-2 and pos < curpos+5:
+                               if pos == curpos:
+                                       summarytext += ">"
+                               else:
+                                       summarytext += entry[0]
+                               summarytext += ' ' + entry[1] + '\n'
+                       pos += 1
+               self["summary_list"].setText(summarytext)
+
        def cancel(self):
                self.close(None)
        def cancel(self):
                self.close(None)