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

Class RowWrapProxyModel

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

A proxy model that wraps rows to a specified column count

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
 
tableWidthChanged(self, width)
Wrap the table to the specified number of columns.
 
setSourceModel(self, model)
 
mapFromSource(self, source_index)
 
mapToSource(self, proxy_index)
 
data(self, index, role=0)
 
headerData(self, section, orientation, role=0)
 
rowCount(self, parent=None)
int
_wrapCount(self, source_cols=None)
Calculate the number of times that a table would need to be wrapped to fit into the current width.
 
columnCount(self, parent=None)
 
_sourceRowsAboutToBeInserted(self, parent, source_start, source_end)
Respond to the rowsAboutToBeInserted signal from the source model.
 
_sourceRowsAboutToBeRemoved(self, parent, source_start, source_end)
Respond to the rowsAboutToBeRemoved signal from the source model.
int
_sourceRowsAboutToBeInsDel(self, source_start, source_end, func, stack)
Respond to the rowsAboutToBeInserted or rowsAboutToBeRemoved signal from the source model.
 
_sourceRowsInserted(self, parent, source_start, source_end)
Respond to the rowsInserted signal from the source model.
 
_sourceRowsRemoved(self, parent, source_start, source_end)
Respond to the rowsRemoved signal from the source model.
int
_sourceRowsInsDel(self, source_start, source_end, func, stack)
Respond to the rowsAboutToBeInserted or rowsAboutToBeRemoved signal from the source model.
 
_sourceColumnsAboutToBeInserted(self, parent, start, end)
Respond to the columnsAboutToBeInserted signal from the source model.
bool
_columnInsertionOnColumnInsertion(self, old_source_cols, new_source_cols, source_cols_to_insert)
If the source model is inserting columns, determine if we need to insert columns into the proxy.
bool
_rowInsertionOnColumnInsertion(self, old_wrap_count, new_wrap_count, wraps_added)
If the source model is inserting columns, determine if we need to insert rows into the proxy.
bool
_dataChangedOnColumnInsertion(self, old_wrap_count, wraps_added, old_source_cols, new_source_cols)
If the source model is inserting columns, determine if we will need to emit a dataChanged signal.
 
_sourceColumnsInserted(self)
Respond to the columnsInserted signal from the source model.
 
_emitDataChangedForColumnInsDel(self, wrap_num, col_start, col_end)
Emit the dataChanged signal for the specified wrap and columns.
 
_sourceColumnsAboutToBeRemoved(self, parent, source_start, source_end)
Respond to the columnsAboutToBeRemoved signal from the source model.
bool
_columnRemovalOnColumnRemoval(self, source_start, source_end, new_source_cols)
If the source model is removing columns, determine if we need to remove columns from the proxy.
bool
_rowRemovalOnColumnRemoval(self, old_wrap_count, new_wrap_count, wraps_removed)
If the source model is removing columns, determine if we need to remove rows from the proxy.
bool
_dataChangedOnColumnRemoval(self, new_wrap_count, wraps_removed, old_source_cols, new_source_cols)
If the source model is removing columns, determine if we will need to emit a dataChanged signal.
 
_sourceColumnsRemoved(self)
Respond to the columnsRemoved signal from the source model.
 
_modelHeaderDataChanged(self, orientation, source_start, source_end)
Respond to a headerDataChanged signal from the model by emitting headerDataChanged
 
_modelDataChanged(self, source_left, source_right)
Respond to a dataChanged signal from the model by emitting dataChanged

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

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.
Decorators:
  • @table_helper.model_reset_method

setSourceModel(self, model)

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

mapFromSource(self, source_index)

 
Overrides: PyQt4.QtGui.QAbstractProxyModel.mapFromSource

mapToSource(self, proxy_index)

 
Overrides: PyQt4.QtGui.QAbstractProxyModel.mapToSource

data(self, index, role=0)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.data

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

 
Overrides: PyQt4.QtCore.QAbstractItemModel.headerData

rowCount(self, parent=None)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.rowCount

_wrapCount(self, source_cols=None)

 

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. If not given, the current number of columns from the current source model are used.
Returns: int
The number of wrappings

columnCount(self, parent=None)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.columnCount

_sourceRowsAboutToBeInserted(self, parent, source_start, source_end)

 

