schrodinger.ui.qt.table_helper module

Classes to help in creating PyQt table models and views

schrodinger.ui.qt.table_helper.data_method(*roles)

A decorator for RowBasedTableModel and RowBasedListModel methods that provide data. The decorator itself must be given arguments of the Qt roles that the method will provide data for.

The decorated RowBasedTableModel method must take two or three arguments. Two argument methods will be passed:

  • The column number of the requested data (int)

  • The ROW_CLASS object representing the row to provide data for three argument methods will also be passed:

    • The Qt role (int)

The decorated RowBasedListModel method must take one or two arguments. One argument methods will be passed:

  • The ROW_CLASS object representing the row to provide data for Two argument methods will also be passed:

    • The Qt role (int)

See table_helper_example for examples of decorated methods.

schrodinger.ui.qt.table_helper.model_reset_method(func, self, *args, **kwargs)

A decorator for RowBasedTableModel and RowBasedListModel methods that reset the data model. See ModelResetContextMixin for a context manager version of this.

class schrodinger.ui.qt.table_helper.ModelResetContextMixin

Bases: object

A mixin for QtCore.QAbstractItemModel subclasses that adds a modelResetContext context manager to reset the model.

modelResetContext()

A context manager for resetting the model. See model_reset_method for a decorator version of this.

class schrodinger.ui.qt.table_helper.DataMethodDecoratorMixin(*args, **kwargs)

Bases: object

A mixin for QtCore.QAbstractItemModel subclasses that use the data_method mixin. Subclasses must define _genDataArgs.

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

data(index, role=0)

Provide data for the specified index and role. Classes should not redefine this method. Instead, new methods should be created and decorated with data_method.

See Qt documentation for an explanation of arguments and return value

class schrodinger.ui.qt.table_helper.DataMethodDecoratorProxyMixin(*args, **kwargs)

Bases: schrodinger.ui.qt.table_helper.DataMethodDecoratorMixin

A mixin for QtCore.QAbstractProxyModel subclasses that use the data_method mixin.

data(proxy_index, role=0)

Provide data for the specified index and role. Classes should not redefine this method. Instead, new methods should be created and decorated with data_method. If no data method for the requested role is found, then the source model’s data() method will be called.

See Qt documentation for an explanation of arguments and return value

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

class schrodinger.ui.qt.table_helper.RowBasedModelMixin(parent=None)

Bases: schrodinger.ui.qt.table_helper.ModelResetContextMixin, schrodinger.ui.qt.table_helper.DataMethodDecoratorMixin

A table model where data is organized in rows. This class is intended to be subclassed and should not be instantiated directly. All subclasses must redefine COLUMN and must include at least one method decorated with data_method. Subclasses must also redefine:

Data may be added to the table using loadData or appendRow. Data may be deleted using removeRow or removeRows. Subclass methods that reset the model may use the model_reset_method decorator.

Variables
  • Column (TableColumns) – A class describing the table’s columns. See TableColumns.

  • ROW_CLASS (type) – A class that represents a single row of the table. ROW_CLASS must be defined in any subclasses that use appendRow

  • ROW_LIST_OFFSET (int) – The index of the first element in self._rows. Setting this value to 1 allows the class to be used with one-indexed lists.

  • SHOW_ROW_NUMBERS (bool) – Whether to show row numbers in the vertical header.

The following class variables are the deprecated way of specifying columns. They may not be given if Column is used:

Variables
  • COLUMN (type) – May not be given if Column is used. A alternative method for describing the table’s columns. Column should be preferred for newly created RowTableModel subclasses. A class containing constants describing the table columns. COLUMN must also include the following attributes: (HEADERS: A list of column headers (list), NUM_COLS: The number of columns in the table (int), TOOLTIPS (optional): A list of column header tooltips (list)).

  • EDITABLE_COLS (list) – May not be given if Column is used. Use editable=True in the TableColumn declaration instead. A list of column numbers for columns that should be flagged as editable. Note that only one of EDITABLE_COLS and UNEDITABLE_COLS may be provided. If neither are provided, then no columns will be editable.

  • UNEDITABLE_COLS (list) – May not be given if Column is used. Use editable=False in the TableColumn declaration instead. A list of column numbers for columns that should be flagged as uneditable. Not necessary if COLUMN is a TableColumns object. Note that only one of EDITABLE_COLS and UNEDITABLE_COLS may be provided. If neither are provided, then no columns will be editable.

  • CHECKABLE_COLS (list) – May not be given if Column is used. Use checkable=True in the TableColumn declaration instead. A list of column numbers for columns that should be flagged as user checkable.

  • NO_DATA_CHANGED (object) – A flag that can be returned from _setData to indicate that setting the data succeeded, but that there’s no need to emit a dataChanged signal.

COLUMN = None
Column = None
EDITABLE_COLS = <object object>
UNEDITABLE_COLS = <object object>
CHECKABLE_COLS = ()
ROW_CLASS = None
ROW_LIST_OFFSET = 0
SHOW_ROW_NUMBERS = False
NO_DATA_CHANGED = <object object>
__init__(parent=None)

Initialize self. See help(type(self)) for accurate signature.

reset()

Remove all data from the model

columnCount(parent=None)
rowCount(parent=None)
property rows

Iterate over all rows in the model. If any data is changed, call rowChanged() method with the row’s 0-indexed number to update the view.

rowChanged(row_number)

Call this method when a specific row object has been modified. Will cause the view to redraw that row.

Parameters

row_number (int) – 0-indexed row number in the model. Corresponds to the index in the “.rows” iterator.

columnChanged(col_number)

Call this method when a specific column object has been modified. Will cause the view to redraw that column.

Parameters

col_number (int) – 0-indexed column number in the model.

loadData(rows)

Load data into the table and replace all existing data.

Parameters

rows (list) – A list of ROW_CLASS objects

appendRow(*args, **kwargs)

Add a row to the table. All arguments are passed to ROW_CLASS initialization.

Returns

The row number of the new row

Return type

int

appendRowObject(row)

Add a row to the table.

Parameters

row (ROW_CLASS) – Row object to add to the table.

Returns

The row number of the new row

Return type

int

removeRows(row, count, parent=None)
removeRowsByRowNumbers(rows)

Remove the given rows from the model, specified by row number, 0-indexed.

removeRowsByIndices(indices)

Remove all rows from the model specified by the given QModelIndex items.

headerData(section, orientation, role=0)

Provide column headers, and optionally column tooltips and row numbers.

See Qt documentation for an explanation of arguments and return value

flags(index)

See Qt documentation for an method documentation.

setData(index, value, role=2)

Set data for the specified index and role. Whenever possible, sub- classes should redefine _setData rather than this method.

See Qt documentation for an explanation of arguments and return value.

formatFloat(value, role, digits, fmt='')

Format floating point values for display or sorting. If role is Qt.DisplayRole, then value will be returned as a string with the specified formatting. All other role values are assumed to be a sorting role and value will be returned unchanged.

Parameters
  • value (float) – The floating point value to format

  • role (int) – The Qt data role

  • digits (int) – The number of digits to include after the decimal point for Qt.DisplayRole

  • fmt (str) – Additional floating point formatting options

Returns

The formatted or unmodified value

Return type

str or float

af2SettingsGetValue()

This function adds support for the settings mixin. It allows to save table cell values in case this table is included in the settings panel. Returns list of rows if table model is of RowBasedTableModel class type.

Returns

list of rows in tbe table’s model.

Return type

list or None

af2SettingsSetValue(value)

This function adds support for the settings mixin. It allows to set table cell values when this table is included in the settings panel.

Parameters

value (list) – settings value, which is a list of row data here.

replaceRows(new_rows)

Replace the contents of the model with the contents of the given list. The change will be presented to the view as a series of row insertions and deletions rather than as a model reset. This allows the view to properly update table selections and scroll bar position. This method may only be used if:

  • the ROW_CLASS objects can be compared using < and ==

  • the contents of the model (i.e. self._rows) are sorted in ascending order

  • the contents of new_rows are sorted in ascending order

This method is primarily intended for use when the table contains rows based on project table rows. On every project change, the project table can be reread and used to generate new_list and this method can then properly update the model.

Parameters

new_rows (list) – A list of ROW_CLASS objects

data(index, role=0)

Provide data for the specified index and role. Classes should not redefine this method. Instead, new methods should be created and decorated with data_method.

See Qt documentation for an explanation of arguments and return value

modelResetContext()

A context manager for resetting the model. See model_reset_method for a decorator version of this.

class schrodinger.ui.qt.table_helper.RowBasedTableModel(parent=None)

Bases: schrodinger.ui.qt.table_helper.RowBasedModelMixin, PyQt5.QtCore.QAbstractTableModel

CHECKABLE_COLS = ()
COLUMN = None
class CheckIndexOption(value)

Bases: enum.IntEnum

An enumeration.

DoNotUseParent = 2
IndexIsValid = 1
NoOption = 0
ParentIsInvalid = 4
class CheckIndexOptions

Bases: sip.simplewrapper

QAbstractItemModel.CheckIndexOptions(Union[QAbstractItemModel.CheckIndexOptions, QAbstractItemModel.CheckIndexOption]) QAbstractItemModel.CheckIndexOptions(QAbstractItemModel.CheckIndexOptions)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Column = None
EDITABLE_COLS = <object object>
HorizontalSortHint = 2
class LayoutChangeHint

Bases: int

NO_DATA_CHANGED = <object object>
NoLayoutChangeHint = 0
ROW_CLASS = None
ROW_LIST_OFFSET = 0
SHOW_ROW_NUMBERS = False
UNEDITABLE_COLS = <object object>
VerticalSortHint = 1
__init__(parent=None)

