spinetoolbox.mvcmodels.resource_filter_model

Contains ResourceFilterModel.

Module Contents

Classes

ResourceFilterModel

param connection

connection whose resources to model

class spinetoolbox.mvcmodels.resource_filter_model.ResourceFilterModel(connection, project, undo_stack, logger)[source]

Bases: PySide6.QtGui.QStandardItemModel

Parameters
property connection[source]
tree_built[source]
_SELECT_ALL = 'Select all'[source]
FILTER_TYPES[source]
FILTER_TYPE_TO_TEXT[source]
build_tree()[source]

Rebuilds model’s contents.

fetch_filters()[source]
setData(index, value, role=Qt.ItemDataRole.EditRole)[source]
_change_filter_checked_state(index, is_on)[source]

Changes the online status of the filter item at index.

Parameters
  • index (QModelIndex) – item’s index

  • is_on (bool) – True if filter are turned online, False otherwise

set_online(resource, filter_type, online)[source]

Sets the given filters online or offline.

Parameters
  • resource (str) – Resource label

  • filter_type (str) – Always SCENARIO_FILTER_TYPE, for now.

  • online (dict) – mapping from scenario/tool id to online flag

_find_filter_type_item(resource, filter_type)[source]

Searches for filter type item.

Parameters
  • resource (str) – resource label

  • filter_type (str) – filter type identifier

Returns

filter type item or None if not found

Return type

QStandardItem

filter_type_items(filter_type)[source]

An iterator to filter type items.

Parameters

filter_type (str) – filter type

Yields

QStandardItem – filter type item

_set_all_selected_item(resource, filter_type_item, emit_data_changed=False)[source]

Updates ‘Select All’ item’s checked state.

Parameters
  • resource (str) – resource label

  • filter_type_item (QStandardItem) – filter type item

  • emit_data_changed (bool) – if True, emit dataChanged signal if the state was updated

set_filter_type_enabled(filter_type, enabled)[source]

Enables or disables a filter type.

Parameters
  • filter_type (str) – filter type

  • enabled (bool) – whether the filter is enabled