schrodinger.application.msv.command module

class schrodinger.application.msv.command.CommandType(value)

Bases: enum.IntEnum

An enumeration.

MoveTab = 1
AddGaps = 2
SelectResidues = 3
class schrodinger.application.msv.command.UndoStack(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QUndoStack

Custom QUndoStack for MSV2.

Variables

in_macro – Whether currently inside a macro.

__init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

beginMacro(self, str)[source]
endMacro(self)[source]
__len__()

Return len(self).

blockSignals(self, bool) → bool
canRedo(self) → bool
canRedoChanged

canRedoChanged(self, bool) [signal]

canUndo(self) → bool
canUndoChanged

canUndoChanged(self, bool) [signal]

childEvent(self, QChildEvent)
children(self) → List[QObject]
cleanChanged

cleanChanged(self, bool) [signal]

cleanIndex(self) → int
clear(self)
command(self, int) → QUndoCommand
connectNotify(self, QMetaMethod)
count(self) → int
createRedoAction(self, QObject, prefix: str = '') → QAction
createUndoAction(self, QObject, prefix: str = '') → QAction
customEvent(self, QEvent)
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

index(self) → int
indexChanged

indexChanged(self, int) [signal]

inherits(self, str) → bool
installEventFilter(self, QObject)
isActive(self) → bool
isClean(self) → bool
isSignalConnected(self, QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
killTimer(self, int)
metaObject(self) → QMetaObject
moveToThread(self, QThread)
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) → QObject
property(self, str) → Any
push(self, QUndoCommand)
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) → int
redo(self)
redoText(self) → str
redoTextChanged

redoTextChanged(self, str) [signal]

removeEventFilter(self, QObject)
resetClean(self)
sender(self) → QObject
senderSignalIndex(self) → int
setActive(self, active: bool = True)
setClean(self)
setIndex(self, int)
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) → bool
setUndoLimit(self, int)
signalsBlocked(self) → bool
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
text(self, int) → str
thread(self) → QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) → str
undo(self)
undoLimit(self) → int
undoText(self) → str
undoTextChanged

undoTextChanged(self, str) [signal]

class schrodinger.application.msv.command.Command(redo, undo, description, command_id=- 1, desc_merge=None)[source]

Bases: PyQt5.QtWidgets.QUndoCommand

__init__(redo, undo, description, command_id=- 1, desc_merge=None)[source]
Parameters
  • redo (callable) – A method that redoes some action

  • undo (callable) – A function that undoes the actions of redo

  • description (str) – A short summary of what redo accomplishes

  • command_id (int) – An id to assign the command.

  • desc_merge (callable) – A function that takes two command descriptions and merges them.

redo(self)[source]
undo(self)[source]
id(self) → int[source]
mergeWith(self, QUndoCommand) → bool[source]
actionText(self) → str
child(self, int) → QUndoCommand
childCount(self) → int
isObsolete(self) → bool
setObsolete(self, bool)
setText(self, str)
text(self) → str
class schrodinger.application.msv.command.TimeBasedCommand(redo, undo, description, command_id=- 1, desc_merge=None, merge_time_interval=1)[source]

Bases: schrodinger.application.msv.command.Command

A class for undo commands that can be can be merged together if they have the same command_id and occur within a certain time interval.

__init__(redo, undo, description, command_id=- 1, desc_merge=None, merge_time_interval=1)[source]
Parameters
  • redo (callable) – A method that redoes some action

  • undo (callable) – A function that undoes the actions of redo

  • description (str) – A short summary of what redo accomplishes

  • command_id (int) – An id to assign the command.

  • desc_merge (callable) – A function that takes two command descriptions and merges them.

  • merge_time_interval – The max time in seconds that two commands with the same ID can occur in while still merging. Defaults to 1.

mergeWith(self, QUndoCommand) → bool[source]
actionText(self) → str
child(self, int) → QUndoCommand
childCount(self) → int
id(self) → int
isObsolete(self) → bool
redo(self)
setObsolete(self, bool)
setText(self, str)
text(self) → str
undo(self)
schrodinger.application.msv.command.do_command(meth=None, *, command_id=-1, command_class=<class 'schrodinger.application.msv.command.Command'>, **dec_kwargs)[source]

Decorates a method returning parameters for a Command, constructs the Command, and pushes it onto the command stack if there is one or calls redo if there isn’t. Also validates the Command parameters if DEBUG mode is enabled.

The decorated method must return a tuple of at least three values:
  • The redo method (callable)

  • The undo method (callable)

  • A description of the command (str)

The returned tuple may also include additional values, which will be passed to the command class’s __init__ method (see command_class param below).

Alternatively, the decorated method may return NO_COMMAND, in which case no command will be added to the undo stack. In this case, no changes should be made to the alignment. This is useful if the arguments passed to the method do not require any changes to the alignment.

When the decorated method is called, it will return the value returned by the redo method.

The decorator itself takes two optional keyword-only arguments:

Parameters
  • command_id (int) – The command ID. If given, then any sequential commands with the same command ID will be merged as they are pushed onto the undo stack. If no command ID is given, then no command merging will occur. (Note that different `command_class`es may alter this command merging behavior.)

  • command_class (Type[Command]) – The command class to use. Must be Command or a Command subclass.

Any additional keyword arguments passed to the decorator will be passed to the command class’s __init__ method.

schrodinger.application.msv.command.compress_command(stack, description)[source]

Enables compression of commands on undo stack, so they can be revoked using a single undo call.

Parameters
  • stack (QUndoStack) – Undo stack to compress commands on.

  • description (str) – Description of the compressed command.

schrodinger.application.msv.command.from_command_only(meth, *args, **kwargs)[source]

When running in DEBUG mode, enforces the requirement that the decorated method only be called from a command object

schrodinger.application.msv.command.revert_command(stack)[source]

Undo and discard the last command on the undo stack.

Parameters

stack (QtWidgets.QUndoStack) – The undo stack