Initialize self. See help(type(self)) for accurate signature.

af2SettingsGetValue()

This function adds support for the settings mixin. It allows to save table cell values in case this table is included in the settings panel. Returns list of rows if table model is of RowBasedTableModel class type.

Returns

list of rows in tbe table’s model.

Return type

list or None

af2SettingsSetValue(value)

This function adds support for the settings mixin. It allows to set table cell values when this table is included in the settings panel.

Parameters

value (list) – settings value, which is a list of row data here.

appendRow(*args, **kwargs)

Add a row to the table. All arguments are passed to ROW_CLASS initialization.

Returns

The row number of the new row

Return type

int

appendRowObject(row)

Add a row to the table.

Parameters

row (ROW_CLASS) – Row object to add to the table.

Returns

The row number of the new row

Return type

int

RowBasedTableModel.beginInsertColumns(self, QModelIndex, int, int)
RowBasedTableModel.beginInsertRows(self, QModelIndex, int, int)
RowBasedTableModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
RowBasedTableModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
RowBasedTableModel.beginRemoveColumns(self, QModelIndex, int, int)
RowBasedTableModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
blockSignals(self, bool) → bool
buddy(self, QModelIndex) → QModelIndex
canDropMimeData(self, QMimeData, Qt.DropAction, int, int, QModelIndex) → bool
canFetchMore(self, QModelIndex) → bool
RowBasedTableModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
checkIndex(self, QModelIndex, options: Union[QAbstractItemModel.CheckIndexOptions, QAbstractItemModel.CheckIndexOption] = QAbstractItemModel.CheckIndexOption.NoOption) → bool
childEvent(self, QChildEvent)
children(self) → List[QObject]
columnChanged(col_number)

Call this method when a specific column object has been modified. Will cause the view to redraw that column.

Parameters

col_number (int) – 0-indexed column number in the model.

columnCount(self, parent: QModelIndex = QModelIndex()) → int
columnsAboutToBeInserted

columnsAboutToBeInserted(self, QModelIndex, int, int) [signal]

columnsAboutToBeMoved

columnsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

columnsAboutToBeRemoved

columnsAboutToBeRemoved(self, QModelIndex, int, int) [signal]

columnsInserted

columnsInserted(self, QModelIndex, int, int) [signal]

columnsMoved

columnsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

columnsRemoved

columnsRemoved(self, QModelIndex, int, int) [signal]

connectNotify(self, QMetaMethod)
RowBasedTableModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
data(index, role=0)

Provide data for the specified index and role. Classes should not redefine this method. Instead, new methods should be created and decorated with data_method.

See Qt documentation for an explanation of arguments and return value

dataChanged

dataChanged(self, QModelIndex, QModelIndex, roles: Iterable[int] = []) [signal]

RowBasedTableModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dropMimeData(self, QMimeData, Qt.DropAction, int, int, QModelIndex) → bool
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
fetchMore(self, QModelIndex)
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

flags(index)

See Qt documentation for an method documentation.

formatFloat(value, role, digits, fmt='')

Format floating point values for display or sorting. If role is Qt.DisplayRole, then value will be returned as a string with the specified formatting. All other role values are assumed to be a sorting role and value will be returned unchanged.

Parameters
  • value (float) – The floating point value to format

  • role (int) – The Qt data role

  • digits (int) – The number of digits to include after the decimal point for Qt.DisplayRole

  • fmt (str) – Additional floating point formatting options

Returns

The formatted or unmodified value

Return type

str or float

