spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility

A tree model for parameter_value lists.

Module Contents

Classes

StandardTreeItem

A tree item that fetches their children as they are inserted.

EditableMixin

GrayIfLastMixin

Paints the item gray if it's the last.

BoldTextMixin

Bolds text.

EmptyChildMixin

Guarantees there's always an empty child.

SortChildrenMixin

FetchMoreMixin

StandardDBItem

An item representing a db.

LeafItem

A tree item that fetches their children as they are inserted.

class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.StandardTreeItem(model)[source]

Bases: spinetoolbox.mvcmodels.minimal_tree_model.TreeItem

A tree item that fetches their children as they are inserted.

Parameters

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

property item_type[source]
property db_mngr[source]
property display_data[source]
property icon_code[source]
property display_icon[source]
property non_empty_children[source]
property children_ids[source]
tool_tip(column)[source]
data(column, role=Qt.ItemDataRole.DisplayRole)[source]

Returns data for given column and role.

set_data(column, value, role=Qt.ItemDataRole.DisplayRole)[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

class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.EditableMixin[source]
flags(column)[source]

Makes items editable.

class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.GrayIfLastMixin[source]

Paints the item gray if it’s the last.

data(column, role=Qt.ItemDataRole.DisplayRole)[source]
class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.BoldTextMixin[source]

Bolds text.

data(column, role=Qt.ItemDataRole.DisplayRole)[source]
class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.EmptyChildMixin[source]

Guarantees there’s always an empty child.

property non_empty_children[source]
abstract empty_child()[source]
_do_set_up()[source]
class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.SortChildrenMixin[source]
_children_sort_key(child)[source]
insert_children_sorted(children)[source]
class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.FetchMoreMixin(*args, **kwargs)[source]
property fetch_item_type[source]
tear_down()[source]
_fetch_parents()[source]
can_fetch_more()[source]
fetch_more()[source]
abstract _make_child(id_)[source]
_do_make_child(id_)[source]
accepts_item(item, db_map)[source]
handle_items_added(db_map_data)[source]

Inserts items at right positions. Items with commit_id are kept sorted. Items without a commit_id are put at the end.

Parameters

db_map_data (dict) – mapping db_map to list of dict corresponding to db items

handle_items_removed(db_map_data)[source]
handle_items_updated(db_map_data)[source]
class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.StandardDBItem(model, db_map)[source]

Bases: SortChildrenMixin, StandardTreeItem

An item representing a db.

Init class.

Parameters
property item_type[source]
data(column, role=Qt.ItemDataRole.DisplayRole)[source]

Shows Spine icon for fun.

class spinetoolbox.spine_db_editor.mvcmodels.tree_item_utility.LeafItem(model, identifier=None)[source]

Bases: StandardTreeItem

A tree item that fetches their children as they are inserted.

Parameters
  • model (MinimalTreeModel) –

  • identifier (int, optional) – item’s database id

abstract property item_type[source]
property db_map[source]
property id[source]
property item_data[source]
property name[source]
_make_item_data()[source]
tool_tip(column)[source]
abstract add_item_to_db(db_item)[source]
abstract update_item_in_db(db_item)[source]
header_data(column)[source]
data(column, role=Qt.ItemDataRole.DisplayRole)[source]

Returns data for given column and role.

set_data(column, value, role=Qt.ItemDataRole.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

_make_item_to_add(value)[source]
_make_item_to_update(column, value)[source]
handle_updated_in_db()[source]
can_fetch_more()[source]

Returns whether this item can fetch more.