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

Remove visibility changes in draw for *Cursor widgets#19763

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
tacaswell merged 2 commits intomatplotlib:mainfromQuLogic:widget-events
Dec 16, 2022

Conversation

QuLogic
Copy link
Member

PR Summary

This can be all handled in the mouse move event handler instead, and prevents triggering extra draws in nbAgg.

Fixes#19633.

Additionally, mark access to said event handlers as deprecated.

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • [n/a] 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).
  • [n/a] 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).

if self.ignore(event):
return
if event.inaxes not in self.axes:
return
if not self.canvas.widgetlock.available(self):
return
self.needclear = True
if not self.visible:
Copy link
Member

Choose a reason for hiding this comment

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

Why drop this?

Copy link
Member

Choose a reason for hiding this comment

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

I think we want to keep this short-circuit to avoid going to_update which avoids adraw_idle down the line.

ianhi reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

If that's the case, we might want to clarify that for our future selves with a comment.

Copy link
MemberAuthor

@QuLogicQuLogicMar 26, 2021
edited
Loading

Choose a reason for hiding this comment

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

Well, we want to remove it from here so that the later.set_visible is effective. I'll see if we can still skip the_update at least. Alternatively, we should turn the visibility attributes into property setters.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see now. We used toalways make the lines not visible so ifnot self.visible we could safely bail.

Do we need some more careful logic on this like to callself._update() if visible or just made invisible? I suspect there is now also some path where we can setself.vertOn orself.horizOn to False and then they never get removed?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I re-added a condition on the_update calls, which is hopefully sufficient.

@jklymak
Copy link
Member

ping@ianhi or@anntzer for a second review here?

def onmove(self, event):
onmove = _api.deprecate_privatize_attribute('3.5')

def _onmove(self, event):
if self.ignore(event):
return
if event.inaxes not in self.axes:
return
if not self.canvas.widgetlock.available(self):
return
self.needclear = True
Copy link
Contributor

Choose a reason for hiding this comment

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

Sidenote but as far as I can tellself.needclear is never actually used inMultiCursor

Copy link
Contributor

@ianhiianhi left a comment

Choose a reason for hiding this comment

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

I think this has introduced some incorrect behavior where the cursor is not removed when the mouse leaves the axes. Also@tacaswell noted:

Do we need some more careful logic on this like to call self._update() if visible or just made invisible? I suspect there is now also some path where we can set self.vertOn or self.horizOn to False and then they never get removed

I found that moving the cursor around and then settingmulti.horizOn = False leaves an artifact:

horizOn

@QuLogic
Copy link
MemberAuthor

Hmm, I tested changing those settings, but it may have been only while the mouse was already over the window.

@jklymakjklymak marked this pull request as draftMay 13, 2021 14:17
@QuLogicQuLogic modified the milestones:v3.5.0,v3.6.0Aug 23, 2021
@QuLogicQuLogic modified the milestones:v3.6.0,v3.7.0Jul 5, 2022
This can be all handled in the mouse move event handler instead, andprevents triggering extra draws in nbAgg.Fixesmatplotlib#19633.
@tacaswell
Copy link
Member

Pro: rebased
Con: can still reproduce the issues@ianhi reported with disabling the horizontal line

I'm half inclined to merge this even with that issue as this is still a big step forward.

@ianhi
Copy link
Contributor

I'm half inclined to merge this even with that issue as this is still a big step forward.

🚀 🚀 🚀 🚀 🚀 - the power to blit in notebooks awaits!

@tacaswelltacaswell marked this pull request as ready for reviewDecember 16, 2022 16:24
@tacaswell
Copy link
Member

Given Ian's comment I marked this non-draft and approved. I'm holding off on merging at@timhoffm 's review is very old now so this should get another set of eyes.

@tacaswelltacaswell merged commitc1588e6 intomatplotlib:mainDec 16, 2022
@QuLogicQuLogic deleted the widget-events branchDecember 17, 2022 00:44
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestDec 17, 2022
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestDec 30, 2022
By implementing `_onmove` in a similar manner to `Cursor`.Followup tomatplotlib#19763.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestDec 30, 2022
By implementing `_onmove` in a similar manner to `Cursor`. Also,deprecate the related `needclear` attribute in both widgets.Followup tomatplotlib#19763.
@QuLogic
Copy link
MemberAuthor

I followed up on both@ianhi's issues in#24845.

raphaelquast pushed a commit to raphaelquast/matplotlib that referenced this pull requestMar 16, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ianhiianhiianhi requested changes

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.7.0
Development

Successfully merging this pull request may close these issues.

Multicursor disappears when not moving on nbagg with useblit=False + burns CPU
5 participants
@QuLogic@jklymak@tacaswell@ianhi@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp