# HG changeset patch # User souliane # Date 1396532941 -7200 # Node ID a927a98b398da261cc8c8bd343aeab6bac920b55 # Parent 9283f9e5e5ddb65bb8b83bdad27d5c8daa6d0b3a browser_side (xmlui): fix multi-selection diff -r 9283f9e5e5dd -r a927a98b398d browser_side/xmlui.py --- a/browser_side/xmlui.py Tue Apr 01 11:00:28 2014 +0200 +++ b/browser_side/xmlui.py Thu Apr 03 15:49:01 2014 +0200 @@ -154,7 +154,10 @@ def __init__(self, parent, options, selected, flags): ListBox.__init__(self) - self.setMultipleSelect('single' not in flags) + multi_selection = 'single' not in flags + self.setMultipleSelect(multi_selection) + if multi_selection: + self.setVisibleItemCount(5) for option in options: self.addItem(option[1]) self._xmlui_attr_map = {label: value for value, label in options} @@ -185,8 +188,9 @@ def _xmluiAddValues(self, values, select=True): selected = self._xmluiGetSelectedValues() for value in values: - self.addItem(value) - self._xmlui_attr_map[value] = value + if value not in self._xmlui_attr_map.values(): + self.addItem(value) + self._xmlui_attr_map[value] = value if value not in selected: selected.append(value) self._xmluiSelectValues(selected)