Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve support for undo/redo functionality in Toolbox #256

Merged
merged 4 commits into from
Aug 4, 2023

Conversation

soininen
Copy link
Collaborator

@soininen soininen commented Aug 4, 2023

This PR includes a number of changes that are needed to fix issues with undo commands in Toolbox.

  • CacheItem.cascade_readd() now sets _to_remove to False. Unless I missed something, this is the only truly backwards-incompatible change.
  • Functions that remove items now return the cache items that were actually removed. This makes it possible to fully undo remove actions in Toolbox.
  • A new function CacheItem.readd() adds items without adding their referrers. This allows redoing additions that have later received referrers. For example, redoing an 'add object class' command should only readd the object class, not its parameter definitions that were added later.
  • CacheItem.deepcopy() can be used to create independent clones of CacheItems.

Re spine-tools/Spine-Toolbox#2228

@manuelma Just a heads-up: this might interfere with the entity branch.

Checklist before merging

  • Documentation (also in Toolbox repo) is up-to-date
  • Release notes in Toolbox repo have been updated
  • Unit tests have been added/updated accordingly
  • Code has been formatted by black
  • Unit tests pass

The field needs to be accessed from outside.

Re spine-tools/Spine-Toolbox#2228
There may be items that are marked both as removed and to-be-removed
when undoing remove actions.

Re spine-tools/Spine-Toolbox#2228
Toolbox needs to know which items were removed when removing them
in cascade to be able to fully undo the removal.

Re spine-tools/Spine-Toolbox#2228
@soininen soininen merged commit 4168c30 into master Aug 4, 2023
@soininen soininen deleted the toolbox_2228_fix_undoing_after_commit branch August 4, 2023 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant