spinetoolbox.mvcmodels.filter_checkbox_list_model

Provides FilterCheckboxListModel for FilterWidget.

author
  1. Vennström (VTT)

date

1.11.2018

Module Contents

Classes

SimpleFilterCheckboxListModel

Init class.

LazyFilterCheckboxListModel

Extends SimpleFilterCheckboxListModel to allow for lazy loading in synch with another model.

DataToValueFilterCheckboxListModel

Extends SimpleFilterCheckboxListModel to allow for translating internal data to a value for display role.

class spinetoolbox.mvcmodels.filter_checkbox_list_model.SimpleFilterCheckboxListModel(parent, show_empty=True)[source]

Bases: PySide2.QtCore.QAbstractListModel

Init class.

Parameters

parent (QWidget) –

_SELECT_ALL_STR = (Select all)[source]
_SELECT_ALL_FILTERED_STR = (Select all filtered)[source]
_EMPTY_STR = (Empty)[source]
_ADD_TO_SELECTION_STR = Add current selection to filter[source]
property _show_empty(self)[source]
property _show_add_to_selection(self)[source]
reset_selection(self)[source]
_handle_select_all_clicked(self)[source]
_check_all_selected(self)[source]
rowCount(self, parent=QModelIndex())[source]
data(self, index, role=Qt.DisplayRole)[source]
_handle_index_clicked(self, index)[source]
set_list(self, data, all_selected=True)[source]
set_selected(self, selected, select_empty=None)[source]
get_selected(self)[source]
get_not_selected(self)[source]
set_filter(self, filter_expression)[source]
search_filter_expression(self, item)[source]
set_base_filter(self, condition)[source]

Sets the base filter. The other filter, the one that works by typing in the search bar, should be applied on top of this base filter.

Parameters

condition (function) – Filter acceptance condition.

apply_filter(self)[source]
_remove_and_add_filtered(self)[source]
_remove_and_replace_filtered(self)[source]
remove_filter(self)[source]
_do_add_items(self, data)[source]
add_items(self, data, selected=None)[source]
remove_items(self, data)[source]
class spinetoolbox.mvcmodels.filter_checkbox_list_model.LazyFilterCheckboxListModel(parent, source_model, show_empty=True)[source]

Bases: SimpleFilterCheckboxListModel

Extends SimpleFilterCheckboxListModel to allow for lazy loading in synch with another model.

Init class.

Parameters
canFetchMore(self, parent=QModelIndex())[source]
fetchMore(self, parent=QModelIndex())[source]
_do_add_items(self, data)[source]

Adds items so the list is always sorted, while assuming that both existing and new items are sorted.

class spinetoolbox.mvcmodels.filter_checkbox_list_model.DataToValueFilterCheckboxListModel(parent, data_to_value, show_empty=True)[source]

Bases: SimpleFilterCheckboxListModel

Extends SimpleFilterCheckboxListModel to allow for translating internal data to a value for display role.

Init class.

Parameters
  • parent (SpineDBEditor) –

  • data_to_value (method) – a method to translate item data to a value for display role

data(self, index, role=Qt.DisplayRole)[source]
search_filter_expression(self, item)[source]