mda_file_table_model#

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:

  1. A data field selection could have one of four states:
    • unselected (None)

    • “X”: abscissa (independent axis)

    • “Y” : ordinate (dependent axes)

    • “Mon” : divide this array into each Y

  2. Only zero or one data field can be selected as “X”.

  3. Only zero or one data field can be selected as “Mon”.

  4. 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.

MDAFileTableModel(*args, **kwargs)

Select fields for plots.

ColumnDataType()

Data types expected by TableColumn.column_type.

FieldRuleType()

Data field selection rule types.

TableColumn(name, column_type, *, rule)

One column of the table.

TableField(name, selection, *, desc, pv, unit)

One data field candidate for user-selection.

class mdaviz.mda_file_table_model.ColumnDataType[source]#

Data types expected by TableColumn.column_type.

class mdaviz.mda_file_table_model.FieldRuleType[source]#

Data field selection rule types.

apply(*args, **kwargs)[source]#

Apply the selection rule.

class mdaviz.mda_file_table_model.MDAFileTableModel(*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 for a given cell: (row, column) = (index.row(), index.column()).

applySelectionRules(index[, changes])

Apply selection rules 2-4.

updateCheckboxes([new_selection, ...])

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.

plotFields()

Returns a dictionary with the selected fields to be plotted.

https://doc.qt.io/qtforpython-5/PySide2/QtCore/QAbstractTableModel.html

applySelectionRules(index, changes=False)[source]#

Apply selection rules 2-4.

checkbox(index)[source]#

Return the checkbox state for a given cell: (row, column) = (index.row(), index.column()).

checkboxStateChanged#

alias of dict

clearAllCheckboxes()[source]#

Clears (unchecks) all checkboxes in the model.

columnCount(parent=None)[source]#

Number of columns.

data(index, role=None)[source]#

Table data. Called by QTableView.

fields()[source]#

Return a list of the field names.

flags(index)[source]#

Identify the checkbox cells. Called by QTableView.

headerData(section, orientation, role=PyQt5.QtCore.Qt.DisplayRole)[source]#

Column headers. Called by QTableView.

plotFields()[source]#

Returns a dictionary with the selected fields to be plotted.

key=column_name, value= row_number(s) or fieldName(s)

rowCount(parent=None)[source]#

Number of fields.

setCheckbox(index, state)[source]#

Set the checkbox state.

setColumns(columns)[source]#

Define the columns for the table.

setData(index, value, role)[source]#

Toggle the checkboxes. Called by QTableView.

setFields(fields)[source]#

Define the data fields (rows) for the table.

updateCheckboxes(new_selection=None, old_selection=None, update_mda_mvc=True)[source]#

Update checkboxes to agree with self.selections.

class mdaviz.mda_file_table_model.TableColumn(name: str, column_type: ~mdaviz.mda_file_table_model.ColumnDataType, *, rule: (<class 'mdaviz.mda_file_table_model.FieldRuleType'>, None) = None)[source]#

One column of the table.

class mdaviz.mda_file_table_model.TableField(name: str, selection: (<class 'str'>, None) = None, *, desc: str = '', pv: str = '', unit: str = '')[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.)