Package schrodinger :: Package application :: Package msv :: Package gui :: Module viewmodel :: Class RowWrapProxyModel
[hide private]
[frames] | no frames]

Class RowWrapProxyModel

                                                         object --+        
                                                                  |        
                                           GroupExpansionProxyMixin --+    
                                                                      |    
                                                 object --+           |    
                                                          |           |    
ui.qt.table_speed_up.MultipleRolesRoleProxyPassthroughMixin --+       |    
                                                              |       |    
                                                     ProxyMixin --+   |    
                                                                  |   |    
                                           PostReorderingProxyMixin --+    
                                                                      |    
                                               PostAnnotationProxyMixin --+
                                                                          |
                                         object --+                       |
                                                  |                       |
                                  sip.simplewrapper --+                   |
                                                      |                   |
                                            sip.wrapper --+               |
                                                          |               |
                                       PyQt5.QtCore.QObject --+           |
                                                              |           |
                                PyQt5.QtCore.QAbstractItemModel --+       |
                                                                  |       |
                                   PyQt5.QtCore.QAbstractProxyModel --+   |
                                                                      |   |
                                                            NestedProxy --+
                                                                          |
                                                                         RowWrapProxyModel

A proxy model that wraps rows to a specified column count. A blank spacer row will be inserted between each wrap. (Note that there's no spacer row before the first wrap or after the last wrap.)

Nested Classes [hide private]

Inherited from PostAnnotationProxyMixin: __metaclass__

Inherited from PyQt5.QtCore.QAbstractItemModel: LayoutChangeHint

Instance Methods [hide private]
 
__init__(self, parent=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
tableWidthChanged(self, width)
Wrap the table to the specified number of columns.
 
setSourceModel(self, model)
 
_resetColumnCount(self)
Reset all column-related bookkeeping data using the current source model column count.
 
_resetRowCounts(self)
Reset all row-related bookkeeping data using the current source model row counts.
int
_wrapCount(self, source_cols)
Calculate the number of times that a table would need to be wrapped to fit into the current width.
 
columnCount(self, parent=None)
 
rowCount(self, parent=None)
 
mapFromSource(self, source_index)
tuple
_mapTopLevelIndexFromSource(self, source_index, child_col=None)
Map a top-level index from the source model.
 
mapToSource(self, proxy_index)
tuple
_mapTopLevelIndexToSource(self, proxy_index, force_column_zero=False)
Map a top-level index to the source model.
 
data(self, index, role=0, multiple_roles=None)
 
headerData(self, section, orientation, role=0)
 
_sourceModelReset(self)
Respond to the modelChanged signal from the source model.
 
_sourceLayoutChanged(self)
Respond to the layoutChanged signal from the source model.
 
_sourceRowsAboutToBeInserted(self, parent, source_start, source_end)
Respond to the rowsAboutToBeInserted signal from the source model.
 
_sourceRowsInserted(self, parent, source_start, source_end)
Respond to the rowsInserted signal from the source model.
 
_sourceRowsAboutToBeRemoved(self, parent, source_start, source_end)
Respond to the rowsAboutToBeRemoved signal from the source model.
 
_sourceRowsRemoved(self, parent, source_start, source_end)
Respond to the rowsRemoved signal from the source model.
 
_sourceColumnsAboutToBeInserted(self, parent, start, end)
Respond to the columnsAboutToBeInserted signal from the source model.
 
_sourceColumnsAboutToBeRemoved(self, parent, start, end)
Respond to the columnsAboutToBeRemoved signal from the source model.
 
_sourceColumnsInsertedOrRemoved(self, parent, start, end)
 
_sourceDataChanged(self, source_topleft, source_bottomright)
Respond to a dataChanged signal from the source model by emitting dataChanged for all affected cells.
 
_groupExpansionChanged(self, source_indices, expanded)
Pass along a groupExpansionChanged signal from the source model after mapping the indices to be expanded or collapsed.

Inherited from PostAnnotationProxyMixin: getShownRowTypes

Inherited from GroupExpansionProxyMixin: groupByChanged, groupExpansionChanged

Inherited from PostReorderingProxyMixin: reorderRow

Inherited from PostReorderingProxyMixin (private): _mapRowToSource

Inherited from ProxyMixin: emitResidueSelection, getResidueDisplayMode, residueFormatChanged, residuesSelected, sourceModel

Inherited from NestedProxy: buddy, hasChildren, index, parent

Inherited from PyQt5.QtCore.QAbstractProxyModel: canDropMimeData, canFetchMore, dropMimeData, fetchMore, flags, itemData, mapSelectionFromSource, mapSelectionToSource, mimeData, mimeTypes, resetInternalData, revert, setData, setHeaderData, setItemData, sibling, sort, sourceModelChanged, span, submit, supportedDragActions, supportedDropActions

Inherited from PyQt5.QtCore.QAbstractItemModel: beginInsertColumns, beginInsertRows, beginMoveColumns, beginMoveRows, beginRemoveColumns, beginRemoveRows, beginResetModel, changePersistentIndex, changePersistentIndexList, columnsAboutToBeInserted, columnsAboutToBeMoved, columnsAboutToBeRemoved, columnsInserted, columnsMoved, columnsRemoved, createIndex, dataChanged, decodeData, encodeData, endInsertColumns, endInsertRows, endMoveColumns, endMoveRows, endRemoveColumns, endRemoveRows, endResetModel, hasIndex, headerDataChanged, insertColumn, insertColumns, insertRow, insertRows, layoutAboutToBeChanged, layoutChanged, match, modelAboutToBeReset, modelReset, moveColumn, moveColumns, moveRow, moveRows, persistentIndexList, removeColumn, removeColumns, removeRow, removeRows, roleNames, rowsAboutToBeInserted, rowsAboutToBeMoved, rowsAboutToBeRemoved, rowsInserted, rowsMoved, rowsRemoved

Inherited from PyQt5.QtCore.QObject: __getattr__, blockSignals, childEvent, children, connectNotify, customEvent, deleteLater, destroyed, disconnect, disconnectNotify, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChildren, inherits, installEventFilter, isSignalConnected, isWidgetType, isWindowType, killTimer, metaObject, moveToThread, objectName, objectNameChanged, property, pyqtConfigure, receivers, removeEventFilter, sender, senderSignalIndex, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent, tr

Inherited from sip.simplewrapper: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from NestedProxy: TOP_LEVEL

Inherited from PyQt5.QtCore.QAbstractItemModel: HorizontalSortHint, NoLayoutChangeHint, VerticalSortHint

Inherited from PyQt5.QtCore.QObject: staticMetaObject

Instance Variables [hide private]
int _column_count
The current number of columns in this proxy.
RowWrapInsertingChildRows or NoneType _inserting_child_rows
If we're in the process of inserting child rows into the model, this will be a RowWrapInsertingChildRows object describing the insertion.
RowWrapInsertingRows or NoneType _inserting_rows
If we're in the process of inserting top-level rows into the model, this will be a RowWrapInsertingRows object describing the insertion.
RowWrapRemovingChildRows or NoneType _removing_child_rows
If we're in the process of removing child rows from the model, this will be a RowWrapRemovingChildRows object describing the removal.
RowWrapRemovingRows or NoneType _removing_rows
If we're in the process of removing top-level rows from the model, this will be a RowWrapRemovingRows object describing the removal.
list _source_child_row_count
The number of child rows for each top-level row of the source model.
int _source_column_count
The current number of columns in this proxy's source model.
int _top_level_row_count
The current number of top-level row in this proxy (i.e.
RowWrapInsertingRows or NoneType _updating_inserted_rows
If we're in the process of updating top-level rows that were just inserted into the model, this will be a RowWrapInsertingRows object describing the updating.
  _width
The current width of the table view, measured in number of columns.
int _wrap_count
The number of times the rows are wrapped to fit within _width columns.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent=None)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

tableWidthChanged(self, width)

 

Wrap the table to the specified number of columns.

Parameters:
  • width (int) - The number of columns to wrap to.

setSourceModel(self, model)

 
Decorators:
  • @table_helper.model_reset_method
Overrides: PyQt5.QtCore.QAbstractProxyModel.setSourceModel

_resetRowCounts(self)

 

Reset all row-related bookkeeping data using the current source model row counts.

Note: If resetting both column- and row-related bookkeeping data, _resetColumnCount must be run before _resetRowCounts, as this function uses _wrap_count, which gets reset in {_resetColumnCount}.

_wrapCount(self, source_cols)

 

Calculate the number of times that a table would need to be wrapped to fit into the current width.

Parameters:
  • source_cols (int) - The number of columns in the source table to use for the wrapping calculation.
Returns: int
The number of wrappings

columnCount(self, parent=None)

 
Overrides: PyQt5.QtCore.QAbstractItemModel.columnCount

rowCount(self, parent=None)

 
Overrides: PyQt5.QtCore.QAbstractItemModel.rowCount

mapFromSource(self, source_index)

 
Overrides: PyQt5.QtCore.QAbstractProxyModel.mapFromSource

_mapTopLevelIndexFromSource(self, source_index, child_col=None)

 

Map a top-level index from the source model.

Parameters:
  • source_index (QtCore.QModelIndex) - The source index to map.
  • child_col (int or NoneType) - If source_index is the parent of a child index that's being mapped, the column of the child index, needed so that this method can return a proxy index from the appropriate wrap. Should be None otherwise.
Returns: tuple
A tuple of:
  • The equivalent proxy index (QtCore.QModelIndex)
  • Whether the proxy index is valid (bool)
  • The wrap that the proxy index is in. Will be None if the proxy index is invalid. (int or NoneType)

mapToSource(self, proxy_index)

 
Overrides: PyQt5.QtCore.QAbstractProxyModel.mapToSource

_mapTopLevelIndexToSource(self, proxy_index, force_column_zero=False)

 

Map a top-level index to the source model.

Parameters:
  • proxy_index (QtCore.QModelIndex) - The proxy index to map.
  • force_column_zero (bool) - If True, the returned index will always have a column of 0. Useful when mapping parent indices.
Returns: tuple
A tuple of:
  • The source index (QtCore.QModelIndex)
  • Whether the source index is valid (bool)
  • The wrap that the proxy index is in. Will be None if the source index is invalid. (int)
  • The source column that's equivalent the column at the start of the wrap that proxy_index is from. Will be None if the source index is invalid. (int or NoneType)

data(self, index, role=0, multiple_roles=None)

 
Overrides: PyQt5.QtCore.QAbstractItemModel.data

headerData(self, section, orientation, role=0)

 
Overrides: PyQt5.QtCore.QAbstractItemModel.headerData

_sourceRowsAboutToBeInserted(self, parent, source_start, source_end)

 

Respond to the rowsAboutToBeInserted signal from the source model. This method will completely insert (i.e. rowsAboutToBeInserted and rowsInserted) dummy rows into each wrap of this proxy. After the source model finishes the insertion, the dummy rows will be updated (dataChanged and inserting child rows) in _sourceRowsInserted. This allows us to avoid nesting the row insertions (i.e. emitting multiple rowsAboutToBeInserted signals followed by multiple rowsInserted signals), as nested signals are more complicated for higher proxies to handle and sometimes lead to errors from QSortFilterProxyModels.

See QAbstractItemModel.rowsAboutToBeInserted signal documentation for argument documentation.

_sourceRowsInserted(self, parent, source_start, source_end)

 

Respond to the rowsInserted signal from the source model. Note that new rows were already inserted in _sourceRowsAboutToBeInserted, so this method updates the new rows by emitting dataChanged and inserting any child rows.

See QAbstractItemModel.rowsInserted signal documentation for argument documentation.

_sourceRowsAboutToBeRemoved(self, parent, source_start, source_end)

 

Respond to the rowsAboutToBeRemoved signal from the source model. Note that this method completely removes (i.e. rowsAboutToBeRemoved and rowsRemoved) rows from all wraps of this proxy.

See QAbstractItemModel.rowsAboutToBeRemoved signal documentation for argument documentation.

_sourceRowsRemoved(self, parent, source_start, source_end)

 

Respond to the rowsRemoved signal from the source model. Note that the rows were already removed in _sourceRowsAboutToBeRemoved, so this method just clears the row removal bookkeeping.

See QAbstractItemModel.rowsRemoved signal documentation for argument documentation.

_sourceColumnsAboutToBeInserted(self, parent, start, end)

 

Respond to the columnsAboutToBeInserted signal from the source model. See QAbstractItemModel.columnsAboutToBeInserted signal documentation for argument documentation.

_sourceColumnsAboutToBeRemoved(self, parent, start, end)

 

Respond to the columnsAboutToBeRemoved signal from the source model. See QAbstractItemModel.columnsAboutToBeRemoved signal documentation for argument documentation.

_sourceDataChanged(self, source_topleft, source_bottomright)

 

Respond to a dataChanged signal from the source model by emitting dataChanged for all affected cells. See QAbstractItemModel.dataChanged signal documentation for argument documentation.

_groupExpansionChanged(self, source_indices, expanded)

 

Pass along a groupExpansionChanged signal from the source model after mapping the indices to be expanded or collapsed.

Parameters:
  • source_indices - A list of all source model indices (QtCore.QModelIndex) to expand or collapse.
  • expanded - True if the group should be expanded. False if it should be collapsed.
Overrides: GroupExpansionProxyMixin._groupExpansionChanged
(inherited documentation)

Instance Variable Details [hide private]

_inserting_child_rows

If we're in the process of inserting child rows into the model, this will be a RowWrapInsertingChildRows object describing the insertion. Will be None at all other times.
Type:
RowWrapInsertingChildRows or NoneType

_inserting_rows

If we're in the process of inserting top-level rows into the model, this will be a RowWrapInsertingRows object describing the insertion. Will be None at all other times.
Type:
RowWrapInsertingRows or NoneType

_removing_child_rows

If we're in the process of removing child rows from the model, this will be a RowWrapRemovingChildRows object describing the removal. Will be None at all other times.
Type:
RowWrapRemovingChildRows or NoneType

_removing_rows

If we're in the process of removing top-level rows from the model, this will be a RowWrapRemovingRows object describing the removal. Will be None at all other times.
Type:
RowWrapRemovingRows or NoneType

_source_child_row_count

The number of child rows for each top-level row of the source model. Note that the length of this list is always equal to the number of top-level rows in the source model.
Type:
list

_top_level_row_count

The current number of top-level row in this proxy (i.e. excluding children rows).
Type:
int

_updating_inserted_rows

If we're in the process of updating top-level rows that were just inserted into the model, this will be a RowWrapInsertingRows object describing the updating. Will be None at all other times.
Type:
RowWrapInsertingRows or NoneType

_width

The current width of the table view, measured in number of columns. The is the width that this proxy will wrap to.