rayoptics.qtgui.pytablemodel module

Table model supporting data content via python eval() fct

class PyTableModel(root, rootEvalStr, colEvalStr, rowHeaders, colHeaders, colFormats, is_editable=False, get_num_rows=None, get_row_headers=None, drop_actions=None)[source]

Bases: QAbstractTableModel

Table model supporting data content via python eval() fct.

Model interface for table view of list structures.

root

object or list at the root of the eval() string

rootEvalStr

string that is concatentated to the root name and passed to the eval() function. This will accomodate dynamic name changes.

colEvalStr

string that is concatentated to the root name and passed to the eval() function. There should be a replacement field, i.e. {} where the row value will be substituted using the str.format() function.

rowHeaders

list of strings, length defines number of rows in the table

colHeaders

list of strings, length defines number of columns in the table

colFormats

format strings to be used to format data in each column

is_editable

if true, items are editable

get_num_rows

if not None, a function that returns the number of rows in the table

get_row_headers

if not None, a function that returns the row headers for the table

update

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

rowCount(self, parent: QModelIndex = QModelIndex()) int[source]
columnCount(self, parent: QModelIndex = QModelIndex()) int[source]
headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.ItemDataRole.DisplayRole) Any[source]
flags(self, index: QModelIndex) Qt.ItemFlags[source]
get_root_object()[source]
data(self, index: QModelIndex, role: int = Qt.ItemDataRole.DisplayRole) Any[source]
setData(self, index: QModelIndex, value: Any, role: int = Qt.ItemDataRole.EditRole) bool[source]