select_fields_tablemodel#
Select data fields for 1-D plotting: QAbstractTableModel.
General plot model is: Y/Mon vs X. If X is not selected, use index number. If Mon is not selected, use 1.0 (trivial case, do not divide by Mon).
Data Field Selection Rules:
- A data field selection could have one of four states:
unselected (None)
“X”: ordinate (independent axis)
“Y” : abcissae (dependent axes)
“Mon” : divide this array into each Y
Only zero or one data field can be selected as “X”.
Only zero or one data field can be selected as “Mon”.
One or more data fields can be selected as “Y”.
When Model/View is created, the view should call ‘model.setFields(fields)’ with the list of field names for selection. (If ‘fields’ is a different structure, such a ‘list(object)’ or ‘dict(str=object)’, then change both ‘columns()’ and ‘fields()’ so that each returns ‘list(str)’.) Note that ‘model.setFields(fields)’ can only be called once.
|
Select fields for plots. |
Data types expected by TableColumn.column_type. |
|
Data field selection rule types. |
|
|
One column of the table. |
|
One data field candidate for user-selection. |
- class gemviz.select_fields_tablemodel.ColumnDataType[source]#
Data types expected by TableColumn.column_type.
- class gemviz.select_fields_tablemodel.SelectFieldsTableModel(*args: Any, **kwargs: Any)[source]#
Select fields for plots.
rowCount
([parent])Number of fields.
columnCount
([parent])Number of columns.
data
(index[, role])Table data.
headerData
(section, orientation[, role])Column headers.
setData
(index, value, role)Toggle the checkboxes.
flags
(index)Identify the checkbox cells.
checkbox
(index)Return the checkbox state.
applySelectionRules
(index[, changes])Apply selection rules 2-4.
Update checkboxes to agree with self.selections.
logCheckboxSelections
()columnName
(column)columnNumber
(column_name)columns
()setColumns
(columns)Define the columns for the table.
fieldName
(row)fieldText
(index)fields
()Return a list of the field names.
setFields
(fields)Define the data fields (rows) for the table.
Returns a dictionary with the selected fields to be plotted.
Return the plot selections dictionary.
setSelections
([selections])Plot selections: dict(row_number=column number}
setSelectionsItem
(key, value)Set the key in the plot selections dictionary.
https://doc.qt.io/qtforpython-5/PySide2/QtCore/QAbstractTableModel.html
- headerData(section, orientation, role=PyQt5.QtCore.Qt.DisplayRole)[source]#
Column headers. Called by QTableView.
- class gemviz.select_fields_tablemodel.TableColumn(name: str, column_type: ~gemviz.select_fields_tablemodel.ColumnDataType, *, rule: (<class 'gemviz.select_fields_tablemodel.FieldRuleType'>, None) = None)[source]#
One column of the table.
- class gemviz.select_fields_tablemodel.TableField(name: str, selection: (<class 'str'>, None) = None, *, description: str = '', pv: str = '', shape: tuple = ())[source]#
One data field candidate for user-selection.
NOTE: Data for the “Description” and “PV” TableColumns is provided by the “description” and “pv” attributes here using cname.lower(). (FIXME: This could break. Easily.)