Skip to content

Commit 89435dd

Browse files
committed
Removed unused _wxagg extension.
svn path=/trunk/matplotlib/; revision=8702
1 parent d8c86dc commit 89435dd

File tree

6 files changed

+6
-508
lines changed

6 files changed

+6
-508
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2010-09-15 Remove unused _wxagg extension. - EF
2+
13
2010-08-25 Add new framework for doing animations with examples.- RM
24

35
2010-08-21 Remove unused and inappropriate methods from Tick classes:

lib/matplotlib/backends/backend_wxagg.py

Lines changed: 2 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -128,78 +128,12 @@ def new_figure_manager(num, *args, **kwargs):
128128
return figmgr
129129

130130

131-
#
132-
# agg/wxPython image conversion functions (wxPython <= 2.6)
133-
#
134-
135-
def _py_convert_agg_to_wx_image(agg, bbox):
136-
"""
137-
Convert the region of the agg buffer bounded by bbox to a wx.Image. If
138-
bbox is None, the entire buffer is converted.
139-
140-
Note: agg must be a backend_agg.RendererAgg instance.
141-
"""
142-
image = wx.EmptyImage(int(agg.width), int(agg.height))
143-
image.SetData(agg.tostring_rgb())
144-
145-
if bbox is None:
146-
# agg => rgb -> image
147-
return image
148-
else:
149-
# agg => rgb -> image => bitmap => clipped bitmap => image
150-
return wx.ImageFromBitmap(_clipped_image_as_bitmap(image, bbox))
151-
152-
153-
def _py_convert_agg_to_wx_bitmap(agg, bbox):
154-
"""
155-
Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If
156-
bbox is None, the entire buffer is converted.
157-
158-
Note: agg must be a backend_agg.RendererAgg instance.
159-
"""
160-
if bbox is None:
161-
# agg => rgb -> image => bitmap
162-
return wx.BitmapFromImage(_py_convert_agg_to_wx_image(agg, None))
163-
else:
164-
# agg => rgb -> image => bitmap => clipped bitmap
165-
return _clipped_image_as_bitmap(
166-
_py_convert_agg_to_wx_image(agg, None),
167-
bbox)
168-
169-
170-
def _clipped_image_as_bitmap(image, bbox):
171-
"""
172-
Convert the region of a wx.Image bounded by bbox to a wx.Bitmap.
173-
"""
174-
l, b, width, height = bbox.bounds
175-
r = l + width
176-
t = b + height
177-
178-
srcBmp = wx.BitmapFromImage(image)
179-
srcDC = wx.MemoryDC()
180-
srcDC.SelectObject(srcBmp)
181-
182-
destBmp = wx.EmptyBitmap(int(width), int(height))
183-
destDC = wx.MemoryDC()
184-
destDC.SelectObject(destBmp)
185-
186-
destDC.BeginDrawing()
187-
x = int(l)
188-
y = int(image.GetHeight() - t)
189-
destDC.Blit(0, 0, int(width), int(height), srcDC, x, y)
190-
destDC.EndDrawing()
191-
192-
srcDC.SelectObject(wx.NullBitmap)
193-
destDC.SelectObject(wx.NullBitmap)
194-
195-
return destBmp
196-
197131

198132
#
199133
# agg/wxPython image conversion functions (wxPython >= 2.8)
200134
#
201135

202-
def _py_WX28_convert_agg_to_wx_image(agg, bbox):
136+
def _convert_agg_to_wx_image(agg, bbox):
203137
"""
204138
Convert the region of the agg buffer bounded by bbox to a wx.Image. If
205139
bbox is None, the entire buffer is converted.
@@ -216,7 +150,7 @@ def _py_WX28_convert_agg_to_wx_image(agg, bbox):
216150
return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
217151

218152

219-
def _py_WX28_convert_agg_to_wx_bitmap(agg, bbox):
153+
def _convert_agg_to_wx_bitmap(agg, bbox):
220154
"""
221155
Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If
222156
bbox is None, the entire buffer is converted.
@@ -262,34 +196,3 @@ def _WX28_clipped_agg_as_bitmap(agg, bbox):
262196

263197
return destBmp
264198

