spinetoolbox.mvcmodels.resource_filter_model

Contains ResourceFilterModel.

author
  1. Marin (KTH)

date

26.11.2020

Module Contents

Classes

ResourceFilterModel

param connection

link whose resources to model

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

Bases: PySide2.QtGui.QStandardItemModel

Parameters
  • connection (Connection) – link whose resources to model

  • undo_stack (QUndoStack) – an undo stack

  • logger (LoggerInterface) – a logger

tree_built[source]
_SELECT_ALL = Select all[source]
_FILTER_TYPES[source]
_FILTER_TYPE_TO_TEXT[source]
_ID_ROLE[source]
property connection(self)[source]
build_tree(self)[source]

Rebuilds model’s contents.

setData(self, index, value, role=Qt.EditRole)[source]
_change_filter_checked_state(self, 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(self, resource, filter_type, online)[source]

Sets the given filters online or offline.

Parameters
  • resource (str) – Resource label

  • filter_type (str) – Either SCENARIO_FILTER_TYPE or TOOL_FILTER_TYPE, for now.

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

_find_filter_type_item(self, 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

_set_all_selected_item(self, 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