Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Move widget.{get,set}_active to AxisWidget.
The method was previously defined only for RectangleSelectors (#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
commit 13ce60928bccbac64a4e42a405a0cc8643c03556
22 changes: 10 additions & 12 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
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