Skip to content

Commit

Permalink
Remove deprecated backend methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Mar 4, 2018
1 parent c0324d8 commit 34f6099
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 118 deletions.
88 changes: 3 additions & 85 deletions lib/matplotlib/backends/_backend_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import matplotlib.backends.windowing as windowing

import matplotlib
from matplotlib import backend_tools, cbook, rcParams
from matplotlib import backend_tools, rcParams
from matplotlib.backend_bases import (
_Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
StatusbarBase, TimerBase, ToolContainerBase, cursors)
Expand Down Expand Up @@ -294,10 +294,6 @@ def _update_pointer_position(self, guiEvent=None):
else:
self.leave_notify_event(guiEvent)

show = cbook.deprecated("2.2", name="FigureCanvasTk.show",
alternative="FigureCanvasTk.draw")(
lambda self: self.draw())

def draw_idle(self):
'update drawing area only if idle'
if self._idle is False:
Expand Down Expand Up @@ -511,22 +507,8 @@ def _get_toolmanager(self):
toolmanager = None
return toolmanager

def resize(self, width, height=None):
# before 09-12-22, the resize method takes a single *event*
# parameter. On the other hand, the resize method of other
# FigureManager class takes *width* and *height* parameter,
# which is used to change the size of the window. For the
# Figure.set_size_inches with forward=True work with Tk
# backend, I changed the function signature but tried to keep
# it backward compatible. -JJL

# when a single parameter is given, consider it as a event
if height is None:
cbook.warn_deprecated("2.2", "FigureManagerTkAgg.resize now takes "
"width and height as separate arguments")
width = width.width
else:
self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height))
def resize(self, width, height):
self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height))

if self.toolbar is not None:
self.toolbar.configure(width=width)
Expand Down Expand Up @@ -572,70 +554,6 @@ def full_screen_toggle(self):
self.window.attributes('-fullscreen', not is_fullscreen)


@cbook.deprecated("2.2")
class AxisMenu(object):
def __init__(self, master, naxes):
self._master = master
self._naxes = naxes
self._mbar = Tk.Frame(master=master, relief=Tk.RAISED, borderwidth=2)
self._mbar.pack(side=Tk.LEFT)
self._mbutton = Tk.Menubutton(
master=self._mbar, text="Axes", underline=0)
self._mbutton.pack(side=Tk.LEFT, padx="2m")
self._mbutton.menu = Tk.Menu(self._mbutton)
self._mbutton.menu.add_command(
label="Select All", command=self.select_all)
self._mbutton.menu.add_command(
label="Invert All", command=self.invert_all)
self._axis_var = []
self._checkbutton = []
for i in range(naxes):
self._axis_var.append(Tk.IntVar())
self._axis_var[i].set(1)
self._checkbutton.append(self._mbutton.menu.add_checkbutton(
label = "Axis %d" % (i+1),
variable=self._axis_var[i],
command=self.set_active))
self._mbutton.menu.invoke(self._mbutton.menu.index("Select All"))
self._mbutton['menu'] = self._mbutton.menu
self._mbar.tk_menuBar(self._mbutton)
self.set_active()

def adjust(self, naxes):
if self._naxes < naxes:
for i in range(self._naxes, naxes):
self._axis_var.append(Tk.IntVar())
self._axis_var[i].set(1)
self._checkbutton.append( self._mbutton.menu.add_checkbutton(
label = "Axis %d" % (i+1),
variable=self._axis_var[i],
command=self.set_active))
elif self._naxes > naxes:
for i in range(self._naxes-1, naxes-1, -1):
del self._axis_var[i]
self._mbutton.menu.forget(self._checkbutton[i])
del self._checkbutton[i]
self._naxes = naxes
self.set_active()

def get_indices(self):
a = [i for i in range(len(self._axis_var)) if self._axis_var[i].get()]
return a

def set_active(self):
self._master.set_active(self.get_indices())

def invert_all(self):
for a in self._axis_var:
a.set(not a.get())
self.set_active()

def select_all(self):
for a in self._axis_var:
a.set(1)
self.set_active()


class NavigationToolbar2Tk(NavigationToolbar2, Tk.Frame):
"""
Attributes
Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ class RendererAgg(RendererBase):
context instance that controls the colors/styles
"""

@property
@cbook.deprecated("2.2")
def debug(self):
return 1

# we want to cache the fonts at the class level so that when
# multiple figures are created we can reuse them. This helps with
# a bug on windows where the creation of too many figures leads to
Expand Down
11 changes: 0 additions & 11 deletions lib/matplotlib/backends/backend_qt5agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import ctypes

from matplotlib import cbook
from matplotlib.transforms import Bbox

from .backend_agg import FigureCanvasAgg
Expand All @@ -20,11 +19,6 @@ def __init__(self, figure):
super().__init__(figure=figure)
self._bbox_queue = []

@property
@cbook.deprecated("2.1")
def blitbox(self):
return self._bbox_queue

def paintEvent(self, e):
"""Copy the image from the Agg canvas to the qt.drawable.
Expand Down Expand Up @@ -91,11 +85,6 @@ def print_figure(self, *args, **kwargs):
self.draw()


@cbook.deprecated("2.2")
class FigureCanvasQTAggBase(FigureCanvasQTAgg):
pass


@_BackendQT5.export
class _BackendQT5Agg(_BackendQT5):
FigureCanvas = FigureCanvasQTAgg
11 changes: 0 additions & 11 deletions lib/matplotlib/backends/backend_tkagg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .. import cbook
from . import tkagg # Paint image to Tk photo blitter extension.
from .backend_agg import FigureCanvasAgg
from ._backend_tk import (
Expand All @@ -17,16 +16,6 @@ def blit(self, bbox=None):
self._master.update_idletasks()


@cbook.deprecated("2.2")
class FigureManagerTkAgg(FigureManagerTk):
pass


@cbook.deprecated("2.2")
class NavigationToolbar2TkAgg(NavigationToolbar2Tk):
pass


@_BackendTk.export
class _BackendTkAgg(_BackendTk):
FigureCanvas = FigureCanvasTkAgg
6 changes: 0 additions & 6 deletions lib/matplotlib/backends/backend_wxagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import wx

import matplotlib
from matplotlib import cbook
from . import wx_compat as wxc
from .backend_agg import FigureCanvasAgg
from .backend_wx import (
Expand Down Expand Up @@ -72,11 +71,6 @@ def blit(self, bbox=None):
filetypes = FigureCanvasAgg.filetypes


@cbook.deprecated("2.2", alternative="NavigationToolbar2WxAgg")
class Toolbar(NavigationToolbar2WxAgg):
pass


# agg/wxPython image conversion functions (wxPython >= 2.8)

def _convert_agg_to_wx_image(agg, bbox):
Expand Down

0 comments on commit 34f6099

Please sign in to comment.