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
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]