Respond to the rowsAboutToBeInserted signal from the source model.

Parameters:
  • parent (object) - Ignored, but present for compatibility with the Qt signal.
  • 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.

_sourceRowsAboutToBeRemoved(self, parent, source_start, source_end)

 

Respond to the rowsAboutToBeRemoved signal from the source model.

Parameters:
  • parent (object) - Ignored, but present for compatibility with the Qt signal.
  • 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.

_sourceRowsAboutToBeInsDel(self, source_start, source_end, func, stack)

 

Respond to the rowsAboutToBeInserted or rowsAboutToBeRemoved signal from the source model.

Parameters:
  • source_start (int) - The row number for the first row to be inserted or removed.
  • source_end (int) - The row number for the last row to be inserted or removed.
  • func (function) - The method that should be called for each row insertion or removal. Should be beginInsertRows() or beginRemoveRows().
  • stack (list) - The stack used to keep track of how many times func was called. Should be self._row_insert_stack or self._row_remove_stack.
Returns: int
The number of source rows that are about to be inserted or removed.

_sourceRowsInserted(self, parent, source_start, source_end)

 

Respond to the rowsInserted signal from the source model.

Parameters:
  • parent (object) - Ignored, but present for compatibility with the Qt signal.
  • source_start (int) - The row number for the first inserted row.
  • source_end (int) - The row number for the last inserted row.

_sourceRowsRemoved(self, parent, source_start, source_end)

 

Respond to the rowsRemoved signal from the source model.

Parameters:
  • parent (object) - Ignored, but present for compatibility with the Qt signal.
  • source_start (int) - The row number for the first removed row.
  • source_end (int) - The row number for the last removed row.

_sourceRowsInsDel(self, source_start, source_end, func, stack)

 

Respond to the rowsAboutToBeInserted or rowsAboutToBeRemoved signal from the source model.

Parameters:
  • source_start (int) - The row number for the first row inserted or removed.
  • source_end (int) - The row number for the last row inserted or removed.
  • func (function) - The method that should be called for each row insertion or removal. Should be endInsertRows() or endRemoveRows().
  • stack (list) - The stack used to keep track of how many times func was called. Should be self._row_insert_stack or self._row_remove_stack.
Returns: int
The number of source rows that were inserted or removed.

_sourceColumnsAboutToBeInserted(self, parent, start, end)

 

Respond to the columnsAboutToBeInserted signal from the source model.

Parameters:
  • parent (object) - Ignored, but present for compatibility with the Qt signal.
  • source_start (int) - The column number for the first column to be inserted.
  • source_end (int) - The column number for the last column to be inserted.

Note: We assume that all column insertions happen at the end of the alignment. This is consistent with the current behavior of the underlying models.

_columnInsertionOnColumnInsertion(self, old_source_cols, new_source_cols, source_cols_to_insert)

 

If the source model is inserting columns, determine if we need to insert columns into the proxy. This will only happen if source model started with fewer columns than the proxy's allowable width. If we need to insert columns, this method will call beginInsertColumns() with the appropriate values.

Parameters:
  • old_source_cols (int) - The number of source columns before the insertion.
  • new_source_cols (int) - The number of source columns after the insertion.
  • source_cols_to_insert (int) - The number of source columns to be inserted.
Returns: bool
True if we need to insert columns into the proxy. False otherwise.

_rowInsertionOnColumnInsertion(self, old_wrap_count, new_wrap_count, wraps_added)

 

If the source model is inserting columns, determine if we need to insert rows into the proxy. This will only happen if we've added enough columns that we need additional line wraps. If we need to insert rows, this method will call beginInsertRows() with the appropriate values.

Note that if we're adding rows and columns simultaneously and we need additional line wraps (which would happen if we added a new sequence that's longer than the current alignment length), then this method will handle the wrapped row insertions for the rows that are in the process of being added.

Parameters:
  • old_wrap_count (int) - The number of table wraps before the insertion.
  • new_wrap_count (int) - The number of table wraps after the insertion.
  • wraps_added (int) - The number of wraps that the insertion added.
Returns: bool
True if we need to insert rows into the proxy. False otherwise.

_dataChangedOnColumnInsertion(self, old_wrap_count, wraps_added, old_source_cols, new_source_cols)

 

