8000 Backport PR #9187 on branch v2.1.x by lumberbot-app[bot] · Pull Request #9216 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #9187 on branch v2.1.x #9216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ install:
echo 'PyQt5 is available' ||
echo 'PyQt5 is not available'
pip install -U --pre \
-f https://wxpython.org/Phoenix/release-extras/linux/gtk3/ubuntu-14.04 \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 \
wxPython &&
python -c 'import wx' &&
echo 'wxPython is available' ||
Expand Down
48 changes: 30 additions & 18 deletions lib/matplotlib/backends/wx_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,24 +139,36 @@
StockCursor = wx.StockCursor


# wxPython Classic's DoAddTool has become AddTool in Phoenix. Otherwise
# they are the same, except for early betas and prerelease builds of
# Phoenix. This function provides a shim that does the RightThing based on
# which wxPython is in use.
def _AddTool(parent, wx_ids, text, bmp, tooltip_text):
if text in ['Pan', 'Zoom']:
kind = wx.ITEM_CHECK
else:
kind = wx.ITEM_NORMAL
if is_phoenix:
if text in ['Pan', 'Zoom']:
kind = wx.ITEM_CHECK
else:
kind = wx.ITEM_NORMAL
parent.AddTool(wx_ids[text], label=text,
bitmap=bmp,
bmpDisabled=wx.NullBitmap,
shortHelpString=text,
longHelpString=tooltip_text,
kind=kind)
add_tool = parent.AddTool
else:
add_tool = parent.DoAddTool

if not is_phoenix or LooseVersion(wx.VERSION_STRING) >= "4.0.0b2":
# NOTE: when support for Phoenix prior to 4.0.0b2 is dropped then
# all that is needed is this clause, and the if and else clause can
# be removed.
kwargs = dict(label=text,
bitmap=bmp,
bmpDisabled=wx.NullBitmap,
shortHelp=text,
longHelp=tooltip_text,
kind=kind)
else:
if text in ['Pan', 'Zoom']:
parent.AddCheckTool(
wx_ids[text],
bmp,
shortHelp=text,
longHelp=tooltip_text)
else:
parent.AddSimpleTool(wx_ids[text], bmp, text, tooltip_text)
kwargs = dict(label=text,
bitmap=bmp,
bmpDisabled=wx.NullBitmap,
shortHelpString=text,
longHelpString=tooltip_text,
kind=kind)

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