spinetoolbox.spine_db_editor.mvcmodels.item_metadata_table_model

Contains ItemMetadataTableModel and associated functionality.

Module Contents

Classes

ExtraColumn

Identifiers for hidden table columns.

ItemType

Allowed item types.

ItemMetadataTableModel

Model for entity and parameter value metadata.

class spinetoolbox.spine_db_editor.mvcmodels.item_metadata_table_model.ExtraColumn[source]

Bases: enum.IntEnum

Identifiers for hidden table columns.

Initialize self. See help(type(self)) for accurate signature.

ITEM_METADATA_ID[source]
METADATA_ID[source]
class spinetoolbox.spine_db_editor.mvcmodels.item_metadata_table_model.ItemType[source]

Bases: enum.Enum

Allowed item types.

ENTITY[source]
VALUE[source]
class spinetoolbox.spine_db_editor.mvcmodels.item_metadata_table_model.ItemMetadataTableModel(db_mngr, db_maps, db_editor)[source]

Bases: spinetoolbox.spine_db_editor.mvcmodels.metadata_table_model_base.MetadataTableModelBase

Model for entity and parameter value metadata.

Parameters
  • db_mngr (SpineDBManager) – database manager

  • db_maps (Iterable of DatabaseMapping) – database maps

  • db_editor (SpineDBEditor) – DB editor

_ITEM_NAME_KEY = 'metadata_name'[source]
_ITEM_VALUE_KEY = 'metadata_value'[source]
_fetch_parents()[source]

Yields fetch parents for this model.

Yields

FetchParent

clear()[source]

Clears the model.

static _make_hidden_adder_columns()[source]

See base class.

_accepts_entity_metadata_item(item, db_map)[source]
_accepts_parameter_value_metadata_item(item, db_map)[source]
set_entity_ids(db_map_ids)[source]

Sets the model to show metadata from given entity.

Parameters

db_map_ids (dict) – mapping from database mapping to entity’s id in that database

set_parameter_value_ids(db_map_ids)[source]

Sets the model to show metadata from given parameter value.

Parameters

db_map_ids (dict) – mapping from database mapping to value’s id in that database

_reset_metadata(item_type, db_map_ids)[source]

Resets model.

Parameters
  • item_type (ItemType) – current item type

  • db_map_ids (dict) – mapping from database mapping to value’s id in that database

_reset_fetch_parents()[source]
_add_data_to_db_mngr(name, value, db_map)[source]

See base class.

_update_data_in_db_mngr(id_, name, value, db_map)[source]

See base class

flags(index)[source]
static _ids_from_added_item(item)[source]

See base class.

static _extra_cells_from_added_item(item)[source]

See base class.

_set_extra_columns(row, ids)[source]

See base class.

_database_table_name()[source]

See base class

_row_id(row)[source]

See base class.

add_item_metadata(db_map_data)[source]

Adds new item metadata from database manager to the model.

Parameters

db_map_data (dict) – added items keyed by database mapping

update_item_metadata(db_map_data)[source]

Updates item metadata in model after it has been updated in databases.

Parameters

db_map_data (dict) – updated metadata records

remove_item_metadata(db_map_data)[source]

Removes item metadata from model after it has been removed from databases.

Parameters

db_map_data (dict) – removed items keyed by database mapping