spinetoolbox.mvcmodels.filter_checkbox_list_model

Provides FilterCheckboxListModel for FilterWidget.

Module Contents

Classes

SimpleFilterCheckboxListModel

param parent:

parent widget

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: PySide6.QtCore.QAbstractListModel

Parameters:
  • parent (QWidget) – parent widget

  • show_empty (bool) – if True, adds an empty row to the end of the list

property _show_empty[source]
property _show_add_to_selection[source]
_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]
reset_selection()[source]
_handle_select_all_clicked()[source]
_check_all_selected()[source]
rowCount(parent=QModelIndex())[source]
data(index, role=Qt.ItemDataRole.DisplayRole)[source]
_handle_index_clicked(index)[source]
set_list(data, all_selected=True)[source]
filter_by_condition(condition)[source]

Updates selected items by applying a condition.

Parameters:

condition (function) – Filter acceptance condition.

set_selected(selected, select_empty=None)[source]
get_selected()[source]
get_not_selected()[source]
set_filter(filter_expression)[source]
search_filter_expression(item)[source]
apply_filter()[source]
_remove_and_add_filtered()[source]
_remove_and_replace_filtered()[source]
remove_filter()[source]
_do_add_items(data)[source]
add_items(data, selected=None)[source]
remove_items(data)[source]
class spinetoolbox.mvcmodels.filter_checkbox_list_model.LazyFilterCheckboxListModel(parent, db_mngr, db_maps, fetch_parent, show_empty=True)[source]

Bases: SimpleFilterCheckboxListModel

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

Parameters:
  • parent (SpineDBEditor) – parent widget

  • db_mngr (SpineDBManager) – database manager

  • db_maps (Sequence of DatabaseMapping) – database maps

  • fetch_parent (FetchParent) – fetch parent

  • show_empty (bool) – if True, show an empty row at the end of the list

canFetchMore(_parent)[source]
fetchMore(_parent)[source]
_do_add_items(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.

Parameters:
  • parent (SpineDBEditor) – parent widget

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

  • show_empty (bool) – if True, add an empty row to the end of the list

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