If the source model is inserting columns, determine if we will need to emit a dataChanged signal. This will only happen if there were source columns insertions that won't trigger proxy row or column insertions.

Parameters:
  • old_wrap_count (int) - The number of table wraps before the insertion.
  • wraps_added (int) - The number of wraps that the insertion added.
  • old_source_cols (int) - The number of source columns before the insertion.
  • new_source_cols (int) - The number of source columns after the insertion.
Returns: bool
If we need to emit dataChanged, a tuple of:
  • The wrap number that we should emit dataChanged for (int)
  • The leftmost column for the dataChanged signal (int)
  • The rightmost column for the dataChanged signal (int)

None otherwise.

_emitDataChangedForColumnInsDel(self, wrap_num, col_start, col_end)

 

Emit the dataChanged signal for the specified wrap and columns.

Parameters:
  • wrap_num (int) - The wrap to emit the signal for. All rows in this wrap will be included in the signal.
  • col_start (int) - The leftmost column to emit the signal for
  • col_end (int) - The rightmost column to emit the signal for

_sourceColumnsAboutToBeRemoved(self, parent, source_start, source_end)

 

Respond to the columnsAboutToBeRemoved signal from the source model.

Parameters:
  • parent (object) - Ignored, but present for compatibility with the Qt signal.
  • source_start (int) - The column number for the first source column to be removed.
  • source_end (int) - The column number for the last source column to be inserted.

Note: We assume that all column removals happen at the end of the alignment. This is consistent with the current behavior of the underlying models.

_columnRemovalOnColumnRemoval(self, source_start, source_end, new_source_cols)

 

If the source model is removing columns, determine if we need to remove columns from the proxy. This will only happen if source model ended with fewer columns than the proxy's allowable width. If we need to remove columns, this method will call beginRemoveColumns() with the appropriate values.

Parameters:
  • source_start (int) - The column number for the first source column to be removed.
  • source_end (int) - The column number for the last source column to be inserted.
  • new_source_cols (int) - The number of source columns after the removal.
Returns: bool
True if we need to remove columns from the proxy. False otherwise.

_rowRemovalOnColumnRemoval(self, old_wrap_count, new_wrap_count, wraps_removed)

 

If the source model is removing columns, determine if we need to remove rows from the proxy. This will only happen if we've removed enough columns that we need fewer line wraps. If we need to remove rows, this method will call beginremoveRows() with the appropriate values.

Note that if we're removing rows and columns simultaneously and we need fewer line wraps (which would happen if we're removing the longest sequence), then the wrapped row removals for the sequences that are in the process of being removed have already been handled, so this method will avoid double removing them.

Parameters:
  • old_wrap_count (int) - The number of table wraps before the insertion.
  • new_wrap_count (int) - The number of table wraps after the insertion.
  • wraps_removed (int) - The number of wraps that the column removal removed.
Returns: bool
True if we need to remove rows from the proxy. False otherwise.

_dataChangedOnColumnRemoval(self, new_wrap_count, wraps_removed, old_source_cols, new_source_cols)

 

If the source model is removing columns, determine if we will need to emit a dataChanged signal. This will only happen if there were source columns removals that won't trigger proxy row or column removals.

Parameters:
  • new_wrap_count (int) - The number of table wraps after the removal.
  • wraps_removed (int) - The number of wraps that the insertion removed.
  • old_source_cols (int) - The number of source columns before the removal.
  • new_source_cols (int) - The number of source columns after the removal.
Returns: bool
If we need to emit dataChanged, a tuple of:
  • The wrap number that we should emit dataChanged for (int)
  • The leftmost column for the dataChanged signal (int)
  • The rightmost column for the dataChanged signal (int)

None otherwise.

_modelHeaderDataChanged(self, orientation, source_start, source_end)

 

Respond to a headerDataChanged signal from the model by emitting headerDataChanged

Parameters:
  • orientation () - The orientation of the header to update. Must be Qt.Horizontal.
  • source_start (int) - The index of the first source row where the header was changed
  • source_end (int) - The index of the last source row where the header was changed. Must equal source_start.

_modelDataChanged(self, source_left, source_right)

 

Respond to a dataChanged signal from the model by emitting dataChanged

Parameters:
  • source_left (QtCore.QModelIndex) - The left-most index to update
  • source_right (QtCore.QModelIndex) - The right-most index to update