spinetoolbox.widgets.select_database_items

A widget and utilities to select database items.

Module Contents

Classes

SelectDatabaseItems

Widget that allows selecting database items.

Functions

add_check_boxes(check_boxes, checked_states, ...)

Adds check boxes to grid layout.

batch_set_check_state(boxes, checked)

Sets the checked state of multiple check boxes.

spinetoolbox.widgets.select_database_items.add_check_boxes(check_boxes, checked_states, select_all_button, deselect_all_button, state_changed_slot, layout)[source]

Adds check boxes to grid layout.

Parameters
  • check_boxes (dict) – mapping from label to QCheckBox

  • checked_states (dict) – mapping from label to checked state boolean

  • select_all_button (QPushButton) – the Select all button

  • deselect_all_button (QPushButton) – the Deselect all button

  • state_changed_slot (Callable) – slot to call when any checked state changes

  • layout (QGridLayout) – target layout

spinetoolbox.widgets.select_database_items.batch_set_check_state(boxes, checked)[source]

Sets the checked state of multiple check boxes.

Parameters
  • boxes (Iterable of QCheckBox) – check boxes

  • checked (bool) – checked state

class spinetoolbox.widgets.select_database_items.SelectDatabaseItems(checked_states=None, parent=None)[source]

Bases: PySide6.QtWidgets.QWidget

Widget that allows selecting database items.

Parameters
  • checked_states (dict, optional) – mapping from item name to check state boolean

  • parent (QWidget) – parent widget

checked_state_changed[source]
COLUMN_COUNT = 3[source]
_DATA_ITEMS = ('entity', 'entity_group', 'parameter_value', 'entity_metadata', 'parameter_value_metadata')[source]
_SCENARIO_ITEMS = ('alternative', 'scenario', 'scenario_alternative')[source]
checked_states()[source]

Collects the checked states of database items.

Returns

mapping from item name to checked state boolean

Return type

dict

any_checked()[source]

Checks if any of the checkboxes is checked.

Returns

True if any check box is checked, False otherwise

Return type

bool

any_structural_item_checked()[source]
_select_data_items(_=False)[source]

Checks all data items.

_select_scenario_items(_=False)[source]

Checks all scenario items.