Skip to content

Commit b400edb

Browse files
committed
Merge pull request matplotlib#4594 from jenshnielsen/fixwx
Revert "WX Monkey patch ClientDC for name changes"
2 parents d58a2a5 + 60faeb6 commit b400edb

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ def gui_repaint(self, drawDC=None, origin='WX'):
832832
if self.IsShownOnScreen():
833833
if not drawDC:
834834
# not called from OnPaint use a ClientDC
835-
drawDC = wxc.ClientDC(self)
835+
drawDC = wx.ClientDC(self)
836836

837837
# ensure that canvas has no 'left' over stuff when resizing frame
838838
drawDC.Clear()
@@ -1688,7 +1688,7 @@ def release(self, event):
16881688
def draw_rubberband(self, event, x0, y0, x1, y1):
16891689
# Use an Overlay to draw a rubberband-like bounding box.
16901690

1691-
dc = wxc.ClientDC(self.canvas)
1691+
dc = wx.ClientDC(self.canvas)
16921692
odc = wx.DCOverlay(self.wxoverlay, dc)
16931693
odc.Clear()
16941694

@@ -1721,7 +1721,10 @@ def draw_rubberband(self, event, x0, y0, x1, y1):
17211721
r, g, b, a = color.Get(True)
17221722
color.Set(r, g, b, 0x60)
17231723
dc.SetBrush(wx.Brush(color))
1724-
dc.DrawRectangleRect(rect)
1724+
if wxc.is_phoenix:
1725+
dc.DrawRectangle(rect)
1726+
else:
1727+
dc.DrawRectangleRect(rect)
17251728

17261729
def set_status_bar(self, statbar):
17271730
self.statbar = statbar

lib/matplotlib/backends/wx_compat.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
print(" wxPython version %s was imported." % backend_version)
2929
raise ImportError(missingwx)
3030

31-
# Import ClientCD so we can Monkey patch it.
32-
ClientDC = wx.ClientDC
33-
3431
if is_phoenix:
3532
# define all the wxPython phoenix stuff
3633

@@ -86,8 +83,6 @@
8683
NamedColour = wx.Colour
8784
StockCursor = wx.Cursor
8885

89-
# Moneypatch ClientDC to for rename of DrawRectangleRect to DrawRectangle
90-
ClientDC.DrawRectangleRect = ClientDC.DrawRectangle
9186
else:
9287
# define all the wxPython classic stuff
9388

0 commit comments

Comments
 (0)