core (XMLUI), frontends: advancedListContainer part 2:
This commit is contained in:
parent
edf3e1bc87
commit
18aeb3a6aa
1 changed files with 142 additions and 36 deletions
|
|
@ -28,13 +28,13 @@ from sat_frontends.tools import xmlui
|
|||
class PrimitivusEvents(object):
|
||||
""" Used to manage change event of Primitivus widgets """
|
||||
|
||||
def _change_callback(self, ctrl, *args, **kwargs):
|
||||
def _event_callback(self, ctrl, *args, **ktkwargs):
|
||||
"""" Call xmlui callback and ignore any extra argument """
|
||||
args[-1](ctrl)
|
||||
|
||||
def _xmluiOnChange(self, callback):
|
||||
""" Call callback with widget as only argument """
|
||||
urwid.connect_signal(self, 'change', self._change_callback, callback)
|
||||
urwid.connect_signal(self, 'change', self._event_callback, callback)
|
||||
|
||||
|
||||
class PrimitivusEmptyWidget(xmlui.EmptyWidget, urwid.Text):
|
||||
|
|
@ -132,17 +132,29 @@ class PrimitivusListWidget(xmlui.ListWidget, sat_widgets.List, PrimitivusEvents)
|
|||
return [option.value for option in self.getSelectedValues()]
|
||||
|
||||
|
||||
class PrimitivusAdvancedListContainer(xmlui.AdvancedListContainer, sat_widgets.TableContainer):
|
||||
class PrimitivusAdvancedListContainer(xmlui.AdvancedListContainer, sat_widgets.TableContainer, PrimitivusEvents):
|
||||
|
||||
def __init__(self, parent, columns):
|
||||
options = {'ADAPT':(), 'HIGHLIGHT':()}
|
||||
sat_widgets.TableContainer.__init__(self, columns=columns, options=options)
|
||||
def __init__(self, parent, columns, selectable='no'):
|
||||
options = {'ADAPT':()}
|
||||
if selectable != 'no':
|
||||
options['HIGHLIGHT'] = ()
|
||||
sat_widgets.TableContainer.__init__(self, columns=columns, options=options, row_selectable = selectable!='no')
|
||||
|
||||
def _xmluiAppend(self, widget):
|
||||
self.addWidget(widget)
|
||||
|
||||
def _xmluiAddRow(self):
|
||||
pass
|
||||
def _xmluiAddRow(self, idx):
|
||||
self.setRowIndex(idx)
|
||||
|
||||
def _xmluiGetSelectedWidgets(self):
|
||||
return self.getSelectedWidgets()
|
||||
|
||||
def _xmluiGetSelectedIndex(self):
|
||||
return self.getSelectedIndex()
|
||||
|
||||
def _xmluiOnSelect(self, callback):
|
||||
""" Call callback with widget as only argument """
|
||||
urwid.connect_signal(self, 'click', self._event_callback, callback)
|
||||
|
||||
class PrimitivusPairsContainer(xmlui.PairsContainer, sat_widgets.TableContainer):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue