widgets.parameter_value_editor

An editor dialog for editing database (relationship) parameter values.

author:
  1. Soininen (VTT)
date:

28.6.2019

Module Contents

class widgets.parameter_value_editor._Editor[source]

Bases: enum.Enum

Indexes for the specialized editors corresponding to the selector combo box and editor stack.

PLAIN_VALUE = 0[source]
TIME_SERIES_FIXED_RESOLUTION = 1[source]
TIME_SERIES_VARIABLE_RESOLUTION = 2[source]
TIME_PATTERN = 3[source]
DATETIME = 4[source]
DURATION = 5[source]
class widgets.parameter_value_editor.ParameterValueEditor(parent_index, value_name='', value=None, parent_widget=None)[source]

Bases: PySide2.QtWidgets.QDialog

Dialog for editing (relationship) parameter values.

The dialog takes the editable value from a parent model 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 parent model.

parent_index

an index to a parameter value in parent_model

Type:QModelIndex
value_name

name of the value

Type:str
value

parameter value or None if it should be loaded from parent_index

parent_widget

a parent widget

Type:QWidget
accept(self)[source]

Saves the parameter value shown in the currently selected editor widget back to the parent model.

_change_parameter_type(self, 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(self, value)[source]

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

_warn_and_select_default_view(self, message)[source]

Displays a warning dialog and opens the default editor widget after user clicks OK.