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

Skip to content

Commit a68d119

Browse files
committed
Remove draw_rubberband and minor cleanup
1 parent f28d31c commit a68d119

File tree

3 files changed

+17
-35
lines changed

3 files changed

+17
-35
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
import mock
99

1010
import matplotlib.widgets as widgets
11-
12-
import numpy as np
13-
import matplotlib
14-
from matplotlib.testing.decorators import image_comparison, cleanup
1511
import matplotlib.pyplot as plt
1612

1713

@@ -90,12 +86,12 @@ def onselect(epress, erelease):
9086

9187

9288
def test_rectangle_selector():
93-
check_rectangle()
94-
check_rectangle(drawtype='line', useblit=False)
95-
check_rectangle(useblit=True, button=1)
96-
check_rectangle(drawtype='none', minspanx=10, minspany=10)
97-
check_rectangle(minspanx=10, minspany=10, spancoords='pixels')
98-
check_rectangle(rectprops=dict(fill=True))
89+
check_rectangle()
90+
check_rectangle(drawtype='line', useblit=False)
91+
check_rectangle(useblit=True, button=1)
92+
check_rectangle(drawtype='none', minspanx=10, minspany=10)
93+
check_rectangle(minspanx=10, minspany=10, spancoords='pixels')
94+
check_rectangle(rectprops=dict(fill=True))
9995

10096

10197
def check_span(*args, **kwargs):
@@ -160,6 +156,6 @@ def onselect(verts):
160156

161157

162158
def test_lasso_selector():
163-
check_lasso_selector()
164-
check_lasso_selector(useblit=False, lineprops=dict(color='red'))
165-
check_lasso_selector(useblit=True, button=1)
159+
check_lasso_selector()
160+
check_lasso_selector(useblit=False, lineprops=dict(color='red'))
161+
check_lasso_selector(useblit=True, button=1)

lib/matplotlib/widgets.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,23 +1231,6 @@ def set_visible(self, visible):
12311231
for artist in self.artists:
12321232
artist.set_visible(visible)
12331233

1234-
def draw_rubberband(self, x0, x1, y0, y1):
1235-
"""Draw a box using the native toolkit given data coordinates
1236-
"""
1237-
height = self.canvas.figure.bbox.height
1238-
1239-
x0, y0 = self.ax.transData.transform([x0, y0])
1240-
x1, y1 = self.ax.transData.transform([x1, y1])
1241-
1242-
y1 = height - y1
1243-
y0 = height - y0
1244-
1245-
w = abs(x1 - x0)
1246-
h = abs(y1 - y0)
1247-
1248-
rect = [int(val)for val in (min(x0, x1), min(y0, y1), w, h)]
1249-
self.canvas.drawRectangle(rect)
1250-
12511234

12521235
class SpanSelector(_SelectorWidget):
12531236
"""
@@ -1304,7 +1287,8 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
13041287
2 = center mouse button (scroll wheel)
13051288
3 = right mouse button
13061289
"""
1307-
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit, button=button)
1290+
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit,
1291+
button=button)
13081292

13091293
if rectprops is None:
13101294
rectprops = dict(facecolor='red', alpha=0.5)
@@ -1528,7 +1512,8 @@ def __init__(self, ax, onselect, drawtype='box',
15281512
2 = center mouse button (scroll wheel)
15291513
3 = right mouse button
15301514
"""
1531-
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit, button=button)
1515+
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit,
1516+
button=button)
15321517

15331518
self.to_draw = None
15341519

setupext.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ def check_output(*popenargs, **kwargs):
4343
return output
4444

4545

46-
if sys.platform != 'win32':
46+
try:
4747
if sys.version_info[0] < 3:
4848
from commands import getstatusoutput
4949
else:
5050
from subprocess import getstatusoutput
51-
51+
except ImportError:
52+
pass
5253

5354
if PY3:
5455
import configparser
@@ -147,7 +148,7 @@ def get_base_dirs():
147148
return options['basedirlist']
148149

149150
basedir_map = {
150-
'win32': ['win32_static',],
151+
'win32': ['win32_static'],
151152
'darwin': ['/usr/local/', '/usr', '/usr/X11', '/opt/local'],
152153
'sunos5': [os.getenv('MPLIB_BASE') or '/usr/local',],
153154
'gnu0': ['/usr'],

0 commit comments

Comments
 (0)