Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47729ee

Browse files
committed
Stop checking wx version.
mpl3 wx supports any wxpython that does support Py3 (i.e., wwpython>=4), so we can drop the version checks.
1 parent 8184e1f commit 47729ee

File tree

5 files changed

+19
-70
lines changed

5 files changed

+19
-70
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ install:
153153
python -c 'import PyQt5.QtCore' &&
154154
echo 'PyQt5 is available' ||
155155
echo 'PyQt5 is not available'
156-
python -mpip install -U --pre \
156+
python -mpip install -U \
157157
--no-index -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 \
158158
wxPython &&
159159
python -c 'import wx' &&

doc/sphinxext/mock_gui_toolkits.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,12 @@ class ToolBar(object):
118118
class Frame(object):
119119
pass
120120

121-
VERSION_STRING = '2.9'
122-
123121

124122
def setup(app):
125-
sys.modules['cairocffi'] = MyCairoCffi()
126-
sys.modules['PyQt4'] = MyPyQt4()
127-
sys.modules['sip'] = MySip()
128-
sys.modules['wx'] = MyWX()
129-
sys.modules['wxversion'] = MagicMock()
130-
131-
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
132-
return metadata
123+
sys.modules.update(
124+
cairocffi=MyCairoCffi(),
125+
PyQt4=MyPyQt4(),
126+
sip=MySip(),
127+
wx=MyWX(),
128+
)
129+
return {'parallel_read_safe': True, 'parallel_write_safe': True}

lib/matplotlib/backends/wx_compat.py

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,12 @@
1111
unicode_literals)
1212

1313
import six
14-
from distutils.version import StrictVersion, LooseVersion
1514

16-
missingwx = "Matplotlib backend_wx and backend_wxagg require wxPython>=2.9"
15+
import wx
16+
backend_version = wx.VERSION_STRING
17+
is_phoenix = 'phoenix' in wx.PlatformInfo
1718

1819

19-
try:
20-
import wx
21-
backend_version = wx.VERSION_STRING
22-
is_phoenix = 'phoenix' in wx.PlatformInfo
23-
except ImportError:
24-
raise ImportError(missingwx)
25-
26-
try:
27-
wx_version = StrictVersion(wx.VERSION_STRING)
28-
except ValueError:
29-
wx_version = LooseVersion(wx.VERSION_STRING)
30-
31-
# Ensure we have the correct version imported
32-
if wx_version < str("2.9"):
33-
raise ImportError(missingwx)
34-
3520
if is_phoenix:
3621
# define all the wxPython phoenix stuff
3722

@@ -157,22 +142,11 @@ def _AddTool(parent, wx_ids, text, bmp, tooltip_text):
157142
else:
158143
add_tool = parent.DoAddTool
159144

160-
if not is_phoenix or wx_version >= str("4.0.0b2"):
161-
# NOTE: when support for Phoenix prior to 4.0.0b2 is dropped then
162-
# all that is needed is this clause, and the if and else clause can
163-
# be removed.
164-
kwargs = dict(label=text,
165-
bitmap=bmp,
166-
bmpDisabled=wx.NullBitmap,
167-
shortHelp=text,
168-
longHelp=tooltip_text,
169-
kind=kind)
170-
else:
171-
kwargs = dict(label=text,
172-
bitmap=bmp,
173-
bmpDisabled=wx.NullBitmap,
174-
shortHelpString=text,
175-
longHelpString=tooltip_text,
176-
kind=kind)
145+
kwargs = dict(label=text,
146+
bitmap=bmp,
147+
bmpDisabled=wx.NullBitmap,
148+
shortHelp=text,
149+
longHelp=tooltip_text,
150+
kind=kind)
177151

178152
return add_tool(wx_ids[text], **kwargs)

setupext.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,33 +1567,12 @@ class BackendWxAgg(OptionalBackendPackage):
15671567
name = "wxagg"
15681568

15691569
def check_requirements(self):
1570-
wxversioninstalled = True
1571-
try:
1572-
import wxversion
1573-
except ImportError:
1574-
wxversioninstalled = False
1575-
1576-
if wxversioninstalled:
1577-
try:
1578-
_wx_ensure_failed = wxversion.AlreadyImportedError
1579-
except AttributeError:
1580-
_wx_ensure_failed = wxversion.VersionError
1581-
1582-
try:
1583-
wxversion.ensureMinimal('2.9')
1584-
except _wx_ensure_failed:
1585-
pass
1586-
15871570
try:
15881571
import wx
15891572
backend_version = wx.VERSION_STRING
15901573
except ImportError:
15911574
raise CheckFailed("requires wxPython")
15921575

1593-
if not is_min_version(backend_version, "2.9"):
1594-
raise CheckFailed(
1595-
"Requires wxPython 2.9, found %s" % backend_version)
1596-
15971576
return "version %s" % backend_version
15981577

15991578

tutorials/introductory/usage.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,8 @@ def my_plotter(ax, data1, data2, param_dict):
437437
# Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_ or
438438
# ``pyside``). This backend can be activated in IPython with
439439
# ``%matplotlib qt4``.
440-
# WXAgg Agg rendering to a :term:`wxWidgets` canvas (requires wxPython_;
441-
# v4.0 (in beta) is required for Python3). This backend can be
442-
# activated in IPython with ``%matplotlib wx``.#
440+
# WXAgg Agg rendering to a :term:`wxWidgets` canvas (requires wxPython_ 4).
441+
# This backend can be activated in IPython with ``%matplotlib wx``.
443442
# ========= ================================================================
444443
#
445444
# .. _`Anti-Grain Geometry`: http://antigrain.com/

0 commit comments

Comments
 (0)