comparison frontends/src/primitivus/xmlui.py @ 968:75f3b3b430ff

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!
author souliane <souliane@mailoo.org>
date Tue, 01 Apr 2014 21:21:13 +0200
parents b70fb2ac5997
children 5c7707c958d8
comparison
equal deleted inserted replaced
967:242bd4fc654c 968:75f3b3b430ff
100 100
101 def __init__(self, parent, value): 101 def __init__(self, parent, value):
102 sat_widgets.AdvancedEdit.__init__(self, edit_text=value, multiline=True) 102 sat_widgets.AdvancedEdit.__init__(self, edit_text=value, multiline=True)
103 103
104 def _xmluiGetValue(self): 104 def _xmluiGetValue(self):
105 return self.getValue() 105 return self.get_edit_text()
106 106
107 107
108 class PrimitivusBoolWidget(xmlui.BoolWidget, urwid.CheckBox, PrimitivusEvents): 108 class PrimitivusBoolWidget(xmlui.BoolWidget, urwid.CheckBox, PrimitivusEvents):
109 109
110 def __init__(self, parent, state): 110 def __init__(self, parent, state):
111 urwid.CheckBox.__init__(self, '', state = state) 111 urwid.CheckBox.__init__(self, '', state=state)
112 112
113 def _xmluiGetValue(self): 113 def _xmluiGetValue(self):
114 return "true" if self.get_state() else "false" 114 return "true" if self.get_state() else "false"
115 115
116 116
120 sat_widgets.CustomButton.__init__(self, value, on_press=click_callback) 120 sat_widgets.CustomButton.__init__(self, value, on_press=click_callback)
121 121
122 122
123 class PrimitivusListWidget(xmlui.ListWidget, sat_widgets.List, PrimitivusEvents): 123 class PrimitivusListWidget(xmlui.ListWidget, sat_widgets.List, PrimitivusEvents):
124 124
125 def __init__(self, parent, options, flags): 125 def __init__(self, parent, options, selected, flags):
126 sat_widgets.List.__init__(self, options=options, style=flags) 126 sat_widgets.List.__init__(self, options=options, style=flags)
127 self._xmluiSelectValues(selected)
127 128
128 def _xmluiSelectValue(self, value): 129 def _xmluiSelectValue(self, value):
129 return self.selectValue(value) 130 return self.selectValue(value)
131
132 def _xmluiSelectValues(self, values):
133 return self.selectValues(values)
130 134
131 def _xmluiGetSelectedValues(self): 135 def _xmluiGetSelectedValues(self):
132 return [option.value for option in self.getSelectedValues()] 136 return [option.value for option in self.getSelectedValues()]
133 137
134 138