Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Fix double picks.#19611

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 1 commit intomatplotlib:masterfromanntzer:2pick
Mar 5, 2021
Merged

Fix double picks.#19611

QuLogic merged 1 commit intomatplotlib:masterfromanntzer:2pick
Mar 5, 2021

Conversation

anntzer
Copy link
Contributor

pick_events were previously incorrectly emitted twice due to the
combination of two recent(ish) chnages: Figures now always start with a
FigureCanvasBase attached -- eventually switching to a concrete subclass
of FigureCanvasBase for display or saving --, and callbacks are now
actually stored at the Figure level rather than the Canvas level.
Hence, the button_pick_id callback (in charge of emitting picks) would
previously be both registered both through the FigureCanvasBase and the
concrete subclass. The fix is to also move that callback to the Figure
level, so that each Figure only has one such callback.

PR Summary

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@anntzeranntzer added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelMar 1, 2021
@anntzeranntzer added this to thev3.4.0 milestoneMar 1, 2021
@larsoner
Copy link
Contributor

This fixes things locally for me both in my "minimal" (though from the test here it clearly wasn't as minimal as it could have been!) and in my real-world usecase subclassingFigure, thanks for the quick fix@anntzer

@@ -2109,6 +2109,10 @@ def __init__(self,
# a proxy property), but that actually need to be on the figure for
# pickling.
self._canvas_callbacks = cbook.CallbackRegistry()
self._button_pick_id = self._canvas_callbacks.connect(
Copy link
Member

Choose a reason for hiding this comment

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

I'm not particularly up on how the callback system works, but this seems intrusive infigure.py.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The point of#16220 was to move callback handling from the canvas to the figure (for reasons explained in that PR).

@jklymak
Copy link
Member

Ok, I still think this needs some thought. I think of a figure as a logical container for the axes and figure artists. If we change the semantics to also be the thing that handles mouse interactions that is a pretty big change and just doing it because of pickling, of all features, is irksome 😀

@jklymak
Copy link
Member

.. I mean I guess it has to pass CI...

pick_events were previously incorrectly emitted twice due to thecombination of two recent(ish) chnages: Figures now always start with aFigureCanvasBase attached -- eventually switching to a concrete subclassof FigureCanvasBase for display or saving --, and callbacks are nowactually stored at the Figure level rather than the Canvas level.Hence, the button_pick_id callback (in charge of emitting picks) wouldpreviously be both registered both through the FigureCanvasBase and theconcrete subclass.  The fix is to also move that callback to the Figurelevel, so that each Figure only has one such callback.
@QuLogicQuLogic merged commitd195747 intomatplotlib:masterMar 5, 2021
@QuLogic
Copy link
Member

Not sure why this didn't backport.

@meeseeksdev backport to v3.4.x

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestMar 5, 2021
@anntzeranntzer deleted the 2pick branchMarch 5, 2021 07:17
QuLogic added a commit that referenced this pull requestMar 5, 2021
…611-on-v3.4.xBackport PR#19611 on branch v3.4.x (Fix double picks.)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@jklymakjklymakjklymak approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.4.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@larsoner@jklymak@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp