Skip to content

Commit

Permalink
Deprecate NavigationToolbar2.dynamic_update.
Browse files Browse the repository at this point in the history
The method has been described as "legacy" in comments since 2005
(68eb00a).
  • Loading branch information
anntzer committed Jun 2, 2017
1 parent 75fde88 commit 7f0e27c
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 27 deletions.
4 changes: 4 additions & 0 deletions doc/api/api_changes/2017-05-31-AL_dynamic_update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NavigationToolbar2.dynamic_update is deprecated
```````````````````````````````````````````````

Use `FigureCanvas.draw_idle` instead.
8 changes: 3 additions & 5 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2711,9 +2711,6 @@ class NavigationToolbar2(object):
whenever a mouse button is released, you'll be notified with
the event
:meth:`dynamic_update` (optional)
dynamically update the window while navigating
:meth:`set_message` (optional)
display message
Expand Down Expand Up @@ -2778,8 +2775,9 @@ def back(self, *args):
self.set_history_buttons()
self._update_view()

@cbook.deprecated("2.1", alternative="canvas.draw_idle")
def dynamic_update(self):
pass
self.canvas.draw_idle()

def draw_rubberband(self, event, x0, y0, x1, y1):
"""Draw a rectangle rubberband to indicate zoom limits."""
Expand Down Expand Up @@ -3024,7 +3022,7 @@ def drag_pan(self, event):
#safer to use the recorded button at the press than current button:
#multiple button can get pressed during motion...
a.drag_pan(self._button_pressed, event.key, event.x, event.y)
self.dynamic_update()
self.canvas.draw_idle()

def drag_zoom(self, event):
"""Callback for dragging in zoom mode."""
Expand Down
4 changes: 0 additions & 4 deletions lib/matplotlib/backends/backend_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,6 @@ def release(self, event):
try: del self._pixmapBack
except AttributeError: pass

def dynamic_update(self):
# legacy method; new method is canvas.draw_idle
self.canvas.draw_idle()

def draw_rubberband(self, event, x0, y0, x1, y1):
'adapted from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/189744'
drawable = self.canvas.window
Expand Down
4 changes: 0 additions & 4 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,6 @@ def release(self, event):
try: del self._pixmapBack
except AttributeError: pass

def dynamic_update(self):
# legacy method; new method is canvas.draw_idle
self.canvas.draw_idle()

def draw_rubberband(self, event, x0, y0, x1, y1):
'adapted from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/189744'
self.ctx = self.canvas.get_property("window").cairo_create()
Expand Down
2 changes: 0 additions & 2 deletions lib/matplotlib/backends/backend_macosx.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ def prepare_configure_subplots(self):
def set_message(self, message):
_macosx.NavigationToolbar2.set_message(self, message.encode('utf-8'))

def dynamic_update(self):
self.canvas.draw_idle()

########################################################################
#
Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,6 @@ def zoom(self, *args):
super(NavigationToolbar2QT, self).zoom(*args)
self._update_buttons_checked()

def dynamic_update(self):
self.canvas.draw_idle()

def set_message(self, s):
self.message.emit(s)
if self.coordinates:
Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/backends/backend_tkagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,11 +859,6 @@ def update(self):
# self.omenu.adjust(naxes)
NavigationToolbar2.update(self)

def dynamic_update(self):
'update drawing area only if idle'
# legacy method; new method is canvas.draw_idle
self.canvas.draw_idle()


class ToolTip(object):
"""
Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/backends/backend_webagg_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,6 @@ def set_cursor(self, cursor):
self.canvas.send_event("cursor", cursor=cursor)
self.cursor = cursor

def dynamic_update(self):
self.canvas.draw_idle()

def draw_rubberband(self, event, x0, y0, x1, y1):
self.canvas.send_event(
"rubberband", x0=x0, y0=y0, x1=x1, y1=y1)
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from matplotlib.path import Path
from matplotlib.transforms import Affine2D
from matplotlib.widgets import SubplotTool
from matplotlib import rcParams
from matplotlib import cbook, rcParams

from . import wx_compat as wxc
import wx
Expand Down Expand Up @@ -1675,6 +1675,7 @@ def release(self, event):
except AttributeError:
pass

@cbook.deprecated("2.1", alternative="canvas.draw_idle")
def dynamic_update(self):
d = self._idle
self._idle = False
Expand Down

0 comments on commit 7f0e27c

Please sign in to comment.