265-
266-
def _use_accelerator(state):
267-
"""
268-
Enable or disable the WXAgg accelerator, if it is present and is also
269-
compatible with whatever version of wxPython is in use.
270-
"""
271-
global _convert_agg_to_wx_image
272-
global _convert_agg_to_wx_bitmap
273-
274-
if getattr(wx, '__version__', '0.0')[0:3] < '2.8':
275-
# wxPython < 2.8, so use the C++ accelerator or the Python routines
276-
if state and _wxagg is not None:
277-
_convert_agg_to_wx_image = _wxagg.convert_agg_to_wx_image
278-
_convert_agg_to_wx_bitmap = _wxagg.convert_agg_to_wx_bitmap
279-
else:
280-
_convert_agg_to_wx_image = _py_convert_agg_to_wx_image
281-
_convert_agg_to_wx_bitmap = _py_convert_agg_to_wx_bitmap
282-
else:
283-
# wxPython >= 2.8, so use the accelerated Python routines
284-
_convert_agg_to_wx_image = _py_WX28_convert_agg_to_wx_image
285-
_convert_agg_to_wx_bitmap = _py_WX28_convert_agg_to_wx_bitmap
286-
287-
288-
# try to load the WXAgg accelerator
289-
try:
290-
import _wxagg
291-
except ImportError:
292-
_wxagg = None
293-
294-
# if it's present, use it
295-
_use_accelerator(True)

setup.cfg.template

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ tag_svn_revision = 1
5858
#gtk = False
5959
#gtkagg = False
6060
#tkagg = False
61-
#wxagg = False
6261
#macosx = False
6362

6463
[rc_options]
@@ -74,10 +73,3 @@ tag_svn_revision = 1
7473
#
7574
#backend = Agg
7675
#
77-
# The numerix module was historically used to provide
78-
# compatibility between the Numeric, numarray, and NumPy array
79-
# packages. Now that NumPy has emerge as the universal array
80-
# package for python, numerix is not really necessary and is
81-
# maintained to provide backward compatibility. Do not change
82-
# this unless you have a compelling reason to do so.
83-
#numerix = numpy

setup.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333

3434
import glob
3535
from distutils.core import setup
36-
from setupext import build_agg, build_gtkagg, build_tkagg, build_wxagg,\
36+
from setupext import build_agg, build_gtkagg, build_tkagg,\
3737
build_macosx, build_ft2font, build_image, build_windowing, build_path, \
3838
build_contour, build_delaunay, build_nxutils, build_gdk, \
3939
build_ttconv, print_line, print_status, print_message, \
4040
print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \
41-
check_for_tk, check_for_wx, check_for_macosx, check_for_numpy, \
41+
check_for_tk, check_for_macosx, check_for_numpy, \
4242
check_for_qt, check_for_qt4, check_for_cairo, \
4343
check_provide_pytz, check_provide_dateutil,\
4444
check_for_dvipng, check_for_ghostscript, check_for_latex, \
@@ -156,17 +156,6 @@ def chop_package(fname):
156156
build_tkagg(ext_modules, packages)
157157
rc['backend'] = 'TkAgg'
158158

159-
if options['build_wxagg']:
160-
if check_for_wx() or (options['build_wxagg'] is True):
161-
options['build_agg'] = 1
162-
import wx
163-
if getattr(wx, '__version__', '0.0')[0:3] < '2.8' :
164-
build_wxagg(ext_modules, packages)
165-
wxagg_backend_status = "yes"
166-
else:
167-
print_message("WxAgg extension not required for wxPython >= 2.8")
168-
rc['backend'] = 'WXAgg'
169-
170159
hasgtk = check_for_gtk()
171160
if options['build_gtk']:
172161
if hasgtk or (options['build_gtk'] is True):

setupext.py

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
BUILT_IMAGE = False
103103
BUILT_MACOSX = False
104104
BUILT_TKAGG = False
105-
BUILT_WXAGG = False
106105
BUILT_WINDOWING = False
107106
BUILT_CONTOUR = False
108107
BUILT_DELAUNAY = False
@@ -127,7 +126,6 @@
127126
'build_gtk': 'auto',
128127
'build_gtkagg': 'auto',
129128
'build_tkagg': 'auto',
130-
'build_wxagg': 'auto',
131129
'build_macosx': 'auto',
132130
'build_image': True,
133131
'build_windowing': True,
@@ -166,9 +164,6 @@
166164
try: options['build_tkagg'] = config.getboolean("gui_support", "tkagg")
167165
except: options['build_tkagg'] = 'auto'
168166

169-
try: options['build_wxagg'] = config.getboolean("gui_support", "wxagg")
170-
except: options['build_wxagg'] = 'auto'
171-
172167
try: options['build_macosx'] = config.getboolean("gui_support", "macosx")
173168
except: options['build_macosx'] = 'auto'
174169

@@ -710,97 +705,6 @@ def add_pygtk_flags(module):
710705
if sys.platform == 'win32' and win32_compiler == 'msvc' and 'm' in module.libraries:
711706
module.libraries.remove('m')
712707

