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

Skip to content

Commit 34f6099

Browse files
committed
Remove deprecated backend methods.
1 parent c0324d8 commit 34f6099

File tree

5 files changed

+3
-118
lines changed

5 files changed

+3
-118
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 3 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import matplotlib.backends.windowing as windowing
1616

1717
import matplotlib
18-
from matplotlib import backend_tools, cbook, rcParams
18+
from matplotlib import backend_tools, rcParams
1919
from matplotlib.backend_bases import (
2020
_Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
2121
StatusbarBase, TimerBase, ToolContainerBase, cursors)
@@ -294,10 +294,6 @@ def _update_pointer_position(self, guiEvent=None):
294294
else:
295295
self.leave_notify_event(guiEvent)
296296

297-
show = cbook.deprecated("2.2", name="FigureCanvasTk.show",
298-
alternative="FigureCanvasTk.draw")(
299-
lambda self: self.draw())
300-
301297
def draw_idle(self):
302298
'update drawing area only if idle'
303299
if self._idle is False:
@@ -511,22 +507,8 @@ def _get_toolmanager(self):
511507
toolmanager = None
512508
return toolmanager
513509

514-
def resize(self, width, height=None):
515-
# before 09-12-22, the resize method takes a single *event*
516-
# parameter. On the other hand, the resize method of other
517-
# FigureManager class takes *width* and *height* parameter,
518-
# which is used to change the size of the window. For the
519-
# Figure.set_size_inches with forward=True work with Tk
520-
# backend, I changed the function signature but tried to keep
521-
# it backward compatible. -JJL
522-
523-
# when a single parameter is given, consider it as a event
524-
if height is None:
525-
cbook.warn_deprecated("2.2", "FigureManagerTkAgg.resize now takes "
526-
"width and height as separate arguments")
527-
width = width.width
528-
else:
529-
self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height))
510+
def resize(self, width, height):
511+
self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height))
530512

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

574556

575-
@cbook.deprecated("2.2")
576-
class AxisMenu(object):
577-
def __init__(self, master, naxes):
578-
self._master = master
579-
self._naxes = naxes
580-
self._mbar = Tk.Frame(master=master, relief=Tk.RAISED, borderwidth=2)
581-
self._mbar.pack(side=Tk.LEFT)
582-
self._mbutton = Tk.Menubutton(
583-
master=self._mbar, text="Axes", underline=0)
584-
self._mbutton.pack(side=Tk.LEFT, padx="2m")
585-
self._mbutton.menu = Tk.Menu(self._mbutton)
586-
self._mbutton.menu.add_command(
587-
label="Select All", command=self.select_all)
588-
self._mbutton.menu.add_command(
589-
label="Invert All", command=self.invert_all)
590-
self._axis_var = []
591-
self._checkbutton = []
592-
for i in range(naxes):
593-
self._axis_var.append(Tk.IntVar())
594-
self._axis_var[i].set(1)
595-
self._checkbutton.append(self._mbutton.menu.add_checkbutton(
596-
label = "Axis %d" % (i+1),
597-
variable=self._axis_var[i],
598-
command=self.set_active))
599-
self._mbutton.menu.invoke(self._mbutton.menu.index("Select All"))
600-
self._mbutton['menu'] = self._mbutton.menu
601-
self._mbar.tk_menuBar(self._mbutton)
602-
self.set_active()
603-
604-
def adjust(self, naxes):
605-
if self._naxes < naxes:
606-
for i in range(self._naxes, naxes):
607-
self._axis_var.append(Tk.IntVar())
608-
self._axis_var[i].set(1)
609-
self._checkbutton.append( self._mbutton.menu.add_checkbutton(
610-
label = "Axis %d" % (i+1),
611-
variable=self._axis_var[i],
612-
command=self.set_active))
613-
elif self._naxes > naxes:
614-
for i in range(self._naxes-1, naxes-1, -1):
615-
del self._axis_var[i]
616-
self._mbutton.menu.forget(self._checkbutton[i])
617-
del self._checkbutton[i]
618-
self._naxes = naxes
619-
self.set_active()
620-
621-
def get_indices(self):
622-
a = [i for i in range(len(self._axis_var)) if self._axis_var[i].get()]
623-
return a
624-
625-
def set_active(self):
626-
self._master.set_active(self.get_indices())
627-
628-
def invert_all(self):
629-
for a in self._axis_var:
630-
a.set(not a.get())
631-
self.set_active()
632-
633-
def select_all(self):
634-
for a in self._axis_var:
635-
a.set(1)
636-
self.set_active()
637-
638-
639557
class NavigationToolbar2Tk(NavigationToolbar2, Tk.Frame):
640558
"""
641559
Attributes

lib/matplotlib/backends/backend_agg.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ class RendererAgg(RendererBase):
6868
context instance that controls the colors/styles
6969
"""
7070

71-
@property
72-
@cbook.deprecated("2.2")
73-
def debug(self):
74-
return 1
75-
7671
# we want to cache the fonts at the class level so that when
7772
# multiple figures are created we can reuse them. This helps with
7873
# a bug on windows where the creation of too many figures leads to

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import ctypes
66

7-
from matplotlib import cbook
87
from matplotlib.transforms import Bbox
98

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

23-
@property
24-
@cbook.deprecated("2.1")
25-
def blitbox(self):
26-
return self._bbox_queue
27-
2822
def paintEvent(self, e):
2923
"""Copy the image from the Agg canvas to the qt.drawable.
3024
@@ -91,11 +85,6 @@ def print_figure(self, *args, **kwargs):
9185
self.draw()
9286

9387

94-
@cbook.deprecated("2.2")
95-
class FigureCanvasQTAggBase(FigureCanvasQTAgg):
96-
pass
97-
98-
9988
@_BackendQT5.export
10089
class _BackendQT5Agg(_BackendQT5):
10190
FigureCanvas = FigureCanvasQTAgg
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .. import cbook
21
from . import tkagg # Paint image to Tk photo blitter extension.
32
from .backend_agg import FigureCanvasAgg
43
from ._backend_tk import (
@@ -17,16 +16,6 @@ def blit(self, bbox=None):
1716
self._master.update_idletasks()
1817

1918

20-
@cbook.deprecated("2.2")
21-
class FigureManagerTkAgg(FigureManagerTk):
22-
pass
23-
24-
25-
@cbook.deprecated("2.2")
26-
class NavigationToolbar2TkAgg(NavigationToolbar2Tk):
27-
pass
28-
29-
3019
@_BackendTk.export
3120
class _BackendTkAgg(_BackendTk):
3221
FigureCanvas = FigureCanvasTkAgg

lib/matplotlib/backends/backend_wxagg.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import wx
77

88
import matplotlib
9-
from matplotlib import cbook
109
from . import wx_compat as wxc
1110
from .backend_agg import FigureCanvasAgg
1211
from .backend_wx import (
@@ -72,11 +71,6 @@ def blit(self, bbox=None):
7271
filetypes = FigureCanvasAgg.filetypes
7372

7473

75-
@cbook.deprecated("2.2", alternative="NavigationToolbar2WxAgg")
76-
class Toolbar(NavigationToolbar2WxAgg):
77-
pass
78-
79-
8074
# agg/wxPython image conversion functions (wxPython >= 2.8)
8175

8276
def _convert_agg_to_wx_image(agg, bbox):

0 commit comments

Comments
 (0)