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

Class ViewModel

       object --+                
                |                
sip.simplewrapper --+            
                    |            
          sip.wrapper --+        
                        |        
     PyQt4.QtCore.QObject --+    
                            |    
            Qt.QtCore.QObject --+
                                |
                               ViewModel

An abstraction layer for the various table models in this module

Instance Methods [hide private]
 
sortingChanged(...)
A signal emitted when the sorting or row reodering (due to drag-and-drop) has changed.
 
__init__(self, parent)
x.__init__(...) initializes x; see help(type(x)) for signature
 
setUndoStack(self, undo_stack)
Use the given undo stack when sorting the table or reordering rows.
 
setRowWrap(self, enabled)
Enable or disabled row wrapping.
bool
rowWrap(self)
Return the current row wrapping setting.
RowOrder
currentOrdering(self)
Returns the current row ordering
 
setOrdering(self, ordering)
Set current row ordering
 
_reorderRow(self, from_row, to_row)
Reorder a row in response to a drag-and-drop (or a redo of a drag-and- drop).
 
_sortBy(self, sort_by, order)
Sort the table by the specified criteria.
 
reorderRow(self, from_row, to_row)
Create a command that can reorder a row in response to a drag-and-drop.
 
sortBy(self, sort_by, order=0)
Create a command to sort the table by the specified criteria.
 
orderingLengthChanged(self)
When the length of the DragAndDropReorderingProxy row order list changes, emit sortingChanged so the msv_widget.AbstractMsvWidget knows to re-read the list and store the updated value in msv_widget.WidgetOptions.

Inherited from Qt.QtCore.QObject: connect, emit

Inherited from PyQt4.QtCore.QObject: __getattr__, blockSignals, childEvent, children, connectNotify, customEvent, deleteLater, destroyed, disconnect, disconnectNotify, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChildren, inherits, installEventFilter, isWidgetType, killTimer, metaObject, moveToThread, objectName, parent, 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]

sortingChanged(...)

 
A signal emitted when the sorting or row reodering (due to drag-and-drop) has changed. Emitted with:
  • True if the panel ui elements (e.g. menu, menubars, etc) should be updated because the sorting type has changed. False otherwise (e.g. if the row reordering list should be reread but the menus don't need updating).

__init__(self, parent)
(Constructor)

 

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

Overrides: object.__init__
(inherited documentation)

setUndoStack(self, undo_stack)

 

Use the given undo stack when sorting the table or reordering rows.

Parameters:
  • undo_stack (QtCore.QUndoStack) - The undo stack to use

Note: Most undoable MSV operations are initiated via a panel ui element. As such, those undoable request must pass through the MSV widget (msv_widget.AbstractMsvWidget) and the MSV widget can manage the undo stack. However, reorder row requests come from the view (view.AbstractAlignmentView) directly to TopModel and never pass through the MSV widget. As a result, we pass the undo stack to the ViewModel and allow it to create undoable commands.

setRowWrap(self, enabled)

 

Enable or disabled row wrapping.

Parameters:
  • enabled (bool) - True if rows should be wrapped. False otherwise.

rowWrap(self)

 

Return the current row wrapping setting.

Returns: bool
True if the rows are wrapped. False otherwise.

currentOrdering(self)

 

Returns the current row ordering

Returns: RowOrder
A RowOrder object describing the current row ordering

setOrdering(self, ordering)

 

Set current row ordering

Parameters:

_reorderRow(self, from_row, to_row)

 

Reorder a row in response to a drag-and-drop (or a redo of a drag-and- drop). If the menus need updating, emit sortingChanged.

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.
Decorators:
  • @command.from_command_only

_sortBy(self, sort_by, order)

 

Sort the table by the specified criteria.

Parameters:
  • sort_by (SortBy or NoneType) - The category to use for sorting. If None, the original input order will be used.
  • order (int) - Whether the data should be sorted in ascending (Qt.AscendingOrder) or descending (Qt.DescendingOrder) order.
Decorators:
  • @command.from_command_only

reorderRow(self, from_row, to_row)

 

Create a command that can 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.
Decorators:
  • @command.do_command

sortBy(self, sort_by, order=0)

 

Create a command to sort the table by the specified criteria.

Parameters:
  • sort_by (SortBy or NoneType) - The category to use for sorting. If None, the original input order will be used.
  • order (int) - Whether the data should be sorted in ascending (Qt.AscendingOrder) or descending (Qt.DescendingOrder) order.
Decorators:
  • @command.do_command