-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Improved selection widget #3502
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
tacaswell
merged 18 commits into
matplotlib:master
from
blink1073:improved-selection-widget
Nov 13, 2014
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
61ab6df
Factor more behavior into the _SelectorWidget class.
blink1073 e43c788
Fix indentation
blink1073 ea732ef
Put onselect in __init__, fix syntax error, make sure lines are anima…
blink1073 900a6ea
Add tests for the selection widgets
blink1073 706b5b4
Remove private event handling methods to allow for subclassing old api
blink1073 ffd715a
Remove draw_rubberband and minor cleanup
blink1073 53b6056
Add to default_test_modules
blink1073 ddfcf59
Attempt to fix affine transform error
blink1073 76721c1
Fix affine transform error
blink1073 cf66812
Add test cleanup decorator
blink1073 babc377
Move cleanup to the individual checks
blink1073 cf58c0a
Fix failing tests
blink1073 f3261cf
Fix pep8 error
blink1073 c25efbd
Improve handling of out-of-bounds releases
blink1073 ce93c98
Revert changes to setupext.py
blink1073 51c70f0
Style change and use self.blit instead of blit.
blink1073 d711940
MNT : pep8 + pyflake changes
tacaswell 86f28fa
TST : ensure canvas drawn before testing widets
tacaswell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Put onselect in __init__, fix syntax error, make sure lines are anima…
…ted.
- Loading branch information
commit ea732ef0d1f48e8c2d49a483a6c6b3f73dd5fbab
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1101,6 +1101,7 @@ def __init__(self, ax, onselect, useblit=False, button=None): | |
AxesWidget.__init__(self, ax) | ||
|
||
self.visible = True | ||
self.onselect = onselect | ||
self.connect_default_events() | ||
|
||
self.background = None | ||
|
@@ -1130,7 +1131,7 @@ def update_background(self, event): | |
self.background = self.canvas.copy_from_bbox(self.ax.bbox) | ||
|
||
def connect_default_events(self): | ||
"""Connect the major canvas events to methods."""" | ||
"""Connect the major canvas events to methods.""" | ||
self.connect_event('motion_notify_event', self._onmove) | ||
self.connect_event('button_press_event', self._press) | ||
self.connect_event('button_release_event', self._release) | ||
|
@@ -1357,7 +1358,8 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False, | |
def new_axes(self, ax): | ||
self.ax = ax | ||
if self.canvas is not ax.figure.canvas: | ||
self.disconnect_events() | ||
if not self.canvas is None: | ||
self.disconnect_events() | ||
|
||
self.canvas = ax.figure.canvas | ||
self.connect_default_events() | ||
|
@@ -1572,6 +1574,8 @@ def __init__(self, ax, onselect, drawtype='box', | |
lineprops = dict(color='black', linestyle='-', | ||
linewidth=2, alpha=0.5) | ||
self.lineprops = lineprops | ||
if useblit: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should use |
||
self.lineprops['animated'] = True | ||
self.to_draw = Line2D([0, 0], [0, 0], visible=False, | ||
**self.lineprops) | ||
self.ax.add_line(self.to_draw) | ||
|
@@ -1705,6 +1709,8 @@ def __init__(self, ax, onselect=None, useblit=True, lineprops=None, | |
|
||
if lineprops is None: | ||
lineprops = dict() | ||
if useblit: | ||
lineprops['animated'] = True | ||
self.line = Line2D([], [], **lineprops) | ||
self.line.set_visible(False) | ||
self.ax.add_line(self.line) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flip this to
self.canvas is not None
please.