Skip to content

More wx cleanup. #10609

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 2 commits into from
Mar 20, 2018
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
1 change: 1 addition & 0 deletions doc/api/next_api_changes/2018-02-15-AL-deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The following classes, methods, functions, and attributes are deprecated:
- ``dates.DateFormatter.strftime_pre_1900``, ``dates.DateFormatter.strftime``,
- ``font_manager.TempCache``,
- ``mathtext.unichr_safe`` (use ``chr`` instead),
- ``FigureCanvasWx.macros``,
- ``texmanager.dvipng_hack_alpha``,

The following rcParams are deprecated:
Expand Down
34 changes: 8 additions & 26 deletions lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
should be included with this source code.

"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import six

Expand Down Expand Up @@ -606,30 +604,11 @@ def __init__(self, parent, id, figure):
# Set preferred window size hint - helps the sizer (if one is
# connected)
l, b, w, h = figure.bbox.bounds
w = int(math.ceil(w))
h = int(math.ceil(h))
w = math.ceil(w)
h = math.ceil(h)

wx.Panel.__init__(self, parent, id, size=wx.Size(w, h))

def do_nothing(*args, **kwargs):
warnings.warn(
"could not find a setinitialsize function for backend_wx; "
"please report your wxpython version=%s "
"to the matplotlib developers list" %
wxc.backend_version)
pass

# try to find the set size func across wx versions
try:
getattr(self, 'SetInitialSize')
except AttributeError:
self.SetInitialSize = getattr(self, 'SetBestFittingSize',
do_nothing)

if not hasattr(self, 'IsShownOnScreen'):
self.IsShownOnScreen = getattr(self, 'IsVisible',
lambda *args: True)

# Create the drawing bitmap
self.bitmap = wxc.EmptyBitmap(w, h)
DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w, h), 2, self)
Expand Down Expand Up @@ -661,7 +640,10 @@ def do_nothing(*args, **kwargs):
self.SetBackgroundStyle(wx.BG_STYLE_PAINT) # Reduce flicker.
self.SetBackgroundColour(wx.WHITE)

self.macros = {} # dict from wx id to seq of macros
@property
@cbook.deprecated("3.0")
def macros(self):
return {}

def Destroy(self, *args, **kwargs):
wx.Panel.Destroy(self, *args, **kwargs)
Expand Down Expand Up @@ -1082,8 +1064,8 @@ def _print_image(self, filename, filetype, *args, **kwargs):
origBitmap = self.bitmap

l, b, width, height = self.figure.bbox.bounds
width = int(math.ceil(width))
height = int(math.ceil(height))
width = math.ceil(width)
height = math.ceil(height)

self.bitmap = wxc.EmptyBitmap(width, height)

Expand Down