tabularview_models

Spine Toolbox grid view

author:
  1. Vennström (VTT)
date:

1.11.2018

Module Contents

class tabularview_models.PivotModel[source]
rows[source]
columns[source]
clear_track_data(self)[source]

clears data that is tracked

set_new_data(self, data, index_names, index_type, rows=(), columns=(), frozen=(), frozen_value=(), index_entries=None, valid_index_values=None, tuple_index_entries=None, used_index_values=None, index_real_names=None)[source]

set the data of the model, index names and any additional indexes that don’t have data, valid index values.

static _is_invalid_pivot(rows, columns, frozen, frozen_value, index_names)[source]

checks if given pivot is valid for index_names, returns str with error message if invalid else None

_change_index_frozen(self)[source]

Filters out data with index values in index_frozen

_index_key_getter(self, names_of_index)[source]

creates a itemgetter that always returns tuples from list of index names

_get_unique_index_values(self, index, filter_index, filter_value)[source]

Finds unique index values for index names in index filtered by index names in filter_index with values in filter_value

set_pivot(self, rows, columns, frozen, frozen_value)[source]

Sets pivot for current data

set_frozen_value(self, value)[source]

Sets the value of the frozen indexes

static _index_entries_without_data(pivot_index, pivot_set, filter_index, filter_value, tuple_index_entries)[source]

find values in tuple_index_entries that are not present in pivot_set for index in pivot index filtered by filter_index and filter_value

get_pivoted_data(self, row_mask, col_mask)[source]

gets data from current pivot with indexes in row_mask and col_mask

set_pivoted_data(self, data, row_mask, col_mask)[source]

paste list of lists into current pivot, no change of indexes, row_mask list of indexes where to paste data rows in current pivot col_mask list of indexes where to paste data columns in current pivot

_add_index_value(self, value, name)[source]
_delete_data(self, key)[source]
_add_data(self, key, value)[source]
_restore_data(self, key)[source]
row(self, row)[source]
column(self, col)[source]
restore_pivoted_values(self, indexes)[source]

Restores all values for given indexes

delete_pivoted_values(self, indexes)[source]

Deletes values for given indexes

delete_tuple_index_values(self, delete_tuples)[source]

deletes values from keys with combination of indexes given that match tuple_index_entries

delete_index_values(self, delete_indexes)[source]

delete one ore more index value from data

_data_to_header(self, data, start_index, index_values, index_names, mask, direction)[source]
paste_data(self, row_start=0, row_header_data=None, col_start=0, col_header_data=None, data=None, row_mask=None, col_mask=None)[source]

Paste a list of list into current view of AbstractTable

edit_index(self, new_index, index_mask, direction)[source]

Edits the index of either row or column

is_valid_index(self, index, index_name)[source]

checks if if given index value is a valid value for given index

is_valid_key(self, key, existing_keys, key_names)[source]

Checks if given key (combination of indexes) is valid

class tabularview_models.PivotTableModel(parent=None)[source]

Bases: PySide2.QtCore.QAbstractTableModel

index_entries_changed[source]
plot_x_column[source]

Returns the index of the column designated as Y values for plotting or None.

set_data(self, data, index_names, index_type, rows=(), columns=(), frozen=(), frozen_value=(), index_entries=None, valid_index_values=None, tuple_index_entries=None, used_index_values=None, index_real_names=None)[source]
set_pivot(self, rows, columns, frozen, frozen_value)[source]
set_frozen_value(self, frozen_value)[source]
delete_values(self, indexes)[source]
delete_index_values(self, keys_dict)[source]
delete_tuple_index_values(self, tuple_key_dict)[source]
restore_values(self, indexes)[source]
get_key(self, index)[source]
get_col_key(self, column)[source]
paste_data(self, index, data, row_mask, col_mask)[source]

paste data into pivot model

_indexes_to_pivot_index(self, indexes)[source]
_update_header_data(self)[source]

updates the top left corner ‘header’ data

first_data_row(self)[source]

Returns the row index to the first data row.

dataRowCount(self)[source]

number of rows that contains actual data

dataColumnCount(self)[source]

number of columns that contains actual data

rowCount(self, parent=QModelIndex())[source]

Number of rows in table, number of header rows + datarows + 1 empty row

columnCount(self, parent=QModelIndex())[source]

Number of columns in table, number of header columns + datacolumns + 1 empty columns

flags(self, index)[source]

Roles for data

index_in_top_left(self, index)[source]

check if index is in top left corner, where pivot names are displayed

index_in_data(self, index)[source]

check if index is in data area

index_in_column_headers(self, index)[source]

check if index is in column headers (horizontal) area

index_in_row_headers(self, index)[source]

check if index is in row headers (vertical) area

set_plot_x_column(self, column, is_x)[source]

Sets or clears the Y flag on a column

set_index_key(self, index, value, direction)[source]

edits/sets a index value in a index in row/column

setData(self, index, value, role=Qt.EditRole)[source]
data(self, index, role=Qt.DisplayRole)[source]
headerData(self, section, orientation, role=Qt.DisplayRole)[source]
data_color(self, index)[source]
class tabularview_models.PivotTableSortFilterProxy(parent=None)[source]

Bases: PySide2.QtCore.QSortFilterProxyModel

set_filter(self, index_name, filter_value)[source]
clear_filter(self)[source]
accept_index(self, index, index_names)[source]
delete_values(self, delete_indexes)[source]
restore_values(self, indexes)[source]
paste_data(self, index, data)[source]
filterAcceptsRow(self, source_row, source_parent)[source]

Returns true if the item in the row indicated by the given source_row and source_parent should be included in the model; otherwise returns false. All the rules and subrules need to pass.

filterAcceptsColumn(self, source_column, source_parent)[source]

Returns true if the item in the column indicated by the given source_column and source_parent should be included in the model; otherwise returns false.

class tabularview_models.FilterCheckboxListModel(parent=None, show_empty=True)[source]

Bases: PySide2.QtCore.QAbstractListModel

reset_selection(self)[source]
_select_all_clicked(self)[source]
_is_all_selected(self)[source]
rowCount(self, parent=QModelIndex())[source]
data(self, index, role=Qt.DisplayRole)[source]
click_index(self, index)[source]
set_list(self, data, all_selected=True)[source]
add_item(self, items, selected=True)[source]
set_selected(self, selected, select_empty=None)[source]
get_selected(self)[source]
get_not_selected(self)[source]
set_filter(self, search_for)[source]
apply_filter(self)[source]
_remove_and_add_filtered(self)[source]
_remove_and_replace_filtered(self)[source]
remove_filter(self)[source]
remove_items(self, items)[source]