Skip to content

Remove start_event_loop_default. Let pause() run the event loop for all backends. #8867

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

Merged
merged 3 commits into from
Sep 18, 2017

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 12, 2017

First commit: Move start_event_loop_default to start_event_loop.

There's no benefit to the end user to having a deprecation warning in
start_event_loop (which gets called e.g. by ginput) -- it's essentially
just there to let the devs know that they could implement a more
efficient (GUI toolkit-dependent) version. So just provide the default
implementations instead and add a note that GUI toolkits may override
them.

flush_events doesn't need to raise by default, it can just return
nothing for non-interactive backends.

Second commit: Let pause always run the event loop.

The default start_event_loop is not as efficient as it could be for
non-interactive backends (it runs a busy loop) but if you really care
you should just call time.sleep in that case.

Meanwhile, this avoids the need for third-party interactive backends to
register themselves into rcsetup.interactive_bk in order to be correctly
pause()able.

loop so that interactive functions, such as ginput and
waitforbuttonpress, can wait for events.
Such an event loop is used by interactive functions, such as ginput and
waitforbuttonpress, to wait for events. This should not be confused
Copy link
Member

Choose a reason for hiding this comment

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

I do not think this is correct, the GUI event loop is not always running.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feel free to edit the message and force push if you'd like to.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jul 13, 2017
@tacaswell
Copy link
Member

@anntzer force-pushed to this branch.

anntzer and others added 3 commits August 22, 2017 20:08
There's no benefit to the end user to having a deprecation warning in
start_event_loop (which gets called e.g. by ginput) -- it's essentially
just there to let the devs know that they could implement a more
efficient (GUI toolkit-dependent) version.  So just provide the default
implementations instead and add a note that GUI toolkits may override
them.

flush_events doesn't need to raise by default, it can just return
nothing for non-interactive backends.
The default `start_event_loop` is not as efficient as it could be for
non-interactive backends (it runs a busy loop) but if you really care
you should just call time.sleep in that case.

Meanwhile, this avoids the need for third-party interactive backends to
register themselves into rcsetup.interactive_bk in order to be correctly
pause()able.
@anntzer
Copy link
Contributor Author

anntzer commented Aug 23, 2017

Rebased.

@anntzer
Copy link
Contributor Author

anntzer commented Sep 17, 2017

Marking this as release critical only on the basis of "it would be nice to have it for mpl_cairo (specifically not needing to register itself into interactive_bk), and it's already been approved once" -- so just hoping to catch another core dev's attention. Feel free to untag if you disagree.

@anntzer anntzer added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Sep 17, 2017
Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

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

Good simplification.

@efiring efiring merged commit 61714e7 into matplotlib:master Sep 18, 2017
@efiring
Copy link
Member

efiring commented Sep 18, 2017

I will leave this for @tacaswell to decide whether to backport for 2.1.

@anntzer anntzer deleted the eventloop branch September 18, 2017 01:15
tacaswell pushed a commit that referenced this pull request Sep 18, 2017
Remove start_event_loop_default.  Let pause() run the event loop for all backends.
@tacaswell
Copy link
Member

Backported to v2.1.x as 35af6c0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants