tools, frontends, memory: param definition and XMLUI handle multi-selection for list widgets:
- we need to update urwid_satext to revision 79
- no more "value" attribute value in the "list" element, use
HTML-style "select" attribute in the "option" elements instead
- /!\ param saving do not handle multiple values yet!
This commit is contained in:
parent
8fa0b7b8c2
commit
608e2ba9fa
1 changed files with 82 additions and 39 deletions
|
|
@ -122,14 +122,16 @@ class ButtonWidget(EventWidget, WixWidget, xmlui.ButtonWidget, wx.Button):
|
|||
self._xmlui_click_callback(event.GetEventObject())
|
||||
event.Skip()
|
||||
|
||||
|
||||
class ListWidget(EventWidget, WixWidget, xmlui.ListWidget, wx.ListBox):
|
||||
_xmlui_change_event = wx.EVT_LISTBOX
|
||||
|
||||
def __init__(self, parent, options, flags):
|
||||
def __init__(self, parent, options, selected, flags):
|
||||
styles = wx.LB_MULTIPLE if not 'single' in flags else wx.LB_SINGLE
|
||||
wx.ListBox.__init__(self, parent, -1, choices=[option[1] for option in options], style=styles)
|
||||
self._xmlui_attr_map = {label: value for value, label in options}
|
||||
self._xmlui_proportion = 1
|
||||
self._xmluiSelectValues(selected)
|
||||
|
||||
def _xmluiSelectValue(self, value):
|
||||
try:
|
||||
|
|
@ -140,6 +142,10 @@ class ListWidget(EventWidget, WixWidget, xmlui.ListWidget, wx.ListBox):
|
|||
for idx in xrange(self.GetCount()):
|
||||
self.SetSelection(idx, self.GetString(idx) == label)
|
||||
|
||||
def _xmluiSelectValues(self, values):
|
||||
for value in values:
|
||||
self._xmluiSelectValue(value)
|
||||
|
||||
def _xmluiGetSelectedValues(self):
|
||||
ret = []
|
||||
labels = [self.GetString(idx) for idx in self.GetSelections()]
|
||||
|
|
|
|||
Loading…
Reference in a new issue