|
11 | 11 | unicode_literals) |
12 | 12 |
|
13 | 13 | import six |
14 | | -from distutils.version import StrictVersion, LooseVersion |
15 | 14 |
|
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 |
17 | 18 |
|
18 | 19 |
|
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 | | - |
35 | 20 | if is_phoenix: |
36 | 21 | # define all the wxPython phoenix stuff |
37 | 22 |
|
@@ -157,22 +142,11 @@ def _AddTool(parent, wx_ids, text, bmp, tooltip_text): |
157 | 142 | else: |
158 | 143 | add_tool = parent.DoAddTool |
159 | 144 |
|
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) |
177 | 151 |
|
178 | 152 | return add_tool(wx_ids[text], **kwargs) |
0 commit comments