Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rectangle Selector Upgrade #3937

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 48 commits into from
Sep 8, 2015
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2ed0d49
Store prev event to handle out of bounds selections
blink1073 Dec 19, 2014
f8eefe6
Upgrade RectangleSelector with ToolHandles and add Ellipse
blink1073 Dec 19, 2014
7f044cf
Add toolhandles class
blink1073 Dec 19, 2014
f450df6
Add test using tool handles
blink1073 Dec 19, 2014
79294e0
Add a helper function to get axes
blink1073 Dec 19, 2014
fd264a2
Do not allow extents outside the image and add a path property
blink1073 Dec 19, 2014
438715f
Finish rectangle handle tests and add ellipse test with key modifiers
blink1073 Dec 19, 2014
e560713
Rename path property to geometry and return consistent results.
blink1073 Dec 20, 2014
5025ba2
Add geometry tests.
blink1073 Dec 20, 2014
b118294
Remove extra line.
blink1073 Dec 20, 2014
b15cf12
Refactor the event handling methods
blink1073 Dec 20, 2014
e96fe81
Update rectangle logic to include '_moving'
blink1073 Dec 20, 2014
240cfa2
Clean up event handling and add a state attribute
blink1073 Dec 20, 2014
7915db8
Add state handling to onmove
blink1073 Dec 20, 2014
f7a9222
More "state" refactoring
blink1073 Dec 20, 2014
7c04e25
Add key release and continue refactoring state handling
blink1073 Dec 20, 2014
cf491db
Recreate the _get_data method and more event refactoring
blink1073 Dec 20, 2014
7ece2fa
Refactor the event creator to call the private methods
blink1073 Dec 20, 2014
59ccd81
Preserve existing api for event handler functions
blink1073 Dec 21, 2014
a033e8e
Preserve event return values
blink1073 Dec 24, 2014
2923f97
Add cleanup to tests and fix default rect prop
blink1073 Dec 24, 2014
6549538
Pep8 fixes
blink1073 Dec 24, 2014
491276e
Fix bug in SpanSelector when blit=True
blink1073 Jan 17, 2015
744308c
Clear events after valid release
blink1073 Jan 18, 2015
a7518b3
Do not attempt to draw artists if ax is invisible
blink1073 Jan 18, 2015
77dc52b
Ignore events when axes are invisible
blink1073 Jan 18, 2015
48ebf30
Fix span selector onmove when we exit axes
blink1073 Feb 21, 2015
3ffd7c0
Restore previous behaviour and allow escape to clear the current sele…
blink1073 Aug 19, 2015
e802991
Fix failing tests
blink1073 Aug 19, 2015
af6e1b4
Fix handling of center handle
blink1073 Aug 20, 2015
f5666a4
Remove debug print
blink1073 Aug 20, 2015
545a727
STY: PEP8
tacaswell Aug 22, 2015
feb58fe
FIX: do not call draw_idle if blitting
tacaswell Aug 22, 2015
7bd67d2
DOC: make rectangle demo use handles
tacaswell Aug 22, 2015
b60a84d
Add docstring for EllipseSelector and use print() statements
blink1073 Aug 22, 2015
840a671
Revert to old draw types and add docs about key modifiers
blink1073 Aug 23, 2015
2a11f5f
Revert change to the example
blink1073 Aug 23, 2015
8da7985
Remove extra draw_idle trigger
blink1073 Aug 23, 2015
cfe4df1
Update the docstring
blink1073 Aug 23, 2015
bc225b6
Remove extraneous doc
blink1073 Aug 23, 2015
59145af
Fix failing test
blink1073 Aug 23, 2015
d491ac9
Update docstring, use self.useblit, use space for move
blink1073 Aug 25, 2015
8e8e473
Use new state_modifier_keys dictionary
blink1073 Aug 26, 2015
2ed0419
Clear the active handle when invisible
blink1073 Aug 26, 2015
d5b5d86
Collapse the shape on improper draw to prevent showing the previous s…
blink1073 Aug 26, 2015
87ab199
Fix test using 'alt' key
blink1073 Aug 26, 2015
9eaae32
Clean up and add more docs
blink1073 Sep 1, 2015
819804f
Make on_key_release use the state_modifier_keys
blink1073 Sep 1, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Preserve event return values
  • Loading branch information
blink1073 committed Aug 22, 2015
commit a033e8e078c07030eba63ea2e9ee22a1e4080503
6 changes: 6 additions & 0 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,8 @@ def press(self, event):
if 'alt' in key or key == ' ':
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for allowing two keys here? I'd just pick the space character and go with it.

Tangentially, I am not a fan of these hard-coded special keys. While they are fine as defaults, an application developer may already have these keys mapped to something and would want something different. So, it might be a good idea to have them able to be defined in the constructor.

Copy link
Member Author

Choose a reason for hiding this comment

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

I had originally used Alt, since it is used by Gimp, but it did not work on Windows IIRC. I'll add these to the constructor.

Copy link
Member

Choose a reason for hiding this comment

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

In my Gnome desktop, Alt and holding down the mouse button will result in moving the entire figure window.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we'll default to space.

self.state.add('move')
self._press(event)
return True
return False

def _press(self, event):
"""Button press handler"""
Expand All @@ -1280,6 +1282,8 @@ def release(self, event):
self.eventrelease = event
self._release(event)
self.state.discard('move')
return True
return False

def _release(self, event):
"""Button release event handler"""
Expand All @@ -1290,6 +1294,8 @@ def onmove(self, event):
if not self.ignore(event) and self.eventpress:
event = self._clean_event(event)
self._onmove(event)
return True
return False

def _onmove(self, event):
"""Cursor move event handler"""
Expand Down