hasChildren(self, parent: QModelIndex = QModelIndex()) → bool
RowBasedTableModel.hasIndex(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
headerData(section, orientation, role=0)

Provide column headers, and optionally column tooltips and row numbers.

See Qt documentation for an explanation of arguments and return value

headerDataChanged

headerDataChanged(self, Qt.Orientation, int, int) [signal]

RowBasedTableModel.index(self, int, int, parent: QModelIndex = QModelIndex()) -> QModelIndex
inherits(self, str) → bool
insertColumn(self, int, parent: QModelIndex = QModelIndex()) → bool
RowBasedTableModel.insertColumns(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
insertRow(self, int, parent: QModelIndex = QModelIndex()) → bool
RowBasedTableModel.insertRows(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
itemData(self, QModelIndex) → Dict[int, Any]
killTimer(self, int)
layoutAboutToBeChanged

layoutAboutToBeChanged(self, parents: Iterable[QPersistentModelIndex] = [], hint: QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]

layoutChanged

layoutChanged(self, parents: Iterable[QPersistentModelIndex] = [], hint: QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]

loadData(rows)

Load data into the table and replace all existing data.

Parameters

rows (list) – A list of ROW_CLASS objects

match(self, QModelIndex, int, Any, hits: int = 1, flags: Union[Qt.MatchFlags, Qt.MatchFlag] = Qt.MatchStartsWith | Qt.MatchWrap) → List[QModelIndex]
metaObject(self) → QMetaObject
mimeData(self, Iterable[QModelIndex]) → QMimeData
mimeTypes(self) → List[str]
modelAboutToBeReset

modelAboutToBeReset(self) [signal]

modelReset

modelReset(self) [signal]

modelResetContext()

A context manager for resetting the model. See model_reset_method for a decorator version of this.

RowBasedTableModel.moveColumn(self, QModelIndex, int, QModelIndex, int) -> bool
RowBasedTableModel.moveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
RowBasedTableModel.moveRow(self, QModelIndex, int, QModelIndex, int) -> bool
RowBasedTableModel.moveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
moveToThread(self, QThread)
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) → QObject
persistentIndexList(self) → List[QModelIndex]
property(self, str) → Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) → int
removeColumn(self, int, parent: QModelIndex = QModelIndex()) → bool
RowBasedTableModel.removeColumns(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
removeEventFilter(self, QObject)
removeRow(self, int, parent: QModelIndex = QModelIndex()) → bool
RowBasedTableModel.removeRows(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
removeRowsByIndices(indices)

Remove all rows from the model specified by the given QModelIndex items.

removeRowsByRowNumbers(rows)

Remove the given rows from the model, specified by row number, 0-indexed.

replaceRows(new_rows)

Replace the contents of the model with the contents of the given list. The change will be presented to the view as a series of row insertions and deletions rather than as a model reset. This allows the view to properly update table selections and scroll bar position. This method may only be used if:

  • the ROW_CLASS objects can be compared using < and ==

  • the contents of the model (i.e. self._rows) are sorted in ascending order

  • the contents of new_rows are sorted in ascending order

This method is primarily intended for use when the table contains rows based on project table rows. On every project change, the project table can be reread and used to generate new_list and this method can then properly update the model.

Parameters

new_rows (list) – A list of ROW_CLASS objects

reset()

Remove all data from the model

resetInternalData(self)
revert(self)
roleNames(self) → Dict[int, QByteArray]
rowChanged(row_number)

Call this method when a specific row object has been modified. Will cause the view to redraw that row.

Parameters

row_number (int) – 0-indexed row number in the model. Corresponds to the index in the “.rows” iterator.

rowCount(self, parent: QModelIndex = QModelIndex()) → int
property rows

Iterate over all rows in the model. If any data is changed, call rowChanged() method with the row’s 0-indexed number to update the view.

rowsAboutToBeInserted

rowsAboutToBeInserted(self, QModelIndex, int, int) [signal]

rowsAboutToBeMoved

rowsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

rowsAboutToBeRemoved

rowsAboutToBeRemoved(self, QModelIndex, int, int) [signal]

rowsInserted

rowsInserted(self, QModelIndex, int, int) [signal]

rowsMoved

rowsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

rowsRemoved

rowsRemoved(self, QModelIndex, int, int) [signal]

sender(self) → QObject
senderSignalIndex(self) → int
setData(index, value, role=2)

Set data for the specified index and role. Whenever possible, sub- classes should redefine _setData rather than this method.

See Qt documentation for an explanation of arguments and return value.

setHeaderData(self, int, Qt.Orientation, Any, role: int = Qt.EditRole) → bool
setItemData(self, QModelIndex, Dict[int, Any]) → bool
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) → bool
RowBasedTableModel.sibling(self, int, int, QModelIndex) -> QModelIndex
signalsBlocked(self) → bool
sort(self, int, order: Qt.SortOrder = Qt.AscendingOrder)
span(self, QModelIndex) → QSize
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
submit(self) → bool
supportedDragActions(self) → Qt.DropActions
supportedDropActions(self) → Qt.DropActions
thread(self) → QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) → str
class schrodinger.ui.qt.table_helper.RowBasedListModel(parent=None)

Bases: schrodinger.ui.qt.table_helper.RowBasedModelMixin, PyQt5.QtCore.QAbstractTableModel

A model class for use with QtWidgets.QListView views. The model has no headers and only one column. Note that the Column class variable is not needed.

columnCount(self, parent: QModelIndex = QModelIndex()) → int
headerData(section, orientation, role=0)

Provide column headers, and optionally column tooltips and row numbers.

See Qt documentation for an explanation of arguments and return value

RowBasedListModel.index(self, int, int, parent: QModelIndex = QModelIndex()) -> QModelIndex
CHECKABLE_COLS = ()
COLUMN = None
class CheckIndexOption(value)

Bases: enum.IntEnum

An enumeration.

DoNotUseParent = 2
IndexIsValid = 1
NoOption = 0
ParentIsInvalid = 4
class CheckIndexOptions

Bases: sip.simplewrapper

QAbstractItemModel.CheckIndexOptions(Union[QAbstractItemModel.CheckIndexOptions, QAbstractItemModel.CheckIndexOption]) QAbstractItemModel.CheckIndexOptions(QAbstractItemModel.CheckIndexOptions)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Column = None
EDITABLE_COLS = <object object>
HorizontalSortHint = 2
class LayoutChangeHint

Bases: int

NO_DATA_CHANGED = <object object>
NoLayoutChangeHint = 0
ROW_CLASS = None
ROW_LIST_OFFSET = 0
SHOW_ROW_NUMBERS = False
UNEDITABLE_COLS = <object object>
VerticalSortHint = 1
__init__(parent=None)

Initialize self. See help(type(self)) for accurate signature.

af2SettingsGetValue()

This function adds support for the settings mixin. It allows to save table cell values in case this table is included in the settings panel. Returns list of rows if table model is of RowBasedTableModel class type.

Returns

list of rows in tbe table’s model.

Return type

list or None

af2SettingsSetValue(value)

This function adds support for the settings mixin. It allows to set table cell values when this table is included in the settings panel.

Parameters

value (list) – settings value, which is a list of row data here.

appendRow(*args, **kwargs)

Add a row to the table. All arguments are passed to ROW_CLASS initialization.

Returns

The row number of the new row

Return type

int

appendRowObject(row)

Add a row to the table.

Parameters

row (ROW_CLASS) – Row object to add to the table.

Returns

The row number of the new row

Return type

int

RowBasedListModel.beginInsertColumns(self, QModelIndex, int, int)
RowBasedListModel.beginInsertRows(self, QModelIndex, int, int)
RowBasedListModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
RowBasedListModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
RowBasedListModel.beginRemoveColumns(self, QModelIndex, int, int)
RowBasedListModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
blockSignals(self, bool) → bool
buddy(self, QModelIndex) → QModelIndex
canDropMimeData(self, QMimeData, Qt.DropAction, int, int, QModelIndex) → bool
canFetchMore(self, QModelIndex) → bool
RowBasedListModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
checkIndex(self, QModelIndex, options: Union[QAbstractItemModel.CheckIndexOptions, QAbstractItemModel.CheckIndexOption] = QAbstractItemModel.CheckIndexOption.NoOption) → bool
childEvent(self, QChildEvent)
children(self) → List[QObject]
columnChanged(col_number)

Call this method when a specific column object has been modified. Will cause the view to redraw that column.

Parameters

col_number (int) – 0-indexed column number in the model.

columnsAboutToBeInserted

columnsAboutToBeInserted(self, QModelIndex, int, int) [signal]

columnsAboutToBeMoved

columnsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

columnsAboutToBeRemoved

columnsAboutToBeRemoved(self, QModelIndex, int, int) [signal]

columnsInserted

columnsInserted(self, QModelIndex, int, int) [signal]

columnsMoved

columnsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

columnsRemoved

columnsRemoved(self, QModelIndex, int, int) [signal]

connectNotify(self, QMetaMethod)
RowBasedListModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
data(index, role=0)

Provide data for the specified index and role. Classes should not redefine this method. Instead, new methods should be created and decorated with data_method.

See Qt documentation for an explanation of arguments and return value

dataChanged

dataChanged(self, QModelIndex, QModelIndex, roles: Iterable[int] = []) [signal]

RowBasedListModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dropMimeData(self, QMimeData, Qt.DropAction, int, int, QModelIndex) → bool
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
fetchMore(self, QModelIndex)
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

flags(index)

See Qt documentation for an method documentation.

formatFloat(value, role, digits, fmt='')

Format floating point values for display or sorting. If role is Qt.DisplayRole, then value will be returned as a string with the specified formatting. All other role values are assumed to be a sorting role and value will be returned unchanged.

Parameters
  • value (float) – The floating point value to format

  • role (int) – The Qt data role

  • digits (int) – The number of digits to include after the decimal point for Qt.DisplayRole

  • fmt (str) – Additional floating point formatting options

Returns

The formatted or unmodified value

Return type

str or float

hasChildren(self, parent: QModelIndex = QModelIndex()) → bool
RowBasedListModel.hasIndex(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
headerDataChanged

headerDataChanged(self, Qt.Orientation, int, int) [signal]

inherits(self, str) → bool
insertColumn(self, int, parent: QModelIndex = QModelIndex()) → bool
RowBasedListModel.insertColumns(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
insertRow(self, int, parent: QModelIndex = QModelIndex()) → bool
RowBasedListModel.insertRows(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
itemData(self, QModelIndex) → Dict[int, Any]
killTimer(self, int)
layoutAboutToBeChanged

layoutAboutToBeChanged(self, parents: Iterable[QPersistentModelIndex] = [], hint: QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]

layoutChanged

layoutChanged(self, parents: Iterable[QPersistentModelIndex] = [], hint: QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]

loadData(rows)

Load data into the table and replace all existing data.

Parameters

rows (list) – A list of ROW_CLASS objects

match(self, QModelIndex, int, Any, hits: int = 1, flags: Union[Qt.MatchFlags, Qt.MatchFlag] = Qt.MatchStartsWith | Qt.MatchWrap) → List[QModelIndex]
metaObject(self) → QMetaObject
mimeData(self, Iterable[QModelIndex]) → QMimeData
mimeTypes(self) → List[str]
modelAboutToBeReset

modelAboutToBeReset(self) [signal]

modelReset

modelReset(self) [signal]

modelResetContext()

A context manager for resetting the model. See model_reset_method for a decorator version of this.

RowBasedListModel.moveColumn(self, QModelIndex, int, QModelIndex, int) -> bool
RowBasedListModel.moveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
RowBasedListModel.moveRow(self, QModelIndex, int, QModelIndex, int) -> bool
RowBasedListModel.moveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
moveToThread(self, QThread)
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) → QObject
persistentIndexList(self) → List[QModelIndex]
property(self, str) → Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) → int
removeColumn(self, int, parent: QModelIndex = QModelIndex()) → bool
RowBasedListModel.removeColumns(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
removeEventFilter(self, QObject)
removeRow(self, int, parent: QModelIndex = QModelIndex()) → bool
RowBasedListModel.removeRows(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
removeRowsByIndices(indices)

Remove all rows from the model specified by the given QModelIndex items.

removeRowsByRowNumbers(rows)

Remove the given rows from the model, specified by row number, 0-indexed.

replaceRows(new_rows)

Replace the contents of the model with the contents of the given list. The change will be presented to the view as a series of row insertions and deletions rather than as a model reset. This allows the view to properly update table selections and scroll bar position. This method may only be used if:

  • the ROW_CLASS objects can be compared using < and ==

  • the contents of the model (i.e. self._rows) are sorted in ascending order

  • the contents of new_rows are sorted in ascending order

This method is primarily intended for use when the table contains rows based on project table rows. On every project change, the project table can be reread and used to generate new_list and this method can then properly update the model.

Parameters

new_rows (list) – A list of ROW_CLASS objects

reset()

Remove all data from the model

resetInternalData(self)
revert(self)
roleNames(self) → Dict[int, QByteArray]
rowChanged(row_number)

Call this method when a specific row object has been modified. Will cause the view to redraw that row.

Parameters

row_number (int) – 0-indexed row number in the model. Corresponds to the index in the “.rows” iterator.

rowCount(self, parent: QModelIndex = QModelIndex()) → int
property rows

Iterate over all rows in the model. If any data is changed, call rowChanged() method with the row’s 0-indexed number to update the view.

rowsAboutToBeInserted

rowsAboutToBeInserted(self, QModelIndex, int, int) [signal]

rowsAboutToBeMoved

rowsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

rowsAboutToBeRemoved

rowsAboutToBeRemoved(self, QModelIndex, int, int) [signal]

rowsInserted

rowsInserted(self, QModelIndex, int, int) [signal]

rowsMoved

rowsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

rowsRemoved

rowsRemoved(self, QModelIndex, int, int) [signal]

sender(self) → QObject
senderSignalIndex(self) → int
setData(index, value, role=2)

Set data for the specified index and role. Whenever possible, sub- classes should redefine _setData rather than this method.

See Qt documentation for an explanation of arguments and return value.

setHeaderData(self, int, Qt.Orientation, Any, role: int = Qt.EditRole) → bool
setItemData(self, QModelIndex, Dict[int, Any]) → bool
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) → bool
RowBasedListModel.sibling(self, int, int, QModelIndex) -> QModelIndex
signalsBlocked(self) → bool
sort(self, int, order: Qt.SortOrder = Qt.AscendingOrder)
span(self, QModelIndex) → QSize
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
submit(self) → bool
supportedDragActions(self) → Qt.DropActions
supportedDropActions(self) → Qt.DropActions
thread(self) → QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) → str
class schrodinger.ui.qt.table_helper.PythonSortProxyModel(parent=None)

Bases: PyQt5.QtCore.QSortFilterProxyModel

A sorting proxy model that uses Python (rather than C++) to compare values. This allows Python lists, tuples, and custom classes to be properly sorted.

Variables
  • SORT_ROLE (int) – If specified in a subclass, this value will be used as the sort role. Otherwise, Qt defaults to Qt.DisplayRole.

  • DYNAMIC_SORT_FILTER (bool) – If specified in a subclass, this value will be used as the dynamic sorting and filtering setting (see QtCore.QSortFilterProxyModel.setDynamicSortFilter). Otherwise, Qt defaults to False in Qt4 and True in Qt5.

SORT_ROLE = None
DYNAMIC_SORT_FILTER = None
__init__(parent=None)

Initialize self. See help(type(self)) for accurate signature.

lessThan(left, right)

Comparison method for sorting rows and columns. Handle special case in which one or more sort data values is None by evaluating it as less than every other value.

Parameters
  • left (QtCore.QModelIndex) – table cell index

  • right (QtCore.QModelIndex) – table cell index

See Qt documentation for full method documentation.

class CheckIndexOption(value)

Bases: enum.IntEnum

An enumeration.

DoNotUseParent = 2
IndexIsValid = 1
NoOption = 0
ParentIsInvalid = 4
class CheckIndexOptions

Bases: sip.simplewrapper

QAbstractItemModel.CheckIndexOptions(Union[QAbstractItemModel.CheckIndexOptions, QAbstractItemModel.CheckIndexOption]) QAbstractItemModel.CheckIndexOptions(QAbstractItemModel.CheckIndexOptions)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

HorizontalSortHint = 2
class LayoutChangeHint

Bases: int

NoLayoutChangeHint = 0
VerticalSortHint = 1
PythonSortProxyModel.beginInsertColumns(self, QModelIndex, int, int)
PythonSortProxyModel.beginInsertRows(self, QModelIndex, int, int)
PythonSortProxyModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
PythonSortProxyModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
PythonSortProxyModel.beginRemoveColumns(self, QModelIndex, int, int)
PythonSortProxyModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
blockSignals(self, bool) → bool
buddy(self, QModelIndex) → QModelIndex
canDropMimeData(self, QMimeData, Qt.DropAction, int, int, QModelIndex) → bool
canFetchMore(self, QModelIndex) → bool
PythonSortProxyModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
checkIndex(self, QModelIndex, options: Union[QAbstractItemModel.CheckIndexOptions, QAbstractItemModel.CheckIndexOption] = QAbstractItemModel.CheckIndexOption.NoOption) → bool
childEvent(self, QChildEvent)
children(self) → List[QObject]
columnCount(self, parent: QModelIndex = QModelIndex()) → int
columnsAboutToBeInserted

columnsAboutToBeInserted(self, QModelIndex, int, int) [signal]

columnsAboutToBeMoved

columnsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

columnsAboutToBeRemoved

columnsAboutToBeRemoved(self, QModelIndex, int, int) [signal]

columnsInserted

columnsInserted(self, QModelIndex, int, int) [signal]

columnsMoved

columnsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

columnsRemoved

columnsRemoved(self, QModelIndex, int, int) [signal]

connectNotify(self, QMetaMethod)
PythonSortProxyModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
data(self, QModelIndex, role: int = Qt.DisplayRole) → Any
dataChanged

dataChanged(self, QModelIndex, QModelIndex, roles: Iterable[int] = []) [signal]

PythonSortProxyModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dropMimeData(self, QMimeData, Qt.DropAction, int, int, QModelIndex) → bool
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
dynamicSortFilter(self) → bool
encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
fetchMore(self, QModelIndex)
filterAcceptsColumn(self, int, QModelIndex) → bool
filterAcceptsRow(self, int, QModelIndex) → bool
filterCaseSensitivity(self) → Qt.CaseSensitivity
filterKeyColumn(self) → int
filterRegExp(self) → QRegExp
filterRegularExpression(self) → QRegularExpression
filterRole(self) → int
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

flags(self, QModelIndex) → Qt.ItemFlags
hasChildren(self, parent: QModelIndex = QModelIndex()) → bool
PythonSortProxyModel.hasIndex(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
headerData(self, int, Qt.Orientation, role: int = Qt.DisplayRole) → Any
headerDataChanged

headerDataChanged(self, Qt.Orientation, int, int) [signal]

PythonSortProxyModel.index(self, int, int, parent: QModelIndex = QModelIndex()) -> QModelIndex
inherits(self, str) → bool
insertColumn(self, int, parent: QModelIndex = QModelIndex()) → bool
PythonSortProxyModel.insertColumns(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
insertRow(self, int, parent: QModelIndex = QModelIndex()) → bool
PythonSortProxyModel.insertRows(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
installEventFilter(self, QObject)
invalidate(self)
invalidateFilter(self)
isRecursiveFilteringEnabled(self) → bool
isSignalConnected(self, QMetaMethod) → bool
isSortLocaleAware(self) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
itemData(self, QModelIndex) → Dict[int, Any]
killTimer(self, int)
layoutAboutToBeChanged

layoutAboutToBeChanged(self, parents: Iterable[QPersistentModelIndex] = [], hint: QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]

layoutChanged

layoutChanged(self, parents: Iterable[QPersistentModelIndex] = [], hint: QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]

mapFromSource(self, QModelIndex) → QModelIndex
mapSelectionFromSource(self, QItemSelection) → QItemSelection
mapSelectionToSource(self, QItemSelection) → QItemSelection
mapToSource(self, QModelIndex) → QModelIndex
match(self, QModelIndex, int, Any, hits: int = 1, flags: Union[Qt.MatchFlags, Qt.MatchFlag] = Qt.MatchStartsWith | Qt.MatchWrap) → List[QModelIndex]
metaObject(self) → QMetaObject
mimeData(self, Iterable[QModelIndex]) → QMimeData
mimeTypes(self) → List[str]
modelAboutToBeReset

modelAboutToBeReset(self) [signal]

modelReset

modelReset(self) [signal]

PythonSortProxyModel.moveColumn(self, QModelIndex, int, QModelIndex, int) -> bool
PythonSortProxyModel.moveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
PythonSortProxyModel.moveRow(self, QModelIndex, int, QModelIndex, int) -> bool
PythonSortProxyModel.moveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
moveToThread(self, QThread)
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self, QModelIndex) → QModelIndex

parent(self) -> QObject

persistentIndexList(self) → List[QModelIndex]
property(self, str) → Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) → int
removeColumn(self, int, parent: QModelIndex = QModelIndex()) → bool
PythonSortProxyModel.removeColumns(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
removeEventFilter(self, QObject)
removeRow(self, int, parent: QModelIndex = QModelIndex()) → bool
PythonSortProxyModel.removeRows(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
resetInternalData(self)
revert(self)
roleNames(self) → Dict[int, QByteArray]
rowCount(self, parent: QModelIndex = QModelIndex()) → int
rowsAboutToBeInserted

rowsAboutToBeInserted(self, QModelIndex, int, int) [signal]

rowsAboutToBeMoved

rowsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

rowsAboutToBeRemoved

rowsAboutToBeRemoved(self, QModelIndex, int, int) [signal]

rowsInserted

rowsInserted(self, QModelIndex, int, int) [signal]

rowsMoved

rowsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

rowsRemoved

rowsRemoved(self, QModelIndex, int, int) [signal]

sender(self) → QObject
senderSignalIndex(self) → int
setData(self, QModelIndex, Any, role: int = Qt.EditRole) → bool
setDynamicSortFilter(self, bool)
setFilterCaseSensitivity(self, Qt.CaseSensitivity)
setFilterFixedString(self, str)
setFilterKeyColumn(self, int)
setFilterRegExp(self, QRegExp)

setFilterRegExp(self, str)

setFilterRegularExpression(self, QRegularExpression)

setFilterRegularExpression(self, str)

setFilterRole(self, int)
setFilterWildcard(self, str)
setHeaderData(self, int, Qt.Orientation, Any, role: int = Qt.EditRole) → bool
setItemData(self, QModelIndex, Dict[int, Any]) → bool
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) → bool
setRecursiveFilteringEnabled(self, bool)
setSortCaseSensitivity(self, Qt.CaseSensitivity)
setSortLocaleAware(self, bool)
setSortRole(self, int)
setSourceModel(self, QAbstractItemModel)
PythonSortProxyModel.sibling(self, int, int, QModelIndex) -> QModelIndex
signalsBlocked(self) → bool
sort(self, int, order: Qt.SortOrder = Qt.AscendingOrder)
sortCaseSensitivity(self) → Qt.CaseSensitivity
sortColumn(self) → int
sortOrder(self) → Qt.SortOrder
sortRole(self) → int
sourceModel(self) → QAbstractItemModel
sourceModelChanged

sourceModelChanged(self) [signal]

span(self, QModelIndex) → QSize
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
submit(self) → bool
supportedDragActions(self) → Qt.DropActions
supportedDropActions(self) → Qt.DropActions
thread(self) → QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) → str
class schrodinger.ui.qt.table_helper.SampleDataTableViewMixin(parent=None, sample_data=None)

Bases: object

A table view mixin that uses sample data to properly size columns. Additionally, the table size hint will attempt to display the full width of the table.

Variables
  • SAMPLE_DATA (dict) – A dictionary of {column number: sample string}. Any columns that do not appear in this dictionary will not be resized. Can be set by passing sample_data to __init__ or by calling setSampleData after instantiation.

  • MARGIN (int) – The additional width to add to each column included in SAMPLE_DATA

MARGIN = 20
__init__(parent=None, sample_data=None)

Initialize self. See help(type(self)) for accurate signature.

SAMPLE_DATA = {}
setModel(model)

After setting the model, resize the columns using SAMPLE_DATA and the header data provided by the model

See Qt documentation for an explanation of arguments

setSampleData(new_sample_data)

Sets SAMPLE_DATA to new_sample_data and updates column widths if model is set.

Parameters

new_sample_data (dict) – The new sample data

sizeHintForColumn(col_num)

Provide a size hint for the specified column using SAMPLE_DATA. Note that this method does not take header width into account as the header width is already accounted for in resizeColumnToContents.

See Qt documentation for an explanation of arguments and return value

sizeHint()

Provide a size hint that requests the full width of the table.

See Qt documentation for an explanation of arguments and return value

class schrodinger.ui.qt.table_helper.SampleDataTableView(parent=None, sample_data=None)

Bases: schrodinger.ui.qt.table_helper.SampleDataTableViewMixin, schrodinger.ui.qt.swidgets.STableView

See SampleDataTableViewMixin for features.

AboveItem = 1
AdjustIgnored = 0
AdjustToContents = 2
AdjustToContentsOnFirstShow = 1
AllEditTriggers = 31
AnimatingState = 6
AnyKeyPressed = 16
BelowItem = 2
Box = 1
CollapsingState = 5
ContiguousSelection = 4
CurrentChanged = 1
class CursorAction

Bases: int

DoubleClicked = 2
DragDrop = 3
class DragDropMode

Bases: int

DragOnly = 1
DragSelectingState = 2
DraggingState = 1
DrawChildren = 2
DrawWindowBackground = 1
class DropIndicatorPosition

Bases: int

DropOnly = 2
EditKeyPressed = 8
class EditTrigger

Bases: int

class EditTriggers

Bases: sip.simplewrapper

QAbstractItemView.EditTriggers(Union[QAbstractItemView.EditTriggers, QAbstractItemView.EditTrigger]) QAbstractItemView.EditTriggers(QAbstractItemView.EditTriggers)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

EditingState = 3
EnsureVisible = 0
ExpandingState = 4
ExtendedSelection = 3
HLine = 4
IgnoreMask = 4
InternalMove = 4
MARGIN = 20
MoveDown = 1
MoveEnd = 5
MoveHome = 4
MoveLeft = 2
MoveNext = 8
MovePageDown = 7
MovePageUp = 6
MovePrevious = 9
MoveRight = 3
MoveUp = 0
MultiSelection = 2
NoDragDrop = 0
NoEditTriggers = 0
NoFrame = 0
NoSelection = 0
NoState = 0
OnItem = 0
OnViewport = 3
class PaintDeviceMetric

Bases: int

Panel = 2
PdmDepth = 6
PdmDevicePixelRatio = 11
PdmDevicePixelRatioScaled = 12
PdmDpiX = 7
PdmDpiY = 8
PdmHeight = 2
PdmHeightMM = 4
PdmNumColors = 5
PdmPhysicalDpiX = 9
PdmPhysicalDpiY = 10
PdmWidth = 1
PdmWidthMM = 3
Plain = 16
PositionAtBottom = 2
PositionAtCenter = 3
PositionAtTop = 1
Raised = 32
class RenderFlag

Bases: int

class RenderFlags

Bases: sip.simplewrapper

QWidget.RenderFlags(Union[QWidget.RenderFlags, QWidget.RenderFlag]) QWidget.RenderFlags(QWidget.RenderFlags)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

SAMPLE_DATA = {}
class ScrollHint

Bases: int

class ScrollMode

Bases: int

ScrollPerItem = 0
ScrollPerPixel = 1
SelectColumns = 2
SelectItems = 0
SelectRows = 1
SelectedClicked = 4
class SelectionBehavior

Bases: int

class SelectionMode

Bases: int

class Shadow

Bases: int

Shadow_Mask = 240
class Shape

Bases: int

Shape_Mask = 15
SingleSelection = 1
class SizeAdjustPolicy

Bases: int

class State

Bases: int

class StyleMask

Bases: int

StyledPanel = 6
Sunken = 48
VLine = 5
WinPanel = 3
__init__(parent=None, sample_data=None)

Initialize self. See help(type(self)) for accurate signature.

acceptDrops(self) → bool
accessibleDescription(self) → str
accessibleName(self) → str
actionEvent(self, QActionEvent)
actions(self) → List[QAction]
activateWindow(self)
activated

activated(self, QModelIndex) [signal]

addAction(self, QAction)
addActions(self, Iterable[QAction])
addScrollBarWidget(self, QWidget, Union[Qt.Alignment, Qt.AlignmentFlag])
adjustSize(self)
alternatingRowColors(self) → bool
autoFillBackground(self) → bool
autoScrollMargin(self) → int
backgroundRole(self) → QPalette.ColorRole
baseSize(self) → QSize
blockSignals(self, bool) → bool
changeEvent(self, QEvent)
childAt(self, QPoint) → QWidget

childAt(self, int, int) -> QWidget

childEvent(self, QChildEvent)
children(self) → List[QObject]
childrenRect(self) → QRect
childrenRegion(self) → QRegion
clearFocus(self)
clearMask(self)
clearSelection(self)
clearSpans(self)
clicked

clicked(self, QModelIndex) [signal]

close(self) → bool
closeEditor(self, QWidget, QAbstractItemDelegate.EndEditHint)
closeEvent(self, QCloseEvent)
closePersistentEditor(self, QModelIndex)
colorCount(self) → int
columnAt(self, int) → int
SampleDataTableView.columnCountChanged(self, int, int)
SampleDataTableView.columnMoved(self, int, int, int)
SampleDataTableView.columnResized(self, int, int, int)
SampleDataTableView.columnSpan(self, int, int) -> int
columnViewportPosition(self, int) → int
columnWidth(self, int) → int
commitData(self, QWidget)
connectNotify(self, QMetaMethod)
contentsMargins(self) → QMargins
contentsRect(self) → QRect
contextMenuEvent(self, QContextMenuEvent)
contextMenuPolicy(self) → Qt.ContextMenuPolicy
cornerWidget(self) → QWidget
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
createWindowContainer(QWindow, parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = 0) → QWidget
SampleDataTableView.currentChanged(self, QModelIndex, QModelIndex)
currentIndex(self) → QModelIndex
cursor(self) → QCursor
customContextMenuRequested

customContextMenuRequested(self, QPoint) [signal]

customEvent(self, QEvent)
SampleDataTableView.dataChanged(self, QModelIndex, QModelIndex, roles: Iterable[int] = [])
defaultDropAction(self) → Qt.DropAction
deleteLater(self)
depth(self) → int
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
destroyed

destroyed(self, object: QObject = None) [signal]

devType(self) → int
devicePixelRatio(self) → int
devicePixelRatioF(self) → float
devicePixelRatioFScale() → float
dirtyRegionOffset(self) → QPoint
disconnect(self)
disconnectNotify(self, QMetaMethod)
doubleClicked

doubleClicked(self, QModelIndex) [signal]

dragDropMode(self) → QAbstractItemView.DragDropMode
dragDropOverwriteMode(self) → bool
dragEnabled(self) → bool
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
drawFrame(self, QPainter)
dropEvent(self, QDropEvent)
dropIndicatorPosition(self) → QAbstractItemView.DropIndicatorPosition
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
edit(self, QModelIndex)

edit(self, QModelIndex, QAbstractItemView.EditTrigger, QEvent) -> bool

editTriggers(self) → QAbstractItemView.EditTriggers
editorDestroyed(self, QObject)
effectiveWinId(self) → sip.voidptr
ensurePolished(self)
enterEvent(self, QEvent)
entered

entered(self, QModelIndex) [signal]

event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
executeDelayedItemsLayout(self)
find(sip.voidptr) → QWidget
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, QFocusEvent)
focusPolicy(self) → Qt.FocusPolicy
focusPreviousChild(self) → bool
focusProxy(self) → QWidget
focusWidget(self) → QWidget
font(self) → QFont
fontInfo(self) → QFontInfo
fontMetrics(self) → QFontMetrics
foregroundRole(self) → QPalette.ColorRole
frameGeometry(self) → QRect
frameRect(self) → QRect
frameShadow(self) → QFrame.Shadow
frameShape(self) → QFrame.Shape
frameSize(self) → QSize
frameStyle(self) → int
frameWidth(self) → int
geometry(self) → QRect
getContentsMargins(self) → Tuple[int, int, int, int]
grab(self, rectangle: QRect = QRect(QPoint(0, 0), QSize(- 1, - 1))) → QPixmap
grabGesture(self, Qt.GestureType, flags: Union[Qt.GestureFlags, Qt.GestureFlag] = Qt.GestureFlags())
grabKeyboard(self)
grabMouse(self)

grabMouse(self, Union[QCursor, Qt.CursorShape])

grabShortcut(self, Union[QKeySequence, QKeySequence.StandardKey, str, int], context: Qt.ShortcutContext = Qt.WindowShortcut) → int
graphicsEffect(self) → QGraphicsEffect
graphicsProxyWidget(self) → QGraphicsProxyWidget
gridStyle(self) → Qt.PenStyle
hasAutoScroll(self) → bool
hasFocus(self) → bool
hasHeightForWidth(self) → bool
hasMouseTracking(self) → bool
hasTabletTracking(self) → bool
height(self) → int
heightForWidth(self, int) → int
heightMM(self) → int
hide(self)
hideColumn(self, int)
hideEvent(self, QHideEvent)
hideRow(self, int)
horizontalHeader(self) → QHeaderView
horizontalOffset(self) → int
horizontalScrollBar(self) → QScrollBar
horizontalScrollBarPolicy(self) → Qt.ScrollBarPolicy
horizontalScrollMode(self) → QAbstractItemView.ScrollMode
horizontalScrollbarAction(self, int)
horizontalScrollbarValueChanged(self, int)
iconSize(self) → QSize
iconSizeChanged

iconSizeChanged(self, QSize) [signal]

indexAt(self, QPoint) → QModelIndex
indexWidget(self, QModelIndex) → QWidget
inherits(self, str) → bool
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionFrame)
inputMethodEvent(self, QInputMethodEvent)
inputMethodHints(self) → Qt.InputMethodHints
inputMethodQuery(self, Qt.InputMethodQuery) → Any
SampleDataTableView.insertAction(self, QAction, QAction)
insertActions(self, QAction, Iterable[QAction])
installEventFilter(self, QObject)
isActiveWindow(self) → bool
isAncestorOf(self, QWidget) → bool
isColumnHidden(self, int) → bool
isCornerButtonEnabled(self) → bool
isEnabled(self) → bool
isEnabledTo(self, QWidget) → bool
isFullScreen(self) → bool
isHidden(self) → bool
isIndexHidden(self, QModelIndex) → bool
isLeftToRight(self) → bool
isMaximized(self) → bool
isMinimized(self) → bool
isModal(self) → bool
isPersistentEditorOpen(self, QModelIndex) → bool
isRightToLeft(self) → bool
isRowHidden(self, int) → bool
isSignalConnected(self, QMetaMethod) → bool
isSortingEnabled(self) → bool
isVisible(self) → bool
isVisibleTo(self, QWidget) → bool
isWidgetType(self) → bool
isWindow(self) → bool
isWindowModified(self) → bool
isWindowType(self) → bool
itemDelegate(self) → QAbstractItemDelegate

itemDelegate(self, QModelIndex) -> QAbstractItemDelegate

itemDelegateForColumn(self, int) → QAbstractItemDelegate
itemDelegateForRow(self, int) → QAbstractItemDelegate
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
keyboardGrabber() → QWidget
keyboardSearch(self, str)
killTimer(self, int)
layout(self) → QLayout
layoutDirection(self) → Qt.LayoutDirection
leaveEvent(self, QEvent)
lineWidth(self) → int
locale(self) → QLocale
logicalDpiX(self) → int
logicalDpiY(self) → int
lower(self)
mapFrom(self, QWidget, QPoint) → QPoint
mapFromGlobal(self, QPoint) → QPoint
mapFromParent(self, QPoint) → QPoint
mapTo(self, QWidget, QPoint) → QPoint
mapToGlobal(self, QPoint) → QPoint
mapToParent(self, QPoint) → QPoint
mask(self) → QRegion
maximumHeight(self) → int
maximumSize(self) → QSize
maximumViewportSize(self) → QSize
maximumWidth(self) → int
metaObject(self) → QMetaObject
metric(self, QPaintDevice.PaintDeviceMetric) → int
midLineWidth(self) → int
minimumHeight(self) → int
minimumSize(self) → QSize
minimumSizeHint(self) → QSize
minimumWidth(self) → int
model(self) → QAbstractItemModel
mouseDoubleClickEvent(self, QMouseEvent)
mouseGrabber() → QWidget
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
move(self, QPoint)

move(self, int, int)

moveCursor(self, QAbstractItemView.CursorAction, Union[Qt.KeyboardModifiers, Qt.KeyboardModifier]) → QModelIndex
moveEvent(self, QMoveEvent)
moveToThread(self, QThread)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
nativeParentWidget(self) → QWidget
nextInFocusChain(self) → QWidget
normalGeometry(self) → QRect
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

openPersistentEditor(self, QModelIndex)
overrideWindowFlags(self, Union[Qt.WindowFlags, Qt.WindowType])
overrideWindowState(self, Union[Qt.WindowStates, Qt.WindowState])
paintEngine(self) → QPaintEngine
paintEvent(self, QPaintEvent)
paintingActive(self) → bool
palette(self) → QPalette
parent(self) → QObject
parentWidget(self) → QWidget
physicalDpiX(self) → int
physicalDpiY(self) → int
pos(self) → QPoint
pressed

pressed(self, QModelIndex) [signal]

previousInFocusChain(self) → QWidget
property(self, str) → Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

raise_(self)
receivers(self, PYQT_SIGNAL) → int
rect(self) → QRect
releaseKeyboard(self)
releaseMouse(self)
releaseShortcut(self, int)
removeAction(self, QAction)
removeEventFilter(self, QObject)
render(self, QPaintDevice, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground | QWidget.DrawChildren))

