spinetoolbox.mvcmodels.time_pattern_model
¶
A model for time patterns, used by the parameter_value editors.
- authors
Soininen (VTT)
- date
4.7.2019
Module Contents¶
Classes¶
A model for time pattern type parameter values. |
- class spinetoolbox.mvcmodels.time_pattern_model.TimePatternModel(value)[source]¶
Bases:
spinetoolbox.mvcmodels.indexed_value_table_model.IndexedValueTableModel
A model for time pattern type parameter values.
- Parameters
value (TimePattern) – a time pattern value
- insertRows(self, row, count, parent=QModelIndex())[source]¶
Inserts new time period - value pairs into the pattern.
New time periods are initialized to empty strings and the corresponding values to zeros.
- Parameters
row (int) – an index where to insert the new data
count (int) – number of time period - value pairs to insert
parent (QModelIndex) – an index to a parent model
- Returns
True if the operation was successful
- Return type
bool
- removeRows(self, row, count, parent=QModelIndex())[source]¶
Removes time period - value pairs from the pattern.
- Parameters
row (int) – an index where to remove the data
count (int) – number of time period - value pairs to remove
parent (QModelIndex) – an index to a parent model
- Returns
True if the operation was successful
- Return type
bool
- setData(self, index, value, role=Qt.EditRole)[source]¶
Sets a time period or a value in the pattern.
Column index 0 corresponds to the time periods while 1 corresponds to the values.
- Parameters
index (QModelIndex) – an index to the model
value (str, float) – a new time period or value
role (int) – a role
- Returns
True if the operation was successful
- Return type
bool