Unify toolbar init across backends. #22250
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... by instantiating classes specified by _toolbar2_class or
_toolmanager_toolbar_class. (Third-parties can still manually
instantiate their toolbars the old-fashioned way.)
Note that this would read a bit nicer if the toolbar classes were
defined before the manager classes, as this would allow _toolbar2_class
and _toolmanager_toolbar_class to be set using normal class attributes,
but moving large chunks of code around did not seem worth it. I only
did so for the macosx backend, where the moved code is very little.
This means that all toolbars default to having the standard tools added,
not just the interactive ones. See e.g. changes in
test_toolbar_zoompan: it is no longer necessary to explicitly register
all the tools (this actually now emits a duplicate tool warning).
This also moves the canonical storage of the toolbar on wx from the
frame to the manager (keeping a proxy for backcompat), for consistency
with the other backends.
PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).