render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground|QWidget.DrawChildren))

repaint(self)

repaint(self, int, int, int, int) repaint(self, QRect) repaint(self, QRegion)

reset(self)
resetHorizontalScrollMode(self)
resetVerticalScrollMode(self)
resize(self, QSize)

resize(self, int, int)

resizeColumnToContents(self, int)
resizeColumnsToContents(self)
resizeEvent(self, QResizeEvent)
resizeRowToContents(self, int)
resizeRowsToContents(self)
restoreGeometry(self, Union[QByteArray, bytes, bytearray]) → bool
rootIndex(self) → QModelIndex
rowAt(self, int) → int
SampleDataTableView.rowCountChanged(self, int, int)
rowHeight(self, int) → int
SampleDataTableView.rowMoved(self, int, int, int)
SampleDataTableView.rowResized(self, int, int, int)
SampleDataTableView.rowSpan(self, int, int) -> int
rowViewportPosition(self, int) → int
SampleDataTableView.rowsAboutToBeRemoved(self, QModelIndex, int, int)
SampleDataTableView.rowsInserted(self, QModelIndex, int, int)
saveGeometry(self) → QByteArray
scheduleDelayedItemsLayout(self)
SampleDataTableView.scroll(self, int, int)

scroll(self, int, int, QRect)

