Opened 6 years ago
Closed 6 years ago
#2097 closed enhancement (fixed)
Undo aggregate and block context managers
| Reported by: | Conrad Huang | Owned by: | Greg Couch |
|---|---|---|---|
| Priority: | major | Milestone: | 1.0 |
| Component: | Core | Version: | |
| Keywords: | Cc: | gregc@… | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description (last modified by )
Undo manager needs to provide ways of aggregating undo for multiple commands into a single entry (use case: nucleotide style buttons) or to block undo actions (use case: "tile" command not wanting "move" undo actions). Usage may be something like:
# Aggregate undo action is registered after "with"
with session.undo.aggregate("cmd_title"):
run("command 1; command 2; command 3")
# Each command needs to be undone, in order
# Must manually register custom undo action
with session.undo.block("tile"):
run("move x 10 #1; move x 20 #2")
# A bunch of commands whose net result is captured by view
# and undo only uses the saved views
session.undo.register(myCustomUndoAction)
Aggregate undo actions can be "redo"ne if all sub-actions can be redone.
Change History (3)
comment:1 by , 6 years ago
| Cc: | added |
|---|---|
| Owner: | changed from to |
comment:2 by , 6 years ago
| Description: | modified (diff) |
|---|
comment:3 by , 6 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Implemented in 801efb8d8.
"tile" now use block() to prevent extraneous undo actions from being registered by "move" and "view" commands. Undo actions added for "move", "turn", "roll" and "view".
aggregate() is untested, but should be used by nucleotides style buttons in toolbar.