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

Class DragAndDropReorderingProxy

                             object --+    
                                      |    
                             ProxyMixin --+
                                          |
         object --+                       |
                  |                       |
  sip.simplewrapper --+                   |
                      |                   |
            sip.wrapper --+               |
                          |               |
       PyQt4.QtCore.QObject --+           |
                              |           |
PyQt4.QtCore.QAbstractItemModel --+       |
                                  |       |
    PyQt4.QtGui.QAbstractProxyModel --+   |
                                      |   |
                         NonNestedProxy --+
                                          |
                                         DragAndDropReorderingProxy

A proxy for reordering rows in response to drag and drop actions. Note that this proxy must be immediately after the SortProxyModel as it needs to receive the SortProxyModel.aboutToSort signal and needs access to the SortProxyModel.currentOrdering method. Also note that this proxy will not reorder rows when the SortProxyModel is sorting the rows. If the user drag-and-drops a row while sorting is "active," this proxy will:

Nested Classes [hide private]

Inherited from ProxyMixin: __metaclass__

Instance Methods [hide private]
 
orderingLengthChanged(...)
A signal emitted when this proxy is "active" (i.e.
 
__init__(self, parent=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
setSourceModel(self, model)
 
_initializeReordering(self)
Populate self._to_source and self._from_source so that this proxy doesn't change the row ordering.
bool
reorderRow(self, from_row, to_row)
Reorder a row in response to a drag and drop.
 
_clearSorting(self)
Turn off sorting in the SortProxyModel.
 
_updateFromSource(self, during_row_move=False)
Update self._from_source so it matches self._to_source.
 
resetOrdering(self)
Reset the row ordering back to the original order
 
mapFromSource(self, source_index)
 
mapToSource(self, proxy_index)
 
rowCount(self, parent=None)
 
columnCount(self, parent=None)
list
currentOrdering(self)
Return the current row ordering.
 
setOrdering(self, ordering)
Set the row ordering.
 
_modelDataChanged(self, top_left, bottom_right)
Respond to the dataChanged signal from the model.
 
_modelHeaderDataChanged(self, orientation, first, last)
Respond to the headerDataChanged signal from the model.
 
_rowsAboutToBeInserted(self, parent, start, end)
Respond to the rowsAboutToBeInserted signal from the model.
 
_rowsInserted(self)
Respond to the rowsInserted signal from the model.
 
_rowsAboutToBeRemoved(self, parent, start, end)
Respond to the rowsAboutToBeRemoved signal from the model.
 
_rowsRemoved(self, parent, start, end)
Respond to the rowsRemoved signal from the model.
 
_layoutAboutToBeChanged(self)
Respond to the layoutAboutToBeChanged signal from the model.
 
_layoutChanged(self)
Respond to the layoutChanged signal from the model.
 
_modelReset(self)
Respond to the modelReset signal from the model.

Inherited from ProxyMixin: emitResidueSelection, residueFormatChanged, residuesSelected, sourceModel

Inherited from NonNestedProxy: index, parent, resetCountCache

Inherited from PyQt4.QtGui.QAbstractProxyModel: buddy, canFetchMore, data, fetchMore, flags, hasChildren, headerData, 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, reset, resetInternalData, roleNames, rowsAboutToBeInserted, rowsAboutToBeMoved, rowsAboutToBeRemoved, rowsInserted, rowsMoved, rowsRemoved, setRoleNames, setSupportedDragActions, 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]

orderingLengthChanged(...)

 
A signal emitted when this proxy is "active" (i.e. when rows have been reordered) and the number of sequences in the table has changed. Anything that maintains a copy of the row reordering (such as msv_widget.AbstractMsvWidget) should re-read the ordering in response to this signal.

__init__(self, parent=None)
(Constructor)

 

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

Overrides: object.__init__
(inherited documentation)

setSourceModel(self, model)

 
Overrides: PyQt4.QtGui.QAbstractProxyModel.setSourceModel

reorderRow(self, from_row, to_row)

 

Reorder a row in response to a drag and drop.

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.
Returns: bool
True if the menus need updating (i.e. if we just switched from sorting to reordered rows). False otherwise.

_clearSorting(self)

 

Turn off sorting in the SortProxyModel. This method will ignore all row insertion/deletion signals from the SortProxyModel, since the row ordering isn't actually being changed; it's just being copied from SortProxyModel to this proxy.

_updateFromSource(self, during_row_move=False)

 

Update self._from_source so it matches self._to_source. If this function is called while we are in the middle of moving a row, we need to make _from_source one element longer than _to_source, since the row that's being moved has already been removed from _to_source.

Parameters:
  • during_row_move (bool) - If True, _from_source will be one element longer than _to_source.

resetOrdering(self)

 

Reset the row ordering back to the original order

Decorators:
  • @skip_when_copying_sort

mapFromSource(self, source_index)

 
Overrides: PyQt4.QtGui.QAbstractProxyModel.mapFromSource

mapToSource(self, proxy_index)

 
Overrides: PyQt4.QtGui.QAbstractProxyModel.mapToSource

rowCount(self, parent=None)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.rowCount

columnCount(self, parent=None)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.columnCount

currentOrdering(self)

 

Return the current row ordering.

Returns: list
A list of row numbers

setOrdering(self, ordering)

 

Set the row ordering.

Parameters:
  • ordering (list) - A list of row numbers

_modelDataChanged(self, top_left, bottom_right)

 

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

_modelHeaderDataChanged(self, orientation, first, last)

 

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

_rowsAboutToBeInserted(self, parent, start, end)

 

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

Decorators:
  • @skip_when_copying_sort

_rowsInserted(self)

 

Respond to the rowsInserted signal from the model.

Decorators:
  • @skip_when_copying_sort

_rowsAboutToBeRemoved(self, parent, start, end)

 

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

Decorators:
  • @skip_when_copying_sort

_rowsRemoved(self, parent, start, end)

 

Respond to the rowsRemoved signal from the model. See the QAbstractProxyModel.rowsRemoved signal documentation for argument documentation.

Decorators:
  • @skip_when_copying_sort

_layoutAboutToBeChanged(self)

 

Respond to the layoutAboutToBeChanged signal from the model.

Decorators:
  • @skip_when_copying_sort

_layoutChanged(self)

 

Respond to the layoutChanged signal from the model.

Decorators:
  • @skip_when_copying_sort