scrollBarWidgets(self, Union[Qt.Alignment, Qt.AlignmentFlag]) → List[QWidget]
SampleDataTableView.scrollContentsBy(self, int, int)
SampleDataTableView.scrollDirtyRegion(self, int, int)
scrollTo(self, QModelIndex, hint: QAbstractItemView.ScrollHint = QAbstractItemView.EnsureVisible)
scrollToBottom(self)
scrollToTop(self)
selectAll(self)
selectColumn(self, int)
selectRow(self, int)
selectedIndexes(self) → List[QModelIndex]
selectionBehavior(self) → QAbstractItemView.SelectionBehavior
SampleDataTableView.selectionChanged(self, QItemSelection, QItemSelection)
selectionCommand(self, QModelIndex, event: QEvent = None) → QItemSelectionModel.SelectionFlags
selectionMode(self) → QAbstractItemView.SelectionMode
selectionModel(self) → QItemSelectionModel
sender(self) → QObject
senderSignalIndex(self) → int
setAcceptDrops(self, bool)
setAccessibleDescription(self, str)
setAccessibleName(self, str)
setAlternatingRowColors(self, bool)
setAttribute(self, Qt.WidgetAttribute, on: bool = True)
setAutoFillBackground(self, bool)
setAutoScroll(self, bool)
setAutoScrollMargin(self, int)
setBackgroundRole(self, QPalette.ColorRole)
SampleDataTableView.setBaseSize(self, int, int)

