spinetoolbox.widgets.custom_delegates

Custom item delegates.

author:
  1. Marin (KTH)
date:

1.9.2018

Module Contents

class spinetoolbox.widgets.custom_delegates.ComboBoxDelegate(parent, choices)[source]

Bases: PySide2.QtWidgets.QItemDelegate

createEditor(self, parent, option, index)[source]
paint(self, painter, option, index)[source]
setEditorData(self, editor, index)[source]
setModelData(self, editor, model, index)[source]
updateEditorGeometry(self, editor, option, index)[source]
currentItemChanged(self)[source]
class spinetoolbox.widgets.custom_delegates.LineEditDelegate[source]

Bases: PySide2.QtWidgets.QItemDelegate

A delegate that places a fully functioning QLineEdit.

parent

either data store or spine datapackage widget

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

Return CustomLineEditor. Set up a validator depending on datatype.

setEditorData(self, editor, index)[source]

Init the line editor with previous data from the index.

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

Send signal.

class spinetoolbox.widgets.custom_delegates.CheckBoxDelegate(parent, centered=True)[source]

Bases: PySide2.QtWidgets.QItemDelegate

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
data_committed[source]
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.

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.

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

Do nothing. Model data is updated by handling the data_committed signal.

get_checkbox_rect(self, option)[source]
class spinetoolbox.widgets.custom_delegates.PivotTableDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.CheckBoxDelegate

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

Send signal.

_is_entity_index(self, index)[source]
paint(self, painter, option, index)[source]
editorEvent(self, event, model, option, index)[source]
createEditor(self, parent, option, index)[source]
class spinetoolbox.widgets.custom_delegates.GetObjectClassIdMixin[source]

Allows getting the object class id from the name.

_get_object_class_id(self, index, db_map)[source]
class spinetoolbox.widgets.custom_delegates.GetRelationshipClassIdMixin[source]

Allows getting the relationship class id from the name.

_get_relationship_class_id(self, index, db_map)[source]
class spinetoolbox.widgets.custom_delegates.ParameterDelegate(parent, db_mngr)[source]

Bases: PySide2.QtWidgets.QItemDelegate

Base class for all custom parameter delegates.

parent

tree or graph view form

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

Send signal.

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.widgets.custom_delegates.DatabaseNameDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.ParameterDelegate

A delegate for the database name.

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

Returns editor.

class spinetoolbox.widgets.custom_delegates.ParameterValueOrDefaultValueDelegate[source]

Bases: spinetoolbox.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]

Emits the data_committed signal with new data.

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

Returns a CustomLineEditor or NumberParameterInlineEditor if the data from index is not of special type. Otherwise, emit the signal to request a standalone ParameterValueEditor from parent widget.

class spinetoolbox.widgets.custom_delegates.ParameterDefaultValueDelegate[source]

Bases: spinetoolbox.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.widgets.custom_delegates.ParameterValueDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.ParameterValueOrDefaultValueDelegate

A delegate for the parameter value.

_get_entity_class_id(self, index, db_map)[source]
_get_value_list(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.widgets.custom_delegates.ObjectParameterValueDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.GetObjectClassIdMixin, spinetoolbox.widgets.custom_delegates.ParameterValueDelegate

A delegate for the object parameter value.

entity_class_id_key[source]
_get_entity_class_id(self, index, db_map)[source]
class spinetoolbox.widgets.custom_delegates.RelationshipParameterValueDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.GetRelationshipClassIdMixin, spinetoolbox.widgets.custom_delegates.ParameterValueDelegate

A delegate for the relationship parameter value.

entity_class_id_key[source]
_get_entity_class_id(self, index, db_map)[source]
class spinetoolbox.widgets.custom_delegates.TagListDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.ParameterDelegate

A delegate for the parameter tag list.

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

Returns editor.

class spinetoolbox.widgets.custom_delegates.ValueListDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.ParameterDelegate

A delegate for the parameter value-list.

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

Returns editor.

class spinetoolbox.widgets.custom_delegates.ObjectClassNameDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.ParameterDelegate

A delegate for the object class name.

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

Returns editor.

class spinetoolbox.widgets.custom_delegates.RelationshipClassNameDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.ParameterDelegate

A delegate for the relationship class name.

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

Returns editor.

class spinetoolbox.widgets.custom_delegates.ObjectParameterNameDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.GetObjectClassIdMixin, spinetoolbox.widgets.custom_delegates.ParameterDelegate

A delegate for the object parameter name.

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

Returns editor.

class spinetoolbox.widgets.custom_delegates.RelationshipParameterNameDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.GetRelationshipClassIdMixin, spinetoolbox.widgets.custom_delegates.ParameterDelegate

A delegate for the relationship parameter name.

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

Returns editor.

class spinetoolbox.widgets.custom_delegates.ObjectNameDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.GetObjectClassIdMixin, spinetoolbox.widgets.custom_delegates.ParameterDelegate

A delegate for the object name.

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

Returns editor.

class spinetoolbox.widgets.custom_delegates.ObjectNameListDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.GetRelationshipClassIdMixin, spinetoolbox.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.widgets.custom_delegates.ManageItemsDelegate[source]

Bases: PySide2.QtWidgets.QItemDelegate

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]
class spinetoolbox.widgets.custom_delegates.ManageObjectClassesDelegate[source]

Bases: spinetoolbox.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.widgets.custom_delegates.ManageObjectsDelegate[source]

Bases: spinetoolbox.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.widgets.custom_delegates.ManageRelationshipClassesDelegate[source]

Bases: spinetoolbox.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.widgets.custom_delegates.ManageRelationshipsDelegate[source]

Bases: spinetoolbox.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.widgets.custom_delegates.RemoveEntitiesDelegate[source]

Bases: spinetoolbox.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.

class spinetoolbox.widgets.custom_delegates.ManageParameterTagsDelegate[source]

Bases: spinetoolbox.widgets.custom_delegates.ManageItemsDelegate

A delegate for the model and view in ManageParameterTagsDialog.

parent

parent dialog

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

Return editor.

class spinetoolbox.widgets.custom_delegates.ForeignKeysDelegate(parent)[source]

Bases: PySide2.QtWidgets.QItemDelegate

A QComboBox delegate with checkboxes.

parent

spine datapackage widget

Type:SpineDatapackageWidget
data_committed[source]
close_field_name_list_editor(self, editor, index, model)[source]
createEditor(self, parent, option, index)[source]

Return editor.

setEditorData(self, editor, index)[source]

Set editor data.

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

Send signal.