spinetoolbox.widgets.custom_qtableview
¶
Custom QTableView classes that support copy-paste and the like.
author: |
|
---|---|
date: | 18.5.2018 |
Module Contents¶
-
class
spinetoolbox.widgets.custom_qtableview.
CopyPasteTableView
[source]¶ Bases:
PySide2.QtWidgets.QTableView
Custom QTableView class with copy and paste methods.
-
static
_read_pasted_text
(text)[source]¶ Parses a tab separated CSV text table.
Parameters: text (str) – a CSV formatted table Returns: a list of rows
-
static
-
class
spinetoolbox.widgets.custom_qtableview.
PivotTableView
(parent=None)[source]¶ Bases:
spinetoolbox.widgets.custom_qtableview.CopyPasteTableView
Custom QTableView class with pivot capabilities.
-
parent
¶ The parent of this view
Type: QWidget
Initialize the class.
-
-
class
spinetoolbox.widgets.custom_qtableview.
AutoFilterCopyPasteTableView
(parent)[source]¶ Bases:
spinetoolbox.widgets.custom_qtableview.CopyPasteTableView
Custom QTableView class with autofilter functionality.
-
parent
¶ The parent of this view
Type: QWidget
Initializes the view.
Parameters: parent (QObject) – -
keyPressEvent
(self, event)[source]¶ Shows the autofilter menu if the user presses Alt + Down.
Parameters: event (QEvent) –
-
setModel
(self, model)[source]¶ Disconnects the sectionPressed signal which seems to be connected by the super method. Otherwise pressing the header just selects the column.
Parameters: model (QAbstractItemModel) –
Called when user clicks on a horizontal section header. Shows/hides the auto filter widget.
Parameters: logical_index (int) –
-
-
class
spinetoolbox.widgets.custom_qtableview.
IndexedParameterValueTableViewBase
[source]¶ Bases:
spinetoolbox.widgets.custom_qtableview.CopyPasteTableView
Custom QTableView base class with copy and paste methods for indexed parameter values.
-
class
spinetoolbox.widgets.custom_qtableview.
TimeSeriesFixedResolutionTableView
[source]¶ Bases:
spinetoolbox.widgets.custom_qtableview.IndexedParameterValueTableViewBase
A QTableView for fixed resolution time series table.
-
static
_read_pasted_text
(text)[source]¶ Parses the given CSV table.
Parsing is locale aware.
Parameters: text (str) – a CSV table containing numbers Returns: A list of floats
-
_paste_to_values_column
(self, values, first_row, paste_length)[source]¶ Pastes data to the Values column.
Parameters: - values (list) – a list of float values to paste
- first_row (int) – index of the first row where to paste
- paste_length (int) – length of the paste selection (can be different from len(values))
Returns: A tuple (list(pasted indexes), list(pasted values))
-
static
-
class
spinetoolbox.widgets.custom_qtableview.
IndexedValueTableView
[source]¶ Bases:
spinetoolbox.widgets.custom_qtableview.IndexedParameterValueTableViewBase
A QTableView class with for variable resolution time series and time patterns.
-
_paste_two_columns
(self, data_indexes, data_values, first_row, paste_length)[source]¶ Pastes data indexes and values.
Parameters: - data_indexes (list) – a list of data indexes (time stamps/durations)
- data_values (list) – a list of data values
- first_row (int) – first row index
- paste_length (int) – selection length for pasting
Returns: a tuple (modified model indexes, modified model values)
-
_paste_single_column
(self, values, first_row, first_column, paste_length)[source]¶ Pastes a single column of data
Parameters: - values (list) – a list of data to paste (data indexes or values)
- first_row (int) – first row index
- paste_length (int) – selection length for pasting
Returns: a tuple (modified model indexes, modified model values)
-