Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e7601e0

Browse filesBrowse files
authored
Merge pull request #18680 from anntzer/wxapi
wx backend API cleanups.
2 parents caaf3b7 + 591f92a commit e7601e0
Copy full SHA for e7601e0

File tree

Expand file treeCollapse file tree

4 files changed

+14
-3
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+14
-3
lines changed
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
wx backend cleanups
2+
~~~~~~~~~~~~~~~~~~~
3+
The *origin* parameter to ``_FigureCanvasWxBase.gui_repaint`` is deprecated
4+
with no replacement; ``gui_repaint`` now automatically detects the case where
5+
it is used with the wx renderer.
6+
7+
The ``NavigationToolbar2Wx.get_canvas`` method is deprecated; directly
8+
instantiate a canvas (``FigureCanvasWxAgg(frame, -1, figure)``) if needed.

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ def _get_imagesave_wildcards(self):
599599
wildcards = '|'.join(wildcards)
600600
return wildcards, extensions, filter_index
601601

602+
@cbook._delete_parameter("3.4", "origin")
602603
def gui_repaint(self, drawDC=None, origin='WX'):
603604
"""
604605
Performs update of the displayed image on the GUI canvas, using the
@@ -616,7 +617,8 @@ def gui_repaint(self, drawDC=None, origin='WX'):
616617
# For 'WX' backend on Windows, the bitmap can not be in use by another
617618
# DC (see GraphicsContextWx._cache).
618619
bmp = (self.bitmap.ConvertToImage().ConvertToBitmap()
619-
if wx.Platform == '__WXMSW__' and origin == 'WX'
620+
if wx.Platform == '__WXMSW__'
621+
and isinstance(self.figure._cachedRenderer, RendererWx)
620622
else self.bitmap)
621623
drawDC.DrawBitmap(bmp, 0, 0)
622624
if self._rubberband_rect is not None:
@@ -1158,6 +1160,7 @@ def _icon(name):
11581160
return wx.Bitmap.FromBufferRGBA(
11591161
image.shape[1], image.shape[0], image.tobytes())
11601162

1163+
@cbook.deprecated("3.4")
11611164
def get_canvas(self, frame, fig):
11621165
return type(self.canvas)(frame, -1, fig)
11631166

‎lib/matplotlib/backends/backend_wxagg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wxagg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def draw(self, drawDC=None):
3030

3131
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
3232
self._isDrawn = True
33-
self.gui_repaint(drawDC=drawDC, origin='WXAgg')
33+
self.gui_repaint(drawDC=drawDC)
3434

3535
def blit(self, bbox=None):
3636
# docstring inherited

‎lib/matplotlib/backends/backend_wxcairo.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wxcairo.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def draw(self, drawDC=None):
3838
self.figure.draw(self._renderer)
3939
self.bitmap = wxcairo.BitmapFromImageSurface(surface)
4040
self._isDrawn = True
41-
self.gui_repaint(drawDC=drawDC, origin='WXCairo')
41+
self.gui_repaint(drawDC=drawDC)
4242

4343

4444
@_BackendWx.export

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.