Skip to content

Commit

Permalink
Move widget.{get,set}_active to AxisWidget.
Browse files Browse the repository at this point in the history
The method was previously defined only for RectangleSelectors (matplotlib#3375).

Also, an redundant line was removed (RectangleSelectors are already set
active on __init__ by the superclass).
  • Loading branch information
anntzer committed Aug 17, 2014
1 parent b1ebb3c commit 13ce609
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/matplotlib/widgets.py
Expand Up @@ -111,6 +111,16 @@ def disconnect_events(self):
for c in self.cids:
self.canvas.mpl_disconnect(c)

def set_active(self, active):
"""Set whether the widget is active.
"""
self.active = active

def get_active(self):
"""Get whether the widget is active.
"""
return self.active

def ignore(self, event):
"""Return True if event should be ignored.
Expand Down Expand Up @@ -1393,7 +1403,6 @@ def __init__(self, ax, onselect, drawtype='box',
self.connect_event('button_release_event', self.release)
self.connect_event('draw_event', self.update_background)

self.active = True # for activation / deactivation
self.to_draw = None
self.background = None

Expand Down Expand Up @@ -1575,17 +1584,6 @@ def onmove(self, event):
self.update()
return False

def set_active(self, active):
"""
Use this to activate / deactivate the RectangleSelector
from your program with an boolean parameter *active*.
"""
self.active = active

def get_active(self):
""" Get status of active mode (boolean variable)"""
return self.active


class LassoSelector(AxesWidget):
"""Selection curve of an arbitrary shape.
Expand Down

0 comments on commit 13ce609

Please sign in to comment.