8000 Allow disabling specific mouse actions in blocking_input by anntzer · Pull Request #12199 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Allow disabling specific mouse actions in blocking_input #12199

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 2 commits into from
Sep 23, 2018

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Sep 21, 2018

This is #11661 taking into account @timhoffm's comment and fixing the docs. Thanks to @saksmito for the PR.

ginput doesn´t allow to disable buttons.
With this change you can assign an invalid button to the three mouse buttons and leave the left click empty to zoom or pan.

Updated the documentation associated with ginput, regarding the changes applied to blocking_input to allow for pan and zoom

(PR cleanup by the committer.)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.1 milestone Sep 21, 2018
ginput doesn´t allow to disable buttons.
With this change you can assign an invalid button to the three mouse buttons and leave the left click empty to zoom or pan.

Updated the documentation associated with ginput, regarding the changes applied to blocking_input to allow for pan and zoom

(PR cleanup by the committer.)
@anntzer anntzer force-pushed the blocking-input-button-add branch from 98767df to 7c24848 Compare September 21, 2018 12:06
points, terminating the inputs) can be overridden via the arguments
*mouse_add*, *mouse_pop* and *mouse_stop*, that set the associated
mouse button: 1 for left, 2 for middle, 3 for right. Using a different
value (e.g. None) disables the corresponding mouse action.
Copy link
Member

Choose a reason for hiding this comment

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

We should be stricter about the guaranteed behavior: "Passing None disables the corresponding mouse action."

Other values should have undefined behavior, or better be rejected with a ValueError. I could for example imagine that we allow 'left', 'middle', 'right' instead of 1, 2, 3 in the future, which would be a more readable API. That would be a breaking API change with the above laissez-faire definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather not change the behavior in this PR (other than the check for botton_add which is clearly correct). Feel free to push changes to the docstring as you see fit.

Copy link
Member

Choose a reason for hiding this comment

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

Ok. I've updated the docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks good to me

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.

I approve the code change, but since I modified the docs, I won't merge this myself.

- Remove the most recently added point.
- Stop the interaction and return the points added so far.

The actions are assigned to mouse buttons via the the arguments
Copy link
Member

Choose a reason for hiding this comment

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

Two 'the's.

@timhoffm timhoffm force-pushed the blocking-input-button-add branch from f07b7cb to 5f29877 Compare September 23, 2018 07:52
@dopplershift dopplershift merged commit d6519f0 into matplotlib:master Sep 23, 2018
@dopplershift dopplershift mentioned this pull request Sep 23, 2018
6 tasks
@anntzer anntzer deleted the blocking-input-button-add branch September 23, 2018 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0