spinetoolbox.widgets.parameter_value_editor_base

A base for editor windows for editing parameter values.

Module Contents

Classes

ValueType

Enum to identify value types that use different editors.

ParameterValueEditorBase

Dialog for editing parameter values.

Attributes

_SELECTORS

class spinetoolbox.widgets.parameter_value_editor_base.ValueType[source]

Bases: enum.Enum

Enum to identify value types that use different editors.

PLAIN_VALUE[source]
MAP[source]
TIME_SERIES_FIXED_RESOLUTION[source]
TIME_SERIES_VARIABLE_RESOLUTION[source]
TIME_PATTERN[source]
ARRAY[source]
DATETIME[source]
DURATION[source]
spinetoolbox.widgets.parameter_value_editor_base._SELECTORS[source]
class spinetoolbox.widgets.parameter_value_editor_base.ParameterValueEditorBase(index, editor_widgets, parent=None)[source]

Bases: PySide6.QtWidgets.QWidget

Dialog for editing parameter values.

The dialog takes an index and shows a specialized editor corresponding to the value type in a stack widget. The user can change the value type by changing the specialized editor using a combo box. When the dialog is closed the value from the currently shown specialized editor is written back to the given index.

Parameters
  • index (QModelIndex) – an index to a parameter_value in parent_model

  • editor_widgets (dict) – a mapping from ValueType to QWidget

  • parent (QWidget, optional) – a parent widget

accept()[source]

Saves the parameter_value shown in the currently selected editor widget to the database manager.

_change_parameter_type(selector_index)[source]

Handles switching between value types.

Does a rude conversion between fixed and variable resolution time series. In other cases, a default ‘empty’ value is used.

Parameters

selector_index (int) – an index to the selector combo box

_select_editor(value)[source]

Shows the editor widget corresponding to the given value type on the editor stack.

_use_default_editor(message=None)[source]

Opens the default editor widget. Optionally, displays a warning dialog indicating the problem.

Parameters

message (str, optional) –

_use_editor(value, value_type)[source]

Sets a value to edit on an editor widget.

Parameters
  • value (object) – value to edit

  • value_type (ValueType) – type of value

abstract _set_data(value)[source]

Writes parameter value back to the model.

Parameters

value (object) – value to write

Returns

True if the operation was successful, False otherwise

Return type

bool