setBaseSize(self, QSize)

setColumnHidden(self, int, bool)
SampleDataTableView.setColumnWidth(self, int, int)
SampleDataTableView.setContentsMargins(self, int, int, int, int)

setContentsMargins(self, QMargins)

setContextMenuPolicy(self, Qt.ContextMenuPolicy)
setCornerButtonEnabled(self, bool)
setCornerWidget(self, QWidget)
setCurrentIndex(self, QModelIndex)
setCursor(self, Union[QCursor, Qt.CursorShape])
setDefaultDropAction(self, Qt.DropAction)
setDirtyRegion(self, QRegion)
setDisabled(self, bool)
setDragDropMode(self, QAbstractItemView.DragDropMode)
setDragDropOverwriteMode(self, bool)
setDragEnabled(self, bool)
setDropIndicatorShown(self, bool)
setEditTriggers(self, Union[QAbstractItemView.EditTriggers, QAbstractItemView.EditTrigger])
setEnabled(self, bool)
setFixedHeight(self, int)
setFixedSize(self, QSize)

setFixedSize(self, int, int)

setFixedWidth(self, int)
setFocus(self)

setFocus(self, Qt.FocusReason)

setFocusPolicy(self, Qt.FocusPolicy)
setFocusProxy(self, QWidget)
setFont(self, QFont)
setForegroundRole(self, QPalette.ColorRole)
setFrameRect(self, QRect)
setFrameShadow(self, QFrame.Shadow)
setFrameShape(self, QFrame.Shape)
setFrameStyle(self, int)
setGeometry(self, QRect)

setGeometry(self, int, int, int, int)

setGraphicsEffect(self, QGraphicsEffect)
setGridStyle(self, Qt.PenStyle)
setHidden(self, bool)
setHorizontalHeader(self, QHeaderView)
setHorizontalScrollBar(self, QScrollBar)
setHorizontalScrollBarPolicy(self, Qt.ScrollBarPolicy)
setHorizontalScrollMode(self, QAbstractItemView.ScrollMode)
setIconSize(self, QSize)
setIndexWidget(self, QModelIndex, QWidget)
setInputMethodHints(self, Union[Qt.InputMethodHints, Qt.InputMethodHint])
setItemDelegate(self, QAbstractItemDelegate)
setItemDelegateForColumn(self, int, QAbstractItemDelegate)
setItemDelegateForRow(self, int, QAbstractItemDelegate)
setLayout(self, QLayout)
setLayoutDirection(self, Qt.LayoutDirection)
setLineWidth(self, int)
setLocale(self, QLocale)
setMask(self, QBitmap)

setMask(self, QRegion)

setMaximumHeight(self, int)
SampleDataTableView.setMaximumSize(self, int, int)

setMaximumSize(self, QSize)

setMaximumWidth(self, int)
setMidLineWidth(self, int)
setMinimumHeight(self, int)
SampleDataTableView.setMinimumSize(self, int, int)

setMinimumSize(self, QSize)

setMinimumWidth(self, int)
setModel(model)

After setting the model, resize the columns using SAMPLE_DATA and the header data provided by the model

See Qt documentation for an explanation of arguments

setMouseTracking(self, bool)
setObjectName(self, str)
setPalette(self, QPalette)
setParent(self, QWidget)

setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])

setProperty(self, str, Any) → bool
setRootIndex(self, QModelIndex)
SampleDataTableView.setRowHeight(self, int, int)
setRowHidden(self, int, bool)
setSampleData(new_sample_data)

Sets SAMPLE_DATA to new_sample_data and updates column widths if model is set.

Parameters

new_sample_data (dict) – The new sample data

