schrodinger.ui.sequencealignment.undo module

Implementation of multiple sequence viewer undo/redo mechanism.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.ui.sequencealignment.undo.UndoStack[source]

Bases: object

This undo implementation uses either Python copy methods, or cPickle module to store undo states.

__init__()[source]

Class constructor.

clearRedoStack()[source]

Clears redo stack and disables redo action. This function is called by storeState methods. Whenever state changes and is stored for undo, the redo operation is not valid anymore.

setActions(undo_action, redo_action)[source]

Sets Qt undo/redo actions, so that the undo/redo mechanism can change the corresponding menu items appropriately.

Parameters
  • undo_action (QAction) – Qt action for undo operation.

  • redo_action (QAction) – Qt action for redo operation.

storeStateSequence(sequence_group, index, from_redo=False, from_undo=False, label=None)[source]

Stores undo state of an individual sequence.

Parameters
  • sequence_group (SequenceGroup) – sequence group

  • from_redo (bool) – set to True if calling from redo function

  • from_undo (bool) – set to True if calling from undo function

  • label (string) – undo menu item label

Parame index

sequence index in the sequence group

storeStateGroup(sequence_group, from_redo=False, from_undo=False, label=None)[source]

Stores undo state of entire sequence group.

Parameters
  • sequence_group (SequenceGroup) – sequence group

  • from_redo (bool) – set to True if calling from redo function

  • from_undo (bool) – set to True if calling from undo function

  • label (string) – undo menu item label

storeStateGroupDeep(sequence_group, from_redo=False, from_undo=False, label=None)[source]

Stores undo state of entire sequence group and all sequences (makes a deep copy of the sequence group).

Parameters
  • sequence_group (SequenceGroup) – sequence group

  • from_redo (bool) – set to True if calling from redo function

  • from_undo (bool) – set to True if calling from undo function

  • label (string) – undo menu item label

undo(viewer)[source]

This function undoes the last operation.

redo(viewer)[source]

This function redoes the operation that was undone.

updateActions()[source]

Updates Qt actions text and enabled state based on undo/redo stacks contents.