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

Skip to content

Commit 1d73e73

Browse files
Merge pull request #10609 from anntzer/wxmorecleanup
More wx cleanup.
2 parents 91bc843 + e027afc commit 1d73e73

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

doc/api/next_api_changes/2018-02-15-AL-deprecations.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The following classes, methods, functions, and attributes are deprecated:
1616
- ``dates.DateFormatter.strftime_pre_1900``, ``dates.DateFormatter.strftime``,
1717
- ``font_manager.TempCache``,
1818
- ``mathtext.unichr_safe`` (use ``chr`` instead),
19+
- ``FigureCanvasWx.macros``,
1920
- ``texmanager.dvipng_hack_alpha``,
2021

2122
The following rcParams are deprecated:

lib/matplotlib/backends/backend_wx.py

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
should be included with this source code.
1414
1515
"""
16-
from __future__ import (absolute_import, division, print_function,
17-
unicode_literals)
1816

1917
import six
2018

@@ -606,30 +604,11 @@ def __init__(self, parent, id, figure):
606604
# Set preferred window size hint - helps the sizer (if one is
607605
# connected)
608606
l, b, w, h = figure.bbox.bounds
609-
w = int(math.ceil(w))
610-
h = int(math.ceil(h))
607+
w = math.ceil(w)
608+
h = math.ceil(h)
611609

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

614-
def do_nothing(*args, **kwargs):
615-
warnings.warn(
616-
"could not find a setinitialsize function for backend_wx; "
617-
"please report your wxpython version=%s "
618-
"to the matplotlib developers list" %
619-
wxc.backend_version)
620-
pass
621-
622-
# try to find the set size func across wx versions
623-
try:
624-
getattr(self, 'SetInitialSize')
625-
except AttributeError:
626-
self.SetInitialSize = getattr(self, 'SetBestFittingSize',
627-
do_nothing)
628-
629-
if not hasattr(self, 'IsShownOnScreen'):
630-
self.IsShownOnScreen = getattr(self, 'IsVisible',
631-
lambda *args: True)
632-
633612
# Create the drawing bitmap
634613
self.bitmap = wxc.EmptyBitmap(w, h)
635614
DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w, h), 2, self)
@@ -661,7 +640,10 @@ def do_nothing(*args, **kwargs):
661640
self.SetBackgroundStyle(wx.BG_STYLE_PAINT) # Reduce flicker.
662641
self.SetBackgroundColour(wx.WHITE)
663642

664-
self.macros = {} # dict from wx id to seq of macros
643+
@property
644+
@cbook.deprecated("3.0")
645+
def macros(self):
646+
return {}
665647

666648
def Destroy(self, *args, **kwargs):
667649
wx.Panel.Destroy(self, *args, **kwargs)
@@ -1082,8 +1064,8 @@ def _print_image(self, filename, filetype, *args, **kwargs):
10821064
origBitmap = self.bitmap
10831065

10841066
l, b, width, height = self.figure.bbox.bounds
1085-
width = int(math.ceil(width))
1086-
height = int(math.ceil(height))
1067+
width = math.ceil(width)
1068+
height = math.ceil(height)
10871069

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

0 commit comments

Comments
 (0)