diff --git a/doc/api/api_changes/2017-05-31-AL_dynamic_update.rst b/doc/api/api_changes/2017-05-31-AL_dynamic_update.rst new file mode 100644 index 000000000000..565a60a4cef7 --- /dev/null +++ b/doc/api/api_changes/2017-05-31-AL_dynamic_update.rst @@ -0,0 +1,4 @@ +NavigationToolbar2.dynamic_update is deprecated +``````````````````````````````````````````````` + +Use `FigureCanvas.draw_idle` instead. diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 3438210023f1..3cd6e34c73c1 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -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 @@ -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.""" @@ -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.""" diff --git a/lib/matplotlib/backends/backend_gtk.py b/lib/matplotlib/backends/backend_gtk.py index 02fc2a22b762..f9a2fa47edd0 100644 --- a/lib/matplotlib/backends/backend_gtk.py +++ b/lib/matplotlib/backends/backend_gtk.py @@ -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 diff --git a/lib/matplotlib/backends/backend_gtk3.py b/lib/matplotlib/backends/backend_gtk3.py index c4b007fdc97c..6a1f74a30c65 100644 --- a/lib/matplotlib/backends/backend_gtk3.py +++ b/lib/matplotlib/backends/backend_gtk3.py @@ -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() diff --git a/lib/matplotlib/backends/backend_macosx.py b/lib/matplotlib/backends/backend_macosx.py index d3ce00fa650d..e093e2799b8d 100644 --- a/lib/matplotlib/backends/backend_macosx.py +++ b/lib/matplotlib/backends/backend_macosx.py @@ -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() ######################################################################## # diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index d23bf13f7d76..9c3518ffc9e7 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -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: diff --git a/lib/matplotlib/backends/backend_tkagg.py b/lib/matplotlib/backends/backend_tkagg.py index cd2373bf4fe8..af0ed62f9d81 100644 --- a/lib/matplotlib/backends/backend_tkagg.py +++ b/lib/matplotlib/backends/backend_tkagg.py @@ -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): """ diff --git a/lib/matplotlib/backends/backend_webagg_core.py b/lib/matplotlib/backends/backend_webagg_core.py index 4c1b0a0f57cd..132361afc95f 100644 --- a/lib/matplotlib/backends/backend_webagg_core.py +++ b/lib/matplotlib/backends/backend_webagg_core.py @@ -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) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index bd9c281e715f..8746b9034cbd 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -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 @@ -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