Skip to content

Commit

Permalink
Remove draw_rubberband and minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Oct 19, 2014
1 parent f28d31c commit a68d119
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 35 deletions.
22 changes: 9 additions & 13 deletions lib/matplotlib/tests/test_widgets.py
Expand Up @@ -8,10 +8,6 @@
import mock

import matplotlib.widgets as widgets

import numpy as np
import matplotlib
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt


Expand Down Expand Up @@ -90,12 +86,12 @@ def onselect(epress, erelease):


def test_rectangle_selector():
check_rectangle()
check_rectangle(drawtype='line', useblit=False)
check_rectangle(useblit=True, button=1)
check_rectangle(drawtype='none', minspanx=10, minspany=10)
check_rectangle(minspanx=10, minspany=10, spancoords='pixels')
check_rectangle(rectprops=dict(fill=True))
check_rectangle()
check_rectangle(drawtype='line', useblit=False)
check_rectangle(useblit=True, button=1)
check_rectangle(drawtype='none', minspanx=10, minspany=10)
check_rectangle(minspanx=10, minspany=10, spancoords='pixels')
check_rectangle(rectprops=dict(fill=True))


def check_span(*args, **kwargs):
Expand Down Expand Up @@ -160,6 +156,6 @@ def onselect(verts):


def test_lasso_selector():
check_lasso_selector()
check_lasso_selector(useblit=False, lineprops=dict(color='red'))
check_lasso_selector(useblit=True, button=1)
check_lasso_selector()
check_lasso_selector(useblit=False, lineprops=dict(color='red'))
check_lasso_selector(useblit=True, button=1)
23 changes: 4 additions & 19 deletions lib/matplotlib/widgets.py
Expand Up @@ -1231,23 +1231,6 @@ def set_visible(self, visible):
for artist in self.artists:
artist.set_visible(visible)

def draw_rubberband(self, x0, x1, y0, y1):
"""Draw a box using the native toolkit given data coordinates
"""
height = self.canvas.figure.bbox.height

x0, y0 = self.ax.transData.transform([x0, y0])
x1, y1 = self.ax.transData.transform([x1, y1])

y1 = height - y1
y0 = height - y0

w = abs(x1 - x0)
h = abs(y1 - y0)

rect = [int(val)for val in (min(x0, x1), min(y0, y1), w, h)]
self.canvas.drawRectangle(rect)


class SpanSelector(_SelectorWidget):
"""
Expand Down Expand Up @@ -1304,7 +1287,8 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
2 = center mouse button (scroll wheel)
3 = right mouse button
"""
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit, button=button)
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit,
button=button)

if rectprops is None:
rectprops = dict(facecolor='red', alpha=0.5)
Expand Down Expand Up @@ -1528,7 +1512,8 @@ def __init__(self, ax, onselect, drawtype='box',
2 = center mouse button (scroll wheel)
3 = right mouse button
"""
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit, button=button)
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit,
button=button)

self.to_draw = None

Expand Down
7 changes: 4 additions & 3 deletions setupext.py
Expand Up @@ -43,12 +43,13 @@ def check_output(*popenargs, **kwargs):
return output


if sys.platform != 'win32':
try:
if sys.version_info[0] < 3:
from commands import getstatusoutput
else:
from subprocess import getstatusoutput

except ImportError:
pass

if PY3:
import configparser
Expand Down Expand Up @@ -147,7 +148,7 @@ def get_base_dirs():
return options['basedirlist']

basedir_map = {
'win32': ['win32_static',],
'win32': ['win32_static'],
'darwin': ['/usr/local/', '/usr', '/usr/X11', '/opt/local'],
'sunos5': [os.getenv('MPLIB_BASE') or '/usr/local',],
'gnu0': ['/usr'],
Expand Down

0 comments on commit a68d119

Please sign in to comment.