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

Skip to content

Commit d123ebf

Browse files
committed
Deprecate SpanSelector.prev attribute
1 parent 9b98eec commit d123ebf

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

doc/api/next_api_changes/deprecations/20113-EP.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SpanSelector
44
Several `~matplotlib.widgets.SpanSelector` class internals have been privatized
55
and deprecated:
66
- ``pressv``
7+
- ``prev``
78
- ``rect``
89
- ``rectprops``
910
- ``active_handle``

lib/matplotlib/widgets.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,9 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
20272027
if self._interactive:
20282028
self.artists.extend([line for line in self._edge_handles.artists])
20292029

2030+
# prev attritube is deprecated but we still need to maintain it
2031+
self._prev = (0, 0)
2032+
20302033
rect = _api.deprecate_privatize_attribute("3.5")
20312034

20322035
rectprops = _api.deprecate_privatize_attribute("3.5")
@@ -2039,6 +2042,8 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
20392042
property(lambda self: self._interactive)
20402043
)
20412044

2045+
prev = _api.deprecated("3.5")(property(lambda self: self._prev))
2046+
20422047
def new_axes(self, ax):
20432048
"""Set SpanSelector to operate on a new Axes."""
20442049
self.ax = ax
@@ -2075,8 +2080,10 @@ def _press(self, event):
20752080
self.update()
20762081

20772082
v = event.xdata if self.direction == 'horizontal' else event.ydata
2078-
# self._pressv is deprecated but we still need to maintain it
2083+
# self._pressv and self._prev are deprecated but we still need to
2084+
# maintain them
20792085
self._pressv = v
2086+
self._prev = self._get_data(event)
20802087

20812088
if self._active_handle is None:
20822089
# when the press event outside the span, we initially set the
@@ -2120,6 +2127,9 @@ def _release(self, event):
21202127
def _onmove(self, event):
21212128
"""Motion notify event handler."""
21222129

2130+
# self._prev are deprecated but we still need to maintain it
2131+
self._prev = self._get_data(event)
2132+
21232133
v = event.xdata if self.direction == 'horizontal' else event.ydata
21242134
if self.direction == 'horizontal':
21252135
vpress = self.eventpress.xdata

0 commit comments

Comments
 (0)