Unify toolbar init across backends.#22250
Merged
timhoffm merged 1 commit intomatplotlib:mainfrom Jan 26, 2022
Merged
Conversation
... 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.
QuLogic
reviewed
Jan 19, 2022
| backend_tools.add_tools_to_container(self.toolbar) | ||
| if self.toolbar is not None: | ||
| self.SetToolBar(self.toolbar) | ||
| toolbar = self.canvas.manager.toolbar |
Member
There was a problem hiding this comment.
Is that not?
Suggested change
| toolbar = self.canvas.manager.toolbar | |
| toolbar = self.figmgr.toolbar |
Contributor
Author
There was a problem hiding this comment.
Yes, but I have some later plans to get rid of the (non-standard) figmgr as well...
QuLogic
approved these changes
Jan 20, 2022
6 tasks
timhoffm
approved these changes
Jan 26, 2022
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
pytestpasses).flake8-docstringsand 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).