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

Class TopModel

                         object --+            
                                  |            
                         ProxyMixin --+        
                                      |        
               PostReorderingProxyMixin --+    
                                          |    
             PostAnnotationFilterProxyMixin --+
                                              |
         object --+                           |
                  |                           |
  sip.simplewrapper --+                       |
                      |                       |
            sip.wrapper --+                   |
                          |                   |
       PyQt4.QtCore.QObject --+               |
                              |               |
PyQt4.QtCore.QAbstractItemModel --+           |
                                  |           |
    PyQt4.QtGui.QAbstractProxyModel --+       |
                                      |       |
          Qt.QtCore.QAbstractProxyModel --+   |
                                          |   |
                             NonNestedProxy --+
                                              |
                                             TopModel

A proxy model that removes the final row of the source model, which is an extraneous blank spacer row. This model can also be toggled between row wrapping (by setting the source to a RowWrapProxyModel) and non-row- wrapping (by setting the source to an AnnotationFilterProxyModel).


Note: It would be simpler to filter out the final row if we inherited from QSortFilterProxyModel rather than QAbstractProxyModel. However, QSortFilterProxyModel doesn't seem to fully support nested row insertion and removal, which leads to problems when rows are grouped by annotation and row wrapping is enabled. Filtering out the final row using a QAbstractProxy model removes these problems.

Nested Classes [hide private]

Inherited from ProxyMixin: __metaclass__

Instance Methods [hide private]
 
__init__(self, parent=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
setSourceModel(self, model)
 
tableWidthChanged(self, width)
Emit the tableWidthChangedSignal with the specified width.
 
rowCount(self, parent=None)
 
columnCount(self, parent=None)
 
mapToSource(self, proxy_index)
 
mapFromSource(self, source_index)
 
_rowsAboutToBeInserted(self, parent, start, end)
When a rowsAboutToBeInserted signal is received, adjust any references to the filtered-out last row.
 
_rowsAboutToBeRemoved(self, parent, start, end)
When a rowsAboutToBeRemoved signal is received, adjust any references to the filtered-out last row.
 
_dataChanged(self, topleft, bottomright)
When a dataChanged signal is received, adjust any references to the filtered-out last row.
 
_headerDataChanged(self, orientation, first, last)
When a headerDataChanged signal is received, adjust any references to the filtered-out last row.
 
resetCaches(self)
str
_getResidueToolTip(self, res, seq)
Return a string containing residue and sequence information
str
_getToolTip(self, source_index)
Returns the tooltip for the source index
 
data(self, index, role)
 
headerData(self, section, orientation, role)
 
undoableReorderRow(self, from_row, to_row)
Reorder a row in response to a drag and drop and make the reordering undoable.

Inherited from PostReorderingProxyMixin: reorderRow

Inherited from PostReorderingProxyMixin (private): _mapRowToSource

Inherited from ProxyMixin: emitResidueSelection, residueFormatChanged, residuesSelected, sourceModel

Inherited from NonNestedProxy: index, parent, resetCountCache

Inherited from Qt.QtCore.QAbstractProxyModel: reset, setRoleNames, setSupportedDragActions

Inherited from PyQt4.QtGui.QAbstractProxyModel: buddy, canFetchMore, fetchMore, flags, hasChildren, itemData, mapSelectionFromSource, mapSelectionToSource, mimeData, mimeTypes, revert, setData, setHeaderData, setItemData, sort, span, submit, supportedDropActions

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

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

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 PyQt4.QtCore.QObject: staticMetaObject

Instance Variables [hide private]
 
tableWidthChangedSignal(...)
A signal emitted when the table width is changed.
 
undoableReorderRowSignal(...)
A signal emitted when a row should be moved and the move should be undoable.
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)

setSourceModel(self, model)

 
Decorators:
  • @table_helper.model_reset_method
Overrides: PyQt4.QtGui.QAbstractProxyModel.setSourceModel

tableWidthChanged(self, width)

 

Emit the tableWidthChangedSignal with the specified width. The RowWrapProxyModel should receive this signal and adjust the wrapping as necessary.

Parameters:
  • width (int) - The current number of columns in the table

rowCount(self, parent=None)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.rowCount

columnCount(self, parent=None)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.columnCount

mapToSource(self, proxy_index)

 
Overrides: PyQt4.QtGui.QAbstractProxyModel.mapToSource

mapFromSource(self, source_index)

 
Overrides: PyQt4.QtGui.QAbstractProxyModel.mapFromSource

_rowsAboutToBeInserted(self, parent, start, end)

 

When a rowsAboutToBeInserted signal is received, adjust any references to the filtered-out last row.

Parameters:
  • parent (QtCore.QModelIndex) - Present for compatibility with the Qt signal. Should be an invalid QtCore.QModelIndex.
  • source_start (int) - The row number for the first row to be inserted.
  • source_end (int) - The row number for the last row to be inserted.

_rowsAboutToBeRemoved(self, parent, start, end)

 

When a rowsAboutToBeRemoved signal is received, adjust any references to the filtered-out last row.

Parameters:
  • parent (QtCore.QModelIndex) - Present for compatibility with the Qt signal. Should be an invalid QtCore.QModelIndex.
  • source_start (int) - The row number for the first row to be removed.
  • source_end (int) - The row number for the last row to be removed.

_dataChanged(self, topleft, bottomright)

 

When a dataChanged signal is received, adjust any references to the filtered-out last row.

Parameters:
  • topleft (QtCore.QModelIndex) - The top-left index that was changed
  • bottomright (QtCore.QModelIndex) - The bottom-right index that was changed

_headerDataChanged(self, orientation, first, last)

 

When a headerDataChanged signal is received, adjust any references to the filtered-out last row.

Parameters:
  • orientation () - The orientation of the header to update.
  • source_start (int) - The index of the first source row or column where the header was changed.
  • source_end (int) - The index of the last source row or column where the header was changed.

_getResidueToolTip(self, res, seq)

 

Return a string containing residue and sequence information

Parameters:
Returns: str
Residue and sequence information

_getToolTip(self, source_index)

 

Returns the tooltip for the source index

This method lives on the topmost proxy because it needs to assemble information from the color proxy as well as the residue and sequence objects.

Parameters:
  • source_index (QtCore.QModelIndex) - The source index for which we need a tooltip
Returns: str
A tooltip for the specified cell

data(self, index, role)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.data

headerData(self, section, orientation, role)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.headerData

undoableReorderRow(self, from_row, to_row)

 

Reorder a row in response to a drag and drop and make the reordering undoable.

Parameters:
  • from_row (int) - The row number of the row to move.
  • to_row (int) - The row number of where the row should be moved to.

Instance Variable Details [hide private]

tableWidthChangedSignal(...)

 
A signal emitted when the table width is changed. This signal is emitted in response to the view calling tableWidthChanged.

undoableReorderRowSignal(...)

 
A signal emitted when a row should be moved and the move should be undoable. This signal is emitted in response to the view calling undoableReorderRow, which happens when the user drag-and- drops a row. The signal receiver (ViewModel) is responsible for creating a QtWidgets.QUndoCommand that calls reorderRow.