8000 Merge pull request #4554 from jenshnielsen/nowxversion · matplotlib/matplotlib@091d27c · GitHub
[go: up one dir, main page]

Skip to content

Commit 091d27c

Browse files
committed
Merge pull request #4554 from jenshnielsen/nowxversion
A few WX phoenix related changes
2 parents f505cd0 + 752d738 commit 091d27c

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 3 additions & 3 deletions
< 10000 /tr>
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 = wx.ClientDC(self)
835+
drawDC = wxc.ClientDC(self)
836836

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

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

@@ -1713,7 +1713,7 @@ def draw_rubberband(self, event, x0, y0, x1, y1):
17131713
rubberBandColor = '#C0C0FF' # or load from config?
17141714

17151715
# Set a pen for the border
1716-
color = wx.NamedColour(rubberBandColor)
1716+
color = wxc.NamedColour(rubberBandColor)
17171717
dc.SetPen(wx.Pen(color, 1))
17181718

17191719
# use the same color, plus alpha for the brush

lib/matplotlib/backends/wx_compat.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
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+
3134
if is_phoenix:
3235
# define all the wxPython phoenix stuff
3336

@@ -83,6 +86,8 @@
8386
NamedColour = wx.Colour
8487
StockCursor = wx.Cursor
8588

89+
# Moneypatch ClientDC to for rename of DrawRectangleRect to DrawRectangle
90+
ClientDC.DrawRectangleRect = ClientDC.DrawRectangle
8691
else:
8792
# define all the wxPython classic stuff
8893

setupext.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,20 +1849,22 @@ class BackendWxAgg(OptionalBackendPackage):
18491849
name = "wxagg"
18501850

18511851
def check_requirements(self):
1852+
wxversioninstalled = True
18521853
try:
18531854
import wxversion
18541855
except ImportError:
1855-
raise CheckFailed("requires wxPython")
1856+
wxversioninstalled = False
18561857

1857-
try:
1858-
_wx_ensure_failed = wxversion.AlreadyImportedError
1859-
except AttributeError:
1860-
_wx_ensure_failed = wxversion.VersionError
1858+
if wxversioninstalled:
1859+
try:
1860+
_wx_ensure_failed = wxversion.AlreadyImportedError
1861+
except AttributeError:
1862+
_wx_ensure_failed = wxversion.VersionError
18611863

1862-
try:
1863-
wxversion.ensureMinimal('2.8')
1864-
except _wx_ensure_failed:
1865-
pass
1864+
try:
1865+
wxversion.ensureMinimal('2.8')
1866+
except _wx_ensure_failed:
1867+
pass
18661868

18671869
try:
18681870
import wx

0 commit comments

Comments
 (0)
0