Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix toolmanager x/y scale "togglers". #26580

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
Loading
from
Draft

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Aug 23, 2023

ToolXScale and ToolYScale actually cannot be implemented using ToolToggleBase because a single "toggle" flag cannot store the log/linear state of multiple axes at once (i.e. the behavior of pressing "l" becomes wrong as soon as there are multiple axes in a given figure). Instead these must be plain tools that inspect the actual scale on the axes before deciding what to do.

In practice, the easiest is to again reuse the classic toolbar implementation, as is already done for ToolGrid and ToolMinorGrid. Factor out that "forward-to-classic-toolbar" implementation into a _ToolForwardingToClassicToolbar base class and use that whereever possible.

As in #16823, providing strict backcompat seems too hard to be worth it.

PR summary

PR checklist

lib/matplotlib/backend_tools.py Outdated Show resolved Hide resolved
lib/matplotlib/backend_tools.py Outdated Show resolved Hide resolved
@anntzer anntzer marked this pull request as draft August 24, 2023 07:05
lib/matplotlib/backend_tools.py Outdated Show resolved Hide resolved
lib/matplotlib/backend_tools.py Outdated Show resolved Hide resolved
lib/matplotlib/backend_tools.py Outdated Show resolved Hide resolved
@anntzer
Copy link
Contributor Author

anntzer commented Aug 24, 2023

Yes, that's much better, thanks for the suggestion.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally, you may think of a class name not containing ClassicToolbar . And modulo CI failures.

@anntzer
Copy link
Contributor Author

anntzer commented Aug 24, 2023

I actually can't repro the failures locally (tests pass fine) :/ I'll investigate, but do you get them?

@timhoffm
Copy link
Member

Doc warnings are real:

/home/circleci/project/lib/matplotlib/backend_tools.py:docstring of matplotlib.backend_tools.ToolFullScreen:1: WARNING: py:class reference target not found: matplotlib.backend_tools._ToolForwardingToClassicToolbar
/home/circleci/project/lib/matplotlib/backend_tools.py:docstring of matplotlib.backend_tools.ToolGrid:1: WARNING: py:class reference target not found: matplotlib.backend_tools._ToolForwardingToClassicToolbar
/home/circleci/project/lib/matplotlib/backend_tools.py:docstring of matplotlib.backend_tools.ToolMinorGrid:1: WARNING: py:class reference target not found: matplotlib.backend_tools._ToolForwardingToClassicToolbar
/home/circleci/project/lib/matplotlib/backend_tools.py:docstring of matplotlib.backend_tools.ToolQuit:1: WARNING: py:class reference target not found: matplotlib.backend_tools._ToolForwardingToClassicToolbar
/home/circleci/project/lib/matplotlib/backend_tools.py:docstring of matplotlib.backend_tools.ToolQuitAll:1: WARNING: py:class reference target not found: matplotlib.backend_tools._ToolForwardingToClassicToolbar
/home/circleci/project/lib/matplotlib/backend_tools.py:docstring of matplotlib.backend_tools.ToolXScale:1: WARNING: py:class reference target not found: matplotlib.backend_tools._ToolForwardingToClassicToolbar
/home/circleci/project/lib/matplotlib/backend_tools.py:docstring of matplotlib.backend_tools.ToolYScale:1: WARNING: py:class reference target not found: matplotlib.backend_tools._ToolForwardingToClassicToolbar

I'm off-site and cannot run the tests locally right now.

@anntzer
Copy link
Contributor Author

anntzer commented Aug 24, 2023

(I know about the doc failures, I just need to (pick a better base class name and) rerun sphinx with -Omissing_references_write_json=1)

ToolXScale and ToolYScale actually *cannot* be implemented using
ToolToggleBase because a single "toggle" flag cannot store the
log/linear state of *multiple* axes at once (i.e. the behavior of
pressing "l" becomes wrong as soon as there are multiple axes in a given
figure).  Instead these must be plain tools that inspect the actual
scale on the axes before deciding what to do.

In practice, the easiest is to again reuse the classic toolbar
implementation, as is already done for ToolGrid and ToolMinorGrid.
Factor out that "forward-to-classic-toolbar" implementation into a
_ToolForwardingToClassicToolbar base class and use that whereever
possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.