Improved selection widget#3502
Conversation
|
@tacaswell, @fariza, here we go... |
|
@blink1073 Just for future reference |
|
I removed |
|
@blink1073 This needs (at minimum) a re-base. |
8e94df1 to
a68d119
Compare
|
Rebase complete. |
There was a problem hiding this comment.
Ha, I had already written these tests for scikit-image, but yes, it was a pain...
There was a problem hiding this comment.
You need to white-list this file to be run in
matplotlib/lib/matplotlib/__init__.py
Line 1397 in c600130
|
Some tests are failing on Travis |
ae3a08e to
bdc8800
Compare
|
I'm at a bit of a loss here. I tested on both Python 2.7 and 3.4 with Ubuntu 14.04 64bit. The build is not only failing two of my tests but some outside of the reach of this PR as well: |
There was a problem hiding this comment.
Add a @cleanup (from matplotlib.testing.decorators) to this. I suspect that the other failing tests are due the artists form this test leaking out.
|
I can reproduce the failures locally running the tests like they are run on travis: I get (slightly different) failures if I run just the widget tests via nosetest: |
|
Funny, now that I added the |
lib/matplotlib/widgets.py
Outdated
There was a problem hiding this comment.
This smells like something that is going to introduce race-condition/transient bugs if more than one callback is using the same event.
There was a problem hiding this comment.
Should events have a lock attribute perhaps? Then you could use with event.lock():.
There was a problem hiding this comment.
I found the right solution: use a utility method to calculate the bounds as needed, and use a copy of the events for the onselect callback.
|
Passing all tests now. |
|
Catching |
|
Sure, but I have no idea what the error means or what to do about it... |
|
@blink1073 See PR against your branch. |
|
@tacaswell, I am offended and pleased by your GIF. |
|
Why offended? |
- strip white space - rearrange 'not's
Widgets assume that the canvas has been drawn atleast once before they are called (which is reasonable for interactive usage as the user needs to be able to _see_ the gui before they can interact with it). Ensure that the tests draw the canvas before trying to use the widgets. Doing this allows for removing some of the error handling logic from the widgets.
dfcb0b7 to
86f28fa
Compare
|
@tacaswell, assuming I didn't dork up the rebase, this should be good to go. |
|
@tacaswell, it looks like the build failed due to some unrelated network problems, do you want to restart it? |
ENH : selection widget refactor
|
What's next, the new RectangleSelector? |
|
If by new you mean moving over what you have in skimage, then yes! On Wed Nov 12 2014 at 8:08:47 PM Steven Silvester notifications@github.com
|

This is in preparation for enhancing the selection widgets as per #3486.
This expands the new
_Selectorclass from #3376 and normalizes the API for the three current selection widgets:RectangleSelector,LassoSelector, andSpanSelector.The only known API change is that the ignore criteria from the
RectangleSelectorare now used for all three, since they were the most complete and robust.This also adds tests for all three widgets.