713-
714-
def check_for_wx():
715-
gotit = False
716-
explanation = None
717-
try:
718-
import wx
719-
except ImportError:
720-
explanation = 'wxPython not found'
721-
else:
722-
if getattr(wx, '__version__', '0.0')[0:3] >= '2.8':
723-
print_status("wxPython", wx.__version__)
724-
return True
725-
elif sys.platform == 'win32' and win32_compiler == 'mingw32':
726-
explanation = "The wxAgg extension can not be built using the mingw32 compiler on Windows, since the default wxPython binary is built using MS Visual Studio"
727-
else:
728-
wxconfig = find_wx_config()
729-
if wxconfig is None:
730-
explanation = """
731-
WXAgg's accelerator requires `wx-config'.
732-
733-
The `wx-config\' executable could not be located in any directory of the
734-
PATH environment variable. If you want to build WXAgg, and wx-config is
735-
in some other location or has some other name, set the WX_CONFIG
736-
environment variable to the full path of the executable like so:
737-
738-
export WX_CONFIG=/usr/lib/wxPython-2.6.1.0-gtk2-unicode/bin/wx-config
739-
"""
740-
elif not check_wxpython_broken_macosx104_version(wxconfig):
741-
explanation = 'WXAgg\'s accelerator not building because a broken wxPython (installed by Apple\'s Mac OS X) was found.'
742-
else:
743-
gotit = True
744-
745-
if gotit:
746-
module = Extension("test", [])
747-
add_wx_flags(module, wxconfig)
748-
if not find_include_file(
749-
module.include_dirs,
750-
os.path.join("wx", "wxPython", "wxPython.h")):
751-
explanation = ("Could not find wxPython headers in any of %s" %
752-
", ".join(["'%s'" % x for x in module.include_dirs]))
753-
754-
if gotit:
755-
print_status("wxPython", wx.__version__)
756-
else:
757-
print_status("wxPython", "no")
758-
if explanation is not None:
759-
print_message(explanation)
760-
return gotit
761-
762-
def find_wx_config():
763-
"""If the WX_CONFIG environment variable has been set, returns it value.
764-
Otherwise, search for `wx-config' in the PATH directories and return the
765-
first match found. Failing that, return None.
766-
"""
767-
768-
wxconfig = os.getenv('WX_CONFIG')
769-
if wxconfig is not None:
770-
return wxconfig
771-
772-
path = os.getenv('PATH') or ''
773-
for dir in path.split(':'):
774-
wxconfig = os.path.join(dir, 'wx-config')
775-
if os.path.exists(wxconfig):
776-
return wxconfig
777-
778-
return None
779-
780-
def check_wxpython_broken_macosx104_version(wxconfig):
781-
"""Determines if we're using a broken wxPython installed by Mac OS X 10.4"""
782-
if sys.platform == 'darwin':
783-
if wxconfig == '/usr/bin/wx-config':
784-
version_full = getoutput(wxconfig + ' --version-full')
785-
if version_full == '2.5.3.1':
786-
return False
787-
return True
788-
789-
def add_wx_flags(module, wxconfig):
790-
"""
791-
Add the module flags to build extensions which use wxPython.
792-
"""
793-
794-
if sys.platform == 'win32': # just added manually
795-
wxlibs = ['wxexpath', 'wxjpegh', 'wxmsw26uh',
796-
'wxmsw26uh_animate', 'wxmsw26uh_gizmos', 'wxmsw26uh_gizmos_xrc',
797-
'wxmsw26uh_gl', 'wxmsw26uh_stc', 'wxpngh', 'wxregexuh', 'wxtiffh', 'wxzlibh']
798-
module.libraries.extend(wxlibs)
799-
module.libraries.extend(wxlibs)
800-
return
801-
802-
get_pkgconfig(module, '', flags='--cppflags --libs', pkg_config_exec='wx-config')
803-
804708
# Make sure you use the Tk version given by Tkinter.TkVersion
805709
# or else you'll build for a wrong version of the Tcl
806710
# interpreter (leading to nasty segfaults).
@@ -1200,25 +1104,6 @@ def build_tkagg(ext_modules, packages):
12001104
BUILT_TKAGG = True
12011105

12021106

1203-
def build_wxagg(ext_modules, packages):
1204-
global BUILT_WXAGG
1205-
if BUILT_WXAGG:
1206-
return
1207-
1208-
deps = ['src/_wxagg.cpp', 'src/mplutils.cpp']
1209-
deps.extend(glob.glob('CXX/*.cxx'))
1210-
deps.extend(glob.glob('CXX/*.c'))
1211-
1212-
module = Extension('matplotlib.backends._wxagg', deps)
1213-
1214-
add_agg_flags(module)
1215-
add_ft2font_flags(module)
1216-
wxconfig = find_wx_config()
1217-
add_wx_flags(module, wxconfig)
1218-
1219-
ext_modules.append(module)
1220-
BUILT_WXAGG = True
1221-
12221107
def build_macosx(ext_modules, packages):
12231108
global BUILT_MACOSX
12241109
if BUILT_MACOSX: return # only build it if you you haven't already

0 commit comments

Comments
 (0)