Fix private n matplotib function import
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Wed, 10 May 2023 17:00:04 +0200
changeset 3798 e0117f4b0ff1
parent 3797 836eb9aa4c49
child 3799 2b995a4963a4
Fix private n matplotib function import
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
controls/DebugVariablePanel/DebugVariableViewer.py
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Wed May 10 16:58:15 2023 +0200
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Wed May 10 17:00:04 2023 +0200
@@ -31,7 +31,6 @@
 import matplotlib
 import matplotlib.pyplot
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
-from matplotlib.backends.backend_wxagg import _convert_agg_to_wx_bitmap
 from matplotlib.backends.backend_agg import FigureCanvasAgg
 from mpl_toolkits.mplot3d import Axes3D
 
@@ -1360,7 +1359,9 @@
         FigureCanvasAgg.draw(self)
 
         # Get bitmap of figure rendered
-        self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
+        agg_bitmap = self.get_renderer()
+        self.bitmap = wx.Bitmap.FromBufferRGBA(int(agg_bitmap.width), int(agg_bitmap.height),
+                                        agg_bitmap.buffer_rgba())
 
         # Create DC for rendering graphics in bitmap
         destDC = wx.MemoryDC()
--- a/controls/DebugVariablePanel/DebugVariableViewer.py	Wed May 10 16:58:15 2023 +0200
+++ b/controls/DebugVariablePanel/DebugVariableViewer.py	Wed May 10 17:00:04 2023 +0200
@@ -29,7 +29,6 @@
 from functools import reduce
 
 import wx
-from matplotlib.backends.backend_wxagg import _convert_agg_to_wx_bitmap
 
 from dialogs.ForceVariableDialog import ForceVariableDialog
 
@@ -303,8 +302,10 @@
                 srcX = srcBBox.x - (srcPos.x if destBBox.x == 0 else 0)
                 srcY = srcBBox.y - (srcPos.y if destBBox.y == 0 else 0)
 
-                srcBmp = _convert_agg_to_wx_bitmap(
-                    srcPanel.get_renderer(), None)
+                agg_bitmap = srcPanel.get_renderer()
+                srcBmp = wx.Bitmap.FromBufferRGBA(int(agg_bitmap.width), int(agg_bitmap.height),
+                                        agg_bitmap.buffer_rgba())
+
                 srcDC = wx.MemoryDC()
                 srcDC.SelectObject(srcBmp)