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

Class ViewModel

       object --+            
                |            
sip.simplewrapper --+        
                    |        
          sip.wrapper --+    
                        |    
     PyQt5.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.
 
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.

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, parent, 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 PyQt5.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 ToggleProxyModel 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.

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