spinetoolbox.spine_db_editor.mvcmodels.parameter_value_list_model

A tree model for parameter_value lists.

authors
  1. Marin (KTH)

date

28.6.2019

Module Contents

Classes

DBItem

An item representing a db.

ListItem

A list item.

ValueItem

A value item.

ParameterValueListModel

A model to display parameter_value_list data in a tree view.

class spinetoolbox.spine_db_editor.mvcmodels.parameter_value_list_model.DBItem(db_map)[source]

Bases: spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.EmptyChildMixin, spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.NonLazyDBItem

An item representing a db.

Init class.

Args

db_mngr (SpineDBManager) db_map (DiffDatabaseMapping)

empty_child(self)[source]
class spinetoolbox.spine_db_editor.mvcmodels.parameter_value_list_model.ListItem(identifier=None)[source]

Bases: spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.LastGrayMixin, spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.AllBoldMixin, spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.EditableMixin, spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.NonLazyTreeItem

A list item.

Initializes item.

Parameters

model (MinimalTreeModel, NoneType) – The model where the item belongs.

property db_map(self)[source]
property item_type(self)[source]
property name(self)[source]
property value_list(self)[source]
fetch_more(self)[source]

Fetches more children.

empty_child(self)[source]
data(self, column, role=Qt.DisplayRole)[source]

Returns data for given column and role.

set_data(self, column, value, role=Qt.EditRole)[source]

Sets data for this item.

Parameters
  • column (int) – column index

  • value (object) – a new value

  • role (int) – role of the new value

Returns

True if data was set successfully, False otherwise

Return type

bool

set_child_data(self, child, value)[source]
update_name_in_db(self, name)[source]
_new_value_list(self, child_number, value)[source]
update_value_list_in_db(self, child, value)[source]
add_to_db(self, child, value)[source]

Add item to db.

handle_updated_in_db(self)[source]

Runs when an item with this id has been updated in the db.

handle_added_to_db(self, identifier)[source]

Runs when the item with this name has been added to the db.

update_value_list(self)[source]
class spinetoolbox.spine_db_editor.mvcmodels.parameter_value_list_model.ValueItem(is_empty=False)[source]

Bases: spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.LastGrayMixin, spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.EditableMixin, spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.NonLazyTreeItem

A value item.

Initializes item.

Parameters

model (MinimalTreeModel, NoneType) – The model where the item belongs.

property item_type(self)[source]
property db_map(self)[source]
property value(self)[source]
data(self, column, role=Qt.DisplayRole)[source]

Returns data for given column and role.

set_data(self, column, value, role=Qt.EditRole)[source]

Sets data for this item.

Parameters
  • column (int) – column index

  • value (object) – a new value

  • role (int) – role of the new value

Returns

True if data was set successfully, False otherwise

Return type

bool

set_data_in_db(self, db_value)[source]
class spinetoolbox.spine_db_editor.mvcmodels.parameter_value_list_model.ParameterValueListModel(parent, db_mngr, *db_maps)[source]

Bases: spinetoolbox.spine_db_editor.mvcmodels.tree_model_base.TreeModelBase

A model to display parameter_value_list data in a tree view.

Parameters

Initialize class

add_parameter_value_lists(self, db_map_data)[source]
update_parameter_value_lists(self, db_map_data)[source]
remove_parameter_value_lists(self, db_map_data)[source]
static _make_db_item(db_map)[source]
static _top_children()[source]
columnCount(self, parent=QModelIndex())[source]

Returns the number of columns under the given parent. Always 1.

index_name(self, index)[source]
get_set_data_delayed(self, index)[source]

Returns a function that ParameterValueEditor can call to set data for the given index at any later time, even if the model changes.

Parameters

index (QModelIndex) –

Returns

function