setSelection(self, QRect, Union[QItemSelectionModel.SelectionFlags, QItemSelectionModel.SelectionFlag])
setSelectionBehavior(self, QAbstractItemView.SelectionBehavior)
setSelectionMode(self, QAbstractItemView.SelectionMode)
setSelectionModel(self, QItemSelectionModel)
setShortcutAutoRepeat(self, int, enabled: bool = True)
setShortcutEnabled(self, int, enabled: bool = True)
setShowGrid(self, bool)
setSizeAdjustPolicy(self, QAbstractScrollArea.SizeAdjustPolicy)
SampleDataTableView.setSizeIncrement(self, int, int)

setSizeIncrement(self, QSize)

setSizePolicy(self, QSizePolicy)

setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)

setSortingEnabled(self, bool)
SampleDataTableView.setSpan(self, int, int, int, int)
setState(self, QAbstractItemView.State)
setStatusTip(self, str)
setStyle(self, QStyle)
setStyleSheet(self, str)
setTabKeyNavigation(self, bool)
SampleDataTableView.setTabOrder(QWidget, QWidget)
setTabletTracking(self, bool)
setTextElideMode(self, Qt.TextElideMode)
setToolTip(self, str)
setToolTipDuration(self, int)
setUpdatesEnabled(self, bool)
setVerticalHeader(self, QHeaderView)
setVerticalScrollBar(self, QScrollBar)
setVerticalScrollBarPolicy(self, Qt.ScrollBarPolicy)
setVerticalScrollMode(self, QAbstractItemView.ScrollMode)
setViewport(self, QWidget)
SampleDataTableView.setViewportMargins(self, int, int, int, int)

setViewportMargins(self, QMargins)

setVisible(self, bool)
setWhatsThis(self, str)
setWindowFilePath(self, str)
setWindowFlag(self, Qt.WindowType, on: bool = True)
setWindowFlags(self, Union[Qt.WindowFlags, Qt.WindowType])
setWindowIcon(self, QIcon)
setWindowIconText(self, str)
setWindowModality(self, Qt.WindowModality)
setWindowModified(self, bool)
setWindowOpacity(self, float)
setWindowRole(self, str)
setWindowState(self, Union[Qt.WindowStates, Qt.WindowState])
setWindowTitle(self, str)
setWordWrap(self, bool)
setupViewport(self, QWidget)
sharedPainter(self) → QPainter
show(self)
showColumn(self, int)
showDropIndicator(self) → bool
showEvent(self, QShowEvent)
showFullScreen(self)
showGrid(self) → bool
showMaximized(self)
showMinimized(self)
showNormal(self)
showRow(self, int)
signalsBlocked(self) → bool
size(self) → QSize
sizeAdjustPolicy(self) → QAbstractScrollArea.SizeAdjustPolicy
sizeHint()

Provide a size hint that requests the full width of the table.

See Qt documentation for an explanation of arguments and return value

sizeHintForColumn(col_num)

Provide a size hint for the specified column using SAMPLE_DATA. Note that this method does not take header width into account as the header width is already accounted for in resizeColumnToContents.

See Qt documentation for an explanation of arguments and return value

sizeHintForIndex(self, QModelIndex) → QSize
sizeHintForRow(self, int) → int
sizeIncrement(self) → QSize
sizePolicy(self) → QSizePolicy
sortByColumn(self, int, Qt.SortOrder)
stackUnder(self, QWidget)
startDrag(self, Union[Qt.DropActions, Qt.DropAction])
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
state(self) → QAbstractItemView.State
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
statusTip(self) → str
style(self) → QStyle
styleSheet(self) → str
tabKeyNavigation(self) → bool
tabletEvent(self, QTabletEvent)
testAttribute(self, Qt.WidgetAttribute) → bool
textElideMode(self) → Qt.TextElideMode
thread(self) → QThread
timerEvent(self, QTimerEvent)
toolTip(self) → str
toolTipDuration(self) → int
tr(self, str, disambiguation: str = None, n: int = - 1) → str
underMouse(self) → bool
ungrabGesture(self, Qt.GestureType)
unsetCursor(self)
unsetLayoutDirection(self)
unsetLocale(self)
update(self)

update(self, QModelIndex)

updateEditorData(self)
updateEditorGeometries(self)
updateGeometries(self)
updateGeometry(self)
updateMicroFocus(self)
updatesEnabled(self) → bool
verticalHeader(self) → QHeaderView
verticalOffset(self) → int
verticalScrollBar(self) → QScrollBar
verticalScrollBarPolicy(self) → Qt.ScrollBarPolicy
verticalScrollMode(self) → QAbstractItemView.ScrollMode
verticalScrollbarAction(self, int)
verticalScrollbarValueChanged(self, int)
viewOptions(self) → QStyleOptionViewItem
viewport(self) → QWidget
viewportEntered

viewportEntered(self) [signal]

viewportEvent(self, QEvent) → bool
viewportMargins(self) → QMargins
viewportSizeHint(self) → QSize
visibleRegion(self) → QRegion
visualRect(self, QModelIndex) → QRect
visualRegionForSelection(self, QItemSelection) → QRegion
whatsThis(self) → str
wheelEvent(self, QWheelEvent)
width(self) → int
widthMM(self) → int
winId(self) → sip.voidptr
window(self) → QWidget
windowFilePath(self) → str
windowFlags(self) → Qt.WindowFlags
windowHandle(self) → QWindow
windowIcon(self) → QIcon
windowIconChanged

windowIconChanged(self, QIcon) [signal]

windowIconText(self) → str
windowIconTextChanged

windowIconTextChanged(self, str) [signal]

windowModality(self) → Qt.WindowModality
windowOpacity(self) → float
windowRole(self) → str
windowState(self) → Qt.WindowStates
windowTitle(self) → str
windowTitleChanged

windowTitleChanged(self, str) [signal]

windowType(self) → Qt.WindowType
wordWrap(self) → bool
x(self) → int
y(self) → int
class schrodinger.ui.qt.table_helper.UserRolesEnumMeta(cls, bases, classdict, offset=None, step_size=None)

Bases: enum.EnumMeta

The metaclass for UserRolesEnum. See UserRolesEnum for documentation.

__contains__(member)
__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

__len__()
mro()

Return a type’s method resolution order.

class schrodinger.ui.qt.table_helper.Column(title=None, tooltip=None, align=None, editable=False, checkable=False)

Bases: object

A table column. This class is intended to be used in the TableColumns enum.

__init__(title=None, tooltip=None, align=None, editable=False, checkable=False)
Parameters
  • title (str) – The column title to display in the header.

  • tooltip (str) – The tooltip to display when the user hovers over the column header.

  • align (int) – The alignment for cells in the column. If not given, Qt defaults to left alignment.

  • editable (bool) – Whether cells in the column are editable. (I.e., whether cells should be given the Qt.ItemIsEditable flag.)

  • checkable (bool) – Whether cells in the column can be checked or unchecked without opening an editor. (I.e., whether cells should be given the Qt.ItemIsUserCheckable flag.) Note that cells in checkable columns should provide data for Qt.CheckStateRole.

schrodinger.ui.qt.table_helper.connect_signals(model, signal_map)

Connect all specified signals

Parameters
  • model (QtCore.Qbject) – The model to connect signals from

  • signal_map (dict) – A dictionary of {signal name (str): slot}.

schrodinger.ui.qt.table_helper.disconnect_signals(model, signal_map)

Disconnect all specified signals

Parameters
  • model (QtCore.Qbject) – The model to disconnect signals from

  • signal_map (dict) – A dictionary of {signal name (str): slot}.

schrodinger.ui.qt.table_helper.PtRowBasedCustomRole

alias of schrodinger.ui.qt.table_helper.CustomRole

class schrodinger.ui.qt.table_helper.Include(value)

Bases: enum.IntEnum

An enumeration.

Only = 1
Toggle = 2
Range = 3
class schrodinger.ui.qt.table_helper.PtRowBasedTableModel

Bases: schrodinger.ui.qt.appframework2.maestro_callback.MaestroCallbackMixin, schrodinger.ui.qt.table_helper.RowBasedTableModel

A table model that keeps track of the inclusion state of an entry between the Project Table and the table’s inclusion checkboxes. The inclusion lock state is also respected by not allowing the user to uncheck a inclusion locked entry.

Note: An ‘Inclusion’ column must be defined by the Column class as well as an ‘EntryId’ CustomRole to utilize this class. Moreover, the row object class for the PtRowBasedTableModel subclass should define an entry_id attribute, otherwise subclass needs to define a data method for PtRowBasedCustomRole.EntryId.

Lastly, if the subclass of PtRowBasedTableModel requires any additional custom roles, it should use a UserRolesEnum that inherits from the above PtRowBasedCustomRole to avoid the risk of role number conflicts.

__init__()

Initialize self. See help(type(self)) for accurate signature.

onInclusionChanged()

Called when the workspace’s inclusion changes. The emitted dataChanged() signal forces the view to update each entry’s inclusion state from the workspace by calling data().

onProjectClosed()

Reset the table when a project is closed to avoid invalid data.

onProjectUpdated()

Reset the PT instance.

CHECKABLE_COLS = ()
COLUMN = None
class CheckIndexOption(value)

Bases: enum.IntEnum

An enumeration.

DoNotUseParent = 2
IndexIsValid = 1
NoOption = 0
ParentIsInvalid = 4
class CheckIndexOptions

Bases: sip.simplewrapper

QAbstractItemModel.CheckIndexOptions(Union[QAbstractItemModel.CheckIndexOptions, QAbstractItemModel.CheckIndexOption]) QAbstractItemModel.CheckIndexOptions(QAbstractItemModel.CheckIndexOptions)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Column = None
EDITABLE_COLS = <object object>
HorizontalSortHint = 2
IGNORE_DELAYED_CALLBACKS = False
class LayoutChangeHint

