Skip to content

Commit f10bcee

Browse files
authored
Merge pull request matplotlib#16915 from anntzer/wx
Tighten/cleanup wx backend.
2 parents d809e01 + b7e77c4 commit f10bcee

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

doc/api/next_api_changes/deprecations.rst

+4
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,7 @@ The qt4agg and qt4cairo backends are deprecated.
398398

399399
*fontdict* and *minor* parameters of `.Axes.set_xticklabels` and `.Axes.set_yticklabels` will become keyword-only
400400
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401+
402+
``RendererWx.get_gc``
403+
~~~~~~~~~~~~~~~~~~~~~
404+
This method is deprecated. Access the ``gc`` attribute directly instead.

lib/matplotlib/backends/backend_wx.py

+8-15
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ def DEBUG_MSG(string, lvl=3, o=None):
5656

5757

5858
def error_msg_wx(msg, parent=None):
59-
"""
60-
Signal an error condition -- in a GUI, popup a error dialog
61-
"""
59+
"""Signal an error condition with a popup error dialog."""
6260
dialog = wx.MessageDialog(parent=parent,
6361
message=msg,
6462
caption='Matplotlib backend_wx error',
@@ -240,7 +238,6 @@ def draw_image(self, gc, x, y, im):
240238
h = self.height
241239
rows, cols = im.shape[:2]
242240
bitmap = wx.Bitmap.FromBufferRGBA(cols, rows, im.tostring())
243-
gc = self.get_gc()
244241
gc.select()
245242
gc.gfx_ctx.DrawBitmap(bitmap, int(l), int(self.height - b),
246243
int(w), int(-h))
@@ -282,6 +279,7 @@ def new_gc(self):
282279
self.gc.unselect()
283280
return self.gc
284281

282+
@cbook.deprecated("3.3", alternative=".gc")
285283
def get_gc(self):
286284
"""
287285
Fetch the locally cached gc.
@@ -417,7 +415,7 @@ def set_joinstyle(self, js):
417415
self.unselect()
418416

419417
def get_wxcolour(self, color):
420-
"""Convert the given RGB(A) color to a wx.Colour."""
418+
"""Convert a RGB(A) color to a wx.Colour."""
421419
_log.debug("%s - get_wx_color()", type(self))
422420
if len(color) == 3:
423421
r, g, b = color
@@ -914,14 +912,6 @@ def _print_image(self, filename, filetype, *args, **kwargs):
914912
self.Refresh()
915913

916914

917-
########################################################################
918-
#
919-
# The following functions and classes are for pylab compatibility
920-
# mode (matplotlib.pylab) and implement figure managers, etc...
921-
#
922-
########################################################################
923-
924-
925915
class FigureFrameWx(wx.Frame):
926916
def __init__(self, num, fig):
927917
# On non-Windows platform, explicitly set the position - fix
@@ -1047,7 +1037,6 @@ class FigureManagerWx(FigureManagerBase):
10471037
a FigureCanvasWx(wx.Panel) instance
10481038
window : wxFrame
10491039
a wxFrame instance - wxpython.org/Phoenix/docs/html/Frame.html
1050-
10511040
"""
10521041

10531042
def __init__(self, canvas, num, frame):
@@ -1060,26 +1049,30 @@ def __init__(self, canvas, num, frame):
10601049
self.toolbar = frame.GetToolBar()
10611050

10621051
def show(self):
1052+
# docstring inherited
10631053
self.frame.Show()
10641054
self.canvas.draw()
10651055
if mpl.rcParams['figure.raise_window']:
10661056
self.frame.Raise()
10671057

10681058
def destroy(self, *args):
1059+
# docstring inherited
10691060
_log.debug("%s - destroy()", type(self))
10701061
self.frame.Close()
10711062
wxapp = wx.GetApp()
10721063
if wxapp:
10731064
wxapp.Yield()
10741065

10751066
def get_window_title(self):
1067+
# docstring inherited
10761068
return self.window.GetTitle()
10771069

10781070
def set_window_title(self, title):
1071+
# docstring inherited
10791072
self.window.SetTitle(title)
10801073

10811074
def resize(self, width, height):
1082-
"""Set the canvas size in pixels."""
1075+
# docstring inherited
10831076
self.canvas.SetInitialSize(wx.Size(width, height))
10841077
self.window.GetSizer().Fit(self.window)
10851078

0 commit comments

Comments
 (0)