Visitar URL original
Move _SelectorWidget._props into SpanSelector by QuLogic · Pull Request #25404 · matplotlib/matplotlib · GitHub
The Wayback Machine - https://web.archive.org/web/20230308144221/https://github.com/matplotlib/matplotlib/pull/25404
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

Move _SelectorWidget._props into SpanSelector #25404

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Mar 7, 2023

PR Summary

This is the only selector widget that needs to remember its properties separately from the artist, because the artist can be recreated.

Fixes #25199

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • [n/a] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [n/a] New plotting related features are documented with examples.

Release Notes

  • [n/a] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • [n/a] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • [n/a] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@anntzer
Copy link
Contributor

anntzer commented Mar 7, 2023

Instead of storing _props in a separate dict at all, can't the artist re-creation call Artist.update_from to copy the original artist's properties?

This was the only selector widget that needed to remember its properties
separately from the artist, because the artist can be recreated, but we
can copy from the old to new.

Fixes matplotlib#25199
@QuLogic
Copy link
Member Author

QuLogic commented Mar 8, 2023

I just forgot about that; should work that way now.

There are already a few for the other Selectors.
@@ -2680,7 +2680,7 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
# prev attribute is deprecated but we still need to maintain it
self._prev = (0, 0)

def new_axes(self, ax):
def new_axes(self, ax, _props=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

make _props kwonly? ("private")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: AttributeError: 'LassoSelector' object has no attribute '_props'
2 participants