Bases: int

NO_DATA_CHANGED = <object object>
NoLayoutChangeHint = 0
ROW_CLASS = None
ROW_LIST_OFFSET = 0
SHOW_ROW_NUMBERS = False
UNEDITABLE_COLS = <object object>
VerticalSortHint = 1
af2SettingsGetValue()

This function adds support for the settings mixin. It allows to save table cell values in case this table is included in the settings panel. Returns list of rows if table model is of RowBasedTableModel class type.

Returns

list of rows in tbe table’s model.

Return type

list or None

af2SettingsSetValue(value)

This function adds support for the settings mixin. It allows to set table cell values when this table is included in the settings panel.

Parameters

value (list) – settings value, which is a list of row data here.

appendRow(*args, **kwargs)

Add a row to the table. All arguments are passed to ROW_CLASS initialization.

Returns

The row number of the new row

Return type

int

appendRowObject(row)

Add a row to the table.

Parameters

row (ROW_CLASS) – Row object to add to the table.

Returns

The row number of the new row

Return type

int

PtRowBasedTableModel.beginInsertColumns(self, QModelIndex, int, int)
PtRowBasedTableModel.beginInsertRows(self, QModelIndex, int, int)
PtRowBasedTableModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
PtRowBasedTableModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
PtRowBasedTableModel.beginRemoveColumns(self, QModelIndex, int, int)
PtRowBasedTableModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
blockSignals(self, bool) → bool
buddy(self, QModelIndex) → QModelIndex
buildCallbackDicts()

Create a dictionary of all methods that have a maestro_callback decorator.

canDropMimeData(self, QMimeData, Qt.DropAction, int, int, QModelIndex) → bool
canFetchMore(self, QModelIndex) → bool
PtRowBasedTableModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
checkIndex(self, QModelIndex, options: Union[QAbstractItemModel.CheckIndexOptions, QAbstractItemModel.CheckIndexOption] = QAbstractItemModel.CheckIndexOption.NoOption) → bool
childEvent(self, QChildEvent)
children(self) → List[QObject]
closeEvent(event)
columnChanged(col_number)

Call this method when a specific column object has been modified. Will cause the view to redraw that column.

Parameters

col_number (int) – 0-indexed column number in the model.

columnCount(self, parent: QModelIndex = QModelIndex()) → int
columnsAboutToBeInserted

columnsAboutToBeInserted(self, QModelIndex, int, int) [signal]

columnsAboutToBeMoved

columnsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

columnsAboutToBeRemoved

columnsAboutToBeRemoved(self, QModelIndex, int, int) [signal]

columnsInserted

columnsInserted(self, QModelIndex, int, int) [signal]

columnsMoved

columnsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

columnsRemoved

columnsRemoved(self, QModelIndex, int, int) [signal]

connectNotify(self, QMetaMethod)
PtRowBasedTableModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
dataChanged

dataChanged(self, QModelIndex, QModelIndex, roles: Iterable[int] = []) [signal]

PtRowBasedTableModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dropMimeData(self, QMimeData, Qt.DropAction, int, int, QModelIndex) → bool
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
encodeData(self, Iterable[QModelIndex], QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
fetchMore(self, QModelIndex)
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

flags(index)

See Qt documentation for an method documentation.

formatFloat(value, role, digits, fmt='')

Format floating point values for display or sorting. If role is Qt.DisplayRole, then value will be returned as a string with the specified formatting. All other role values are assumed to be a sorting role and value will be returned unchanged.

Parameters
  • value (float) – The floating point value to format

  • role (int) – The Qt data role

  • digits (int) – The number of digits to include after the decimal point for Qt.DisplayRole

  • fmt (str) – Additional floating point formatting options

Returns

The formatted or unmodified value

Return type

str or float

hasChildren(self, parent: QModelIndex = QModelIndex()) → bool
PtRowBasedTableModel.hasIndex(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
headerData(section, orientation, role=0)

Provide column headers, and optionally column tooltips and row numbers.

See Qt documentation for an explanation of arguments and return value

headerDataChanged

headerDataChanged(self, Qt.Orientation, int, int) [signal]

ignoreMaestroCallbacks()

A context manager for temporarily disabling Maestro callbacks created using the decorators above. (Note that callbacks that have been manually added using maestro.*_callback_add() will not be disabled.)

Example:

def includeEntry(self, entry_id):
    proj = maestro.project_table_get()
    with self.ignoreMaestroCallbacks():
        proj[entry_id].in_workspace = project.IN_WORKSPACE

@maestro_callback.project_changed
def onProjectChanged(self):
    print "This method will not be called during includeEntry."

@maestro_callback.workspace_changed
def onWorkspaceChanged(self):
    print "Neither will this one."
PtRowBasedTableModel.index(self, int, int, parent: QModelIndex = QModelIndex()) -> QModelIndex
inherits(self, str) → bool
insertColumn(self, int, parent: QModelIndex = QModelIndex()) → bool
PtRowBasedTableModel.insertColumns(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
insertRow(self, int, parent: QModelIndex = QModelIndex()) → bool
PtRowBasedTableModel.insertRows(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
itemData(self, QModelIndex) → Dict[int, Any]
killTimer(self, int)
layoutAboutToBeChanged

layoutAboutToBeChanged(self, parents: Iterable[QPersistentModelIndex] = [], hint: QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]

layoutChanged

layoutChanged(self, parents: Iterable[QPersistentModelIndex] = [], hint: QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal]

loadData(rows)

Load data into the table and replace all existing data.

Parameters

rows (list) – A list of ROW_CLASS objects

match(self, QModelIndex, int, Any, hits: int = 1, flags: Union[Qt.MatchFlags, Qt.MatchFlag] = Qt.MatchStartsWith | Qt.MatchWrap) → List[QModelIndex]
metaObject(self) → QMetaObject
mimeData(self, Iterable[QModelIndex]) → QMimeData
mimeTypes(self) → List[str]
modelAboutToBeReset

modelAboutToBeReset(self) [signal]

modelReset

modelReset(self) [signal]

modelResetContext()

A context manager for resetting the model. See model_reset_method for a decorator version of this.

PtRowBasedTableModel.moveColumn(self, QModelIndex, int, QModelIndex, int) -> bool
PtRowBasedTableModel.moveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
PtRowBasedTableModel.moveRow(self, QModelIndex, int, QModelIndex, int) -> bool
PtRowBasedTableModel.moveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
moveToThread(self, QThread)
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) → QObject
persistentIndexList(self) → List[QModelIndex]
property(self, str) → Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) → int
removeColumn(self, int, parent: QModelIndex = QModelIndex()) → bool
PtRowBasedTableModel.removeColumns(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
removeEventFilter(self, QObject)
removeRow(self, int, parent: QModelIndex = QModelIndex()) → bool
PtRowBasedTableModel.removeRows(self, int, int, parent: QModelIndex = QModelIndex()) -> bool
removeRowsByIndices(indices)

Remove all rows from the model specified by the given QModelIndex items.

removeRowsByRowNumbers(rows)

Remove the given rows from the model, specified by row number, 0-indexed.

replaceRows(new_rows)

Replace the contents of the model with the contents of the given list. The change will be presented to the view as a series of row insertions and deletions rather than as a model reset. This allows the view to properly update table selections and scroll bar position. This method may only be used if:

  • the ROW_CLASS objects can be compared using < and ==

  • the contents of the model (i.e. self._rows) are sorted in ascending order

  • the contents of new_rows are sorted in ascending order

This method is primarily intended for use when the table contains rows based on project table rows. On every project change, the project table can be reread and used to generate new_list and this method can then properly update the model.

Parameters

new_rows (list) – A list of ROW_CLASS objects

reset()

Remove all data from the model

resetInternalData(self)
revert(self)
roleNames(self) → Dict[int, QByteArray]
rowChanged(row_number)

Call this method when a specific row object has been modified. Will cause the view to redraw that row.

Parameters

row_number (int) – 0-indexed row number in the model. Corresponds to the index in the “.rows” iterator.

rowCount(self, parent: QModelIndex = QModelIndex()) → int
property rows

Iterate over all rows in the model. If any data is changed, call rowChanged() method with the row’s 0-indexed number to update the view.

rowsAboutToBeInserted

rowsAboutToBeInserted(self, QModelIndex, int, int) [signal]

rowsAboutToBeMoved

rowsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

rowsAboutToBeRemoved

rowsAboutToBeRemoved(self, QModelIndex, int, int) [signal]

rowsInserted

rowsInserted(self, QModelIndex, int, int) [signal]

rowsMoved

rowsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal]

rowsRemoved

rowsRemoved(self, QModelIndex, int, int) [signal]

sender(self) → QObject
senderSignalIndex(self) → int
setHeaderData(self, int, Qt.Orientation, Any, role: int = Qt.EditRole) → bool
setItemData(self, QModelIndex, Dict[int, Any]) → bool
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) → bool
showEvent(event)
PtRowBasedTableModel.sibling(self, int, int, QModelIndex) -> QModelIndex
signalsBlocked(self) → bool
sort(self, int, order: Qt.SortOrder = Qt.AscendingOrder)
span(self, QModelIndex) → QSize
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
submit(self) → bool
supportedDragActions(self) → Qt.DropActions
supportedDropActions(self) → Qt.DropActions
thread(self) → QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) → str
data(index, role=0)

If the inclusion state is requested, the data will be retrieved from the PT. The inclusion states are not stored in the table to avoid updating in two locations.

See table_helper.RowBasedTableModel.data() for documentation on arguments and return value.

setData(index, value, role=2)

If the inclusion state is updated, the data will be set to the PT.

See table_helper.RowBasedTableModel.data() for documentation on arguments and return value.