time_pattern_model

A model for time patterns, used by the parameter value editors.

authors:
  1. Soininen (VTT)
date:

4.7.2019

Module Contents

class time_pattern_model.TimePatternModel(value)[source]

Bases: indexed_value_table_model.IndexedValueTableModel

A model for time pattern type parameter values.

value

a time pattern value

Type:TimePattern
flags(self, index)[source]

Returns flags at index.

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

removeRows(self, row, count, parent=QModelIndex())[source]

Removes time period - value pairs from the pattern.

row

an index where to remove the data

Type:int
count

number of time period - value pairs to remove

Type:int
parent

an index to a parent model

Type:QModelIndex
Returns:True if the operation was successful
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.

index

an index to the model

Type:QModelIndex
value

a new time period or value

Type:str, float
role

a role

Type:int
Returns:True if the operation was successful
batch_set_data(self, indexes, values)[source]

Sets data for several indexes at once.

Parameters:
  • indexes (Sequence) – a sequence of model indexes
  • values (Sequence) – a sequence of time periods/floats corresponding to the indexes