spinetoolbox.spine_db_editor.widgets.custom_delegates

Custom item delegates.

author:
  1. Marin (KTH)
date:

1.9.2018

Module Contents

Classes

RelationshipPivotTableDelegate A delegate that places a fully functioning QCheckBox.
ParameterPivotTableDelegate
param parent:
ParameterDelegate Base class for all custom parameter delegates.
DatabaseNameDelegate A delegate for the database name.
ParameterValueOrDefaultValueDelegate A delegate for the either the value or the default value.
ParameterDefaultValueDelegate A delegate for the either the default value.
ParameterValueDelegate A delegate for the parameter_value.
TagListDelegate A delegate for the parameter_tag list.
ValueListDelegate A delegate for the parameter_value-list.
ObjectClassNameDelegate A delegate for the object_class name.
RelationshipClassNameDelegate A delegate for the relationship_class name.
ParameterNameDelegate A delegate for the object parameter name.
ObjectNameDelegate A delegate for the object name.
AlternativeNameDelegate A delegate for the object name.
ObjectNameListDelegate A delegate for the object name list.
ManageItemsDelegate A custom delegate for the model in {Add/Edit}ItemDialogs.
ManageObjectClassesDelegate A delegate for the model and view in {Add/Edit}ObjectClassesDialog.
ManageObjectsDelegate A delegate for the model and view in {Add/Edit}ObjectsDialog.
ManageRelationshipClassesDelegate A delegate for the model and view in {Add/Edit}RelationshipClassesDialog.
ManageRelationshipsDelegate A delegate for the model and view in {Add/Edit}RelationshipsDialog.
RemoveEntitiesDelegate A delegate for the model and view in RemoveEntitiesDialog.
class spinetoolbox.spine_db_editor.widgets.custom_delegates.RelationshipPivotTableDelegate(parent)[source]

Bases: spinetoolbox.widgets.custom_delegates.CheckBoxDelegate

A delegate that places a fully functioning QCheckBox.

parent

either toolbox or spine datapackage widget

Type:QMainWindow
centered

whether or not the checkbox should be center-aligned in the widget

Type:bool
Parameters:parent (SpineDBEditor) –
data_committed[source]
static _is_relationship_index(index)[source]

Checks whether or not the given index corresponds to a relationship, in which case we need to use the check box delegate.

Returns:bool
setModelData(self, editor, model, index)[source]

Send signal.

setEditorData(self, editor, index)[source]

Do nothing. We’re setting editor data right away in createEditor.

paint(self, painter, option, index)[source]

Paint a checkbox without the label.

editorEvent(self, event, model, option, index)[source]

Change the data in the model and the state of the checkbox when user presses left mouse button and this cell is editable. Otherwise do nothing.

createEditor(self, parent, option, index)[source]

Important, otherwise an editor is created if the user clicks in this cell. ** Need to hook up a signal to the model.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterPivotTableDelegate(parent)[source]

Bases: PySide2.QtWidgets.QStyledItemDelegate

Parameters:parent (SpineDBEditor) –
parameter_value_editor_requested[source]
data_committed[source]
setModelData(self, editor, model, index)[source]

Send signal.

setEditorData(self, editor, index)[source]

Do nothing. We’re setting editor data right away in createEditor.

createEditor(self, parent, option, index)[source]
class spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate(parent, db_mngr)[source]

Bases: PySide2.QtWidgets.QStyledItemDelegate

Base class for all custom parameter delegates.

parent

tree or graph view form

Type:SpineDBEditor
db_mngr
Type:SpineDBManager
data_committed[source]
setModelData(self, editor, model, index)[source]

Send signal.

setEditorData(self, editor, index)[source]

Do nothing. We’re setting editor data right away in createEditor.

updateEditorGeometry(self, editor, option, index)[source]
_close_editor(self, editor, index)[source]

Closes editor. Needed by SearchBarEditor.

_get_db_map(self, index)[source]

Returns the db_map for the database at given index or None if not set yet.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.DatabaseNameDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the database name.

createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterValueOrDefaultValueDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the either the value or the default value.

parameter_value_editor_requested[source]
setModelData(self, editor, model, index)[source]

Sends signal.

_create_or_request_parameter_value_editor(self, parent, option, index, db_map)[source]

Emits the signal to request a standalone ParameterValueEditor from parent widget.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDefaultValueDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterValueOrDefaultValueDelegate

A delegate for the either the default value.

createEditor(self, parent, option, index)[source]

Returns or requests a parameter_value editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterValueDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterValueOrDefaultValueDelegate

A delegate for the parameter_value.

setModelData(self, editor, model, index)[source]

Send signal.

_get_value_list_id(self, index, db_map)[source]

Returns a value list item for the given index and db_map.

createEditor(self, parent, option, index)[source]

If the parameter has associated a value list, returns a SearchBarEditor. Otherwise returns or requests a dedicated parameter_value editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.TagListDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the parameter_tag list.

createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ValueListDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the parameter_value-list.

createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ObjectClassNameDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the object_class name.

createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.RelationshipClassNameDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the relationship_class name.

createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterNameDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the object parameter name.

createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ObjectNameDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the object name.

createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.AlternativeNameDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the object name.

createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ObjectNameListDelegate(parent, db_mngr)[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ParameterDelegate

A delegate for the object name list.

object_name_list_editor_requested[source]
createEditor(self, parent, option, index)[source]

Returns editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageItemsDelegate[source]

Bases: PySide2.QtWidgets.QStyledItemDelegate

A custom delegate for the model in {Add/Edit}ItemDialogs.

parent

parent dialog

Type:ManageItemsDialog
data_committed[source]
setModelData(self, editor, model, index)[source]

Send signal.

close_editor(self, editor, index, model)[source]
updateEditorGeometry(self, editor, option, index)[source]
connect_editor_signals(self, editor, index)[source]

Connect editor signals if necessary.

_create_database_editor(self, parent, option, index)[source]
createEditor(self, parent, option, index)[source]

Returns an editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageObjectClassesDelegate[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageItemsDelegate

A delegate for the model and view in {Add/Edit}ObjectClassesDialog.

parent

parent dialog

Type:ManageItemsDialog
icon_color_editor_requested[source]
createEditor(self, parent, option, index)[source]

Return editor.

paint(self, painter, option, index)[source]

Get a pixmap from the index data and paint it in the middle of the cell.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageObjectsDelegate[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageItemsDelegate

A delegate for the model and view in {Add/Edit}ObjectsDialog.

parent

parent dialog

Type:ManageItemsDialog
createEditor(self, parent, option, index)[source]

Return editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageRelationshipClassesDelegate[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageItemsDelegate

A delegate for the model and view in {Add/Edit}RelationshipClassesDialog.

parent

parent dialog

Type:ManageItemsDialog
createEditor(self, parent, option, index)[source]

Return editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageRelationshipsDelegate[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageItemsDelegate

A delegate for the model and view in {Add/Edit}RelationshipsDialog.

parent

parent dialog

Type:ManageItemsDialog
createEditor(self, parent, option, index)[source]

Return editor.

class spinetoolbox.spine_db_editor.widgets.custom_delegates.RemoveEntitiesDelegate[source]

Bases: spinetoolbox.spine_db_editor.widgets.custom_delegates.ManageItemsDelegate

A delegate for the model and view in RemoveEntitiesDialog.

parent

parent dialog

Type:ManageItemsDialog
createEditor(self, parent, option, index)[source]

Return editor.