-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
refactor non wx.ToolBar specific parts of NavigationToolbar2Wx/Agg into NavigationController2Wx/Agg #10145
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
refactor non wx.ToolBar specific parts of NavigationToolbar2Wx/Agg into NavigationController2Wx/Agg #10145
Conversation
…Agg into separate classes NavigationController2Wx/Agg to be used separately bug fix: add missing 'import six'
If your goal is to use the zoom/pan ability, you may be better served by the (poorly documented...) toolmanager API. |
I don't think the new toolmanager API has been implemented for Wx yet. This is a bit orthogonal to that work, but this is self-contained to the Wx backend and is backward compatible. I am 👍 on this going in as-is. |
@DietmarSchwertberger Thank you for your work on this. |
I was not aware of that. A cleaner and more straightforward approach with separation of functionality and GUI elements would be nice. The only documentation I found right now is stating that it's experimental and only in gtk3 and tk. For my wxGlade examples, I need to ship the restructured version anyway as I can't rely on anyone upgrading matplotlib immediately. |
fwiw I would much prefer updating the toolmanager API for wx. |
I had a look at the example and tried it with Tk instead of GTK as I'm using Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 to change in theory.
Have not tested locally (and we have no CI on this). Strongly prefer second reviewer check this locally.
@DietmarSchwertberger Using the toolmanager you can achieve what you want, In your lager application you won't use the toolbar, but just the toolmanager that gives you access to all the tools without the need for the gui part. I agree that we are lacking documentation for the toolmanager, but have you checked https://matplotlib.org/api/backend_managers_api.html ? I would really prefer this to go in the direction of the ToolManager, if we all push in the same direction we can move forward. |
Would a PR be accepted that just implements these, i.e. without an actual tool or status bar implementation?
|
Things seem to work fine with the tools copied from Qt and Tk implementations. |
plus bug fix: add missing 'import six'
PR Summary
When embedding a FigureCanvasWx or FigureCanvasWxAgg into a larger
application, the functionality of NavigationToolbar2Wx/Agg is quite useful,
but actually having to integrate the ToolBar is not too nice.
With this pull request you still can use the functionality (pan, zoom, save_figure etc.) now
as the non-ToolBar specific code is refactored into NavigationController2Wx/Agg.
I'm currently using this to prepare a more comprehensive example of a
matplotlib application to be supplied with wxGlade.
PR Checklist
I don't think that NavigationToolbar2Wx is documented anywhere except
in the examples. If anyone wants to use NavigationController2Wx/Agg, he/she
probably needs to look into the sources anyway.
If the pull request is accepted, I could prepare an example with
standard wx Buttons instead of the toolbar.