|
From: <ef...@us...> - 2010-09-16 00:17:16
|
Revision: 8702
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8702&view=rev
Author: efiring
Date: 2010-09-16 00:17:09 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
Removed unused _wxagg extension.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py
trunk/matplotlib/setup.cfg.template
trunk/matplotlib/setup.py
trunk/matplotlib/setupext.py
Removed Paths:
-------------
trunk/matplotlib/src/_wxagg.cpp
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2010-09-14 15:59:35 UTC (rev 8701)
+++ trunk/matplotlib/CHANGELOG 2010-09-16 00:17:09 UTC (rev 8702)
@@ -1,3 +1,5 @@
+2010-09-15 Remove unused _wxagg extension. - EF
+
2010-08-25 Add new framework for doing animations with examples.- RM
2010-08-21 Remove unused and inappropriate methods from Tick classes:
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2010-09-14 15:59:35 UTC (rev 8701)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2010-09-16 00:17:09 UTC (rev 8702)
@@ -128,78 +128,12 @@
return figmgr
-#
-# agg/wxPython image conversion functions (wxPython <= 2.6)
-#
-def _py_convert_agg_to_wx_image(agg, bbox):
- """
- Convert the region of the agg buffer bounded by bbox to a wx.Image. If
- bbox is None, the entire buffer is converted.
-
- Note: agg must be a backend_agg.RendererAgg instance.
- """
- image = wx.EmptyImage(int(agg.width), int(agg.height))
- image.SetData(agg.tostring_rgb())
-
- if bbox is None:
- # agg => rgb -> image
- return image
- else:
- # agg => rgb -> image => bitmap => clipped bitmap => image
- return wx.ImageFromBitmap(_clipped_image_as_bitmap(image, bbox))
-
-
-def _py_convert_agg_to_wx_bitmap(agg, bbox):
- """
- Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If
- bbox is None, the entire buffer is converted.
-
- Note: agg must be a backend_agg.RendererAgg instance.
- """
- if bbox is None:
- # agg => rgb -> image => bitmap
- return wx.BitmapFromImage(_py_convert_agg_to_wx_image(agg, None))
- else:
- # agg => rgb -> image => bitmap => clipped bitmap
- return _clipped_image_as_bitmap(
- _py_convert_agg_to_wx_image(agg, None),
- bbox)
-
-
-def _clipped_image_as_bitmap(image, bbox):
- """
- Convert the region of a wx.Image bounded by bbox to a wx.Bitmap.
- """
- l, b, width, height = bbox.bounds
- r = l + width
- t = b + height
-
- srcBmp = wx.BitmapFromImage(image)
- srcDC = wx.MemoryDC()
- srcDC.SelectObject(srcBmp)
-
- destBmp = wx.EmptyBitmap(int(width), int(height))
- destDC = wx.MemoryDC()
- destDC.SelectObject(destBmp)
-
- destDC.BeginDrawing()
- x = int(l)
- y = int(image.GetHeight() - t)
- destDC.Blit(0, 0, int(width), int(height), srcDC, x, y)
- destDC.EndDrawing()
-
- srcDC.SelectObject(wx.NullBitmap)
- destDC.SelectObject(wx.NullBitmap)
-
- return destBmp
-
-
#
# agg/wxPython image conversion functions (wxPython >= 2.8)
#
-def _py_WX28_convert_agg_to_wx_image(agg, bbox):
+def _convert_agg_to_wx_image(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Image. If
bbox is None, the entire buffer is converted.
@@ -216,7 +150,7 @@
return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
-def _py_WX28_convert_agg_to_wx_bitmap(agg, bbox):
+def _convert_agg_to_wx_bitmap(agg, bbox):
"""
Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If
bbox is None, the entire buffer is converted.
@@ -262,34 +196,3 @@
return destBmp
-
-def _use_accelerator(state):
- """
- Enable or disable the WXAgg accelerator, if it is present and is also
- compatible with whatever version of wxPython is in use.
- """
- global _convert_agg_to_wx_image
- global _convert_agg_to_wx_bitmap
-
- if getattr(wx, '__version__', '0.0')[0:3] < '2.8':
- # wxPython < 2.8, so use the C++ accelerator or the Python routines
- if state and _wxagg is not None:
- _convert_agg_to_wx_image = _wxagg.convert_agg_to_wx_image
- _convert_agg_to_wx_bitmap = _wxagg.convert_agg_to_wx_bitmap
- else:
- _convert_agg_to_wx_image = _py_convert_agg_to_wx_image
- _convert_agg_to_wx_bitmap = _py_convert_agg_to_wx_bitmap
- else:
- # wxPython >= 2.8, so use the accelerated Python routines
- _convert_agg_to_wx_image = _py_WX28_convert_agg_to_wx_image
- _convert_agg_to_wx_bitmap = _py_WX28_convert_agg_to_wx_bitmap
-
-
-# try to load the WXAgg accelerator
-try:
- import _wxagg
-except ImportError:
- _wxagg = None
-
-# if it's present, use it
-_use_accelerator(True)
Modified: trunk/matplotlib/setup.cfg.template
===================================================================
--- trunk/matplotlib/setup.cfg.template 2010-09-14 15:59:35 UTC (rev 8701)
+++ trunk/matplotlib/setup.cfg.template 2010-09-16 00:17:09 UTC (rev 8702)
@@ -58,7 +58,6 @@
#gtk = False
#gtkagg = False
#tkagg = False
-#wxagg = False
#macosx = False
[rc_options]
@@ -74,10 +73,3 @@
#
#backend = Agg
#
-# The numerix module was historically used to provide
-# compatibility between the Numeric, numarray, and NumPy array
-# packages. Now that NumPy has emerge as the universal array
-# package for python, numerix is not really necessary and is
-# maintained to provide backward compatibility. Do not change
-# this unless you have a compelling reason to do so.
-#numerix = numpy
Modified: trunk/matplotlib/setup.py
===================================================================
--- trunk/matplotlib/setup.py 2010-09-14 15:59:35 UTC (rev 8701)
+++ trunk/matplotlib/setup.py 2010-09-16 00:17:09 UTC (rev 8702)
@@ -33,12 +33,12 @@
import glob
from distutils.core import setup
-from setupext import build_agg, build_gtkagg, build_tkagg, build_wxagg,\
+from setupext import build_agg, build_gtkagg, build_tkagg,\
build_macosx, build_ft2font, build_image, build_windowing, build_path, \
build_contour, build_delaunay, build_nxutils, build_gdk, \
build_ttconv, print_line, print_status, print_message, \
print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \
- check_for_tk, check_for_wx, check_for_macosx, check_for_numpy, \
+ check_for_tk, check_for_macosx, check_for_numpy, \
check_for_qt, check_for_qt4, check_for_cairo, \
check_provide_pytz, check_provide_dateutil,\
check_for_dvipng, check_for_ghostscript, check_for_latex, \
@@ -156,17 +156,6 @@
build_tkagg(ext_modules, packages)
rc['backend'] = 'TkAgg'
-if options['build_wxagg']:
- if check_for_wx() or (options['build_wxagg'] is True):
- options['build_agg'] = 1
- import wx
- if getattr(wx, '__version__', '0.0')[0:3] < '2.8' :
- build_wxagg(ext_modules, packages)
- wxagg_backend_status = "yes"
- else:
- print_message("WxAgg extension not required for wxPython >= 2.8")
- rc['backend'] = 'WXAgg'
-
hasgtk = check_for_gtk()
if options['build_gtk']:
if hasgtk or (options['build_gtk'] is True):
Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py 2010-09-14 15:59:35 UTC (rev 8701)
+++ trunk/matplotlib/setupext.py 2010-09-16 00:17:09 UTC (rev 8702)
@@ -102,7 +102,6 @@
BUILT_IMAGE = False
BUILT_MACOSX = False
BUILT_TKAGG = False
-BUILT_WXAGG = False
BUILT_WINDOWING = False
BUILT_CONTOUR = False
BUILT_DELAUNAY = False
@@ -127,7 +126,6 @@
'build_gtk': 'auto',
'build_gtkagg': 'auto',
'build_tkagg': 'auto',
- 'build_wxagg': 'auto',
'build_macosx': 'auto',
'build_image': True,
'build_windowing': True,
@@ -166,9 +164,6 @@
try: options['build_tkagg'] = config.getboolean("gui_support", "tkagg")
except: options['build_tkagg'] = 'auto'
- try: options['build_wxagg'] = config.getboolean("gui_support", "wxagg")
- except: options['build_wxagg'] = 'auto'
-
try: options['build_macosx'] = config.getboolean("gui_support", "macosx")
except: options['build_macosx'] = 'auto'
@@ -710,97 +705,6 @@
if sys.platform == 'win32' and win32_compiler == 'msvc' and 'm' in module.libraries:
module.libraries.remove('m')
-
-def check_for_wx():
- gotit = False
- explanation = None
- try:
- import wx
- except ImportError:
- explanation = 'wxPython not found'
- else:
- if getattr(wx, '__version__', '0.0')[0:3] >= '2.8':
- print_status("wxPython", wx.__version__)
- return True
- elif sys.platform == 'win32' and win32_compiler == 'mingw32':
- 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"
- else:
- wxconfig = find_wx_config()
- if wxconfig is None:
- explanation = """
-WXAgg's accelerator requires `wx-config'.
-
-The `wx-config\' executable could not be located in any directory of the
-PATH environment variable. If you want to build WXAgg, and wx-config is
-in some other location or has some other name, set the WX_CONFIG
-environment variable to the full path of the executable like so:
-
-export WX_CONFIG=/usr/lib/wxPython-2.6.1.0-gtk2-unicode/bin/wx-config
-"""
- elif not check_wxpython_broken_macosx104_version(wxconfig):
- explanation = 'WXAgg\'s accelerator not building because a broken wxPython (installed by Apple\'s Mac OS X) was found.'
- else:
- gotit = True
-
- if gotit:
- module = Extension("test", [])
- add_wx_flags(module, wxconfig)
- if not find_include_file(
- module.include_dirs,
- os.path.join("wx", "wxPython", "wxPython.h")):
- explanation = ("Could not find wxPython headers in any of %s" %
- ", ".join(["'%s'" % x for x in module.include_dirs]))
-
- if gotit:
- print_status("wxPython", wx.__version__)
- else:
- print_status("wxPython", "no")
- if explanation is not None:
- print_message(explanation)
- return gotit
-
-def find_wx_config():
- """If the WX_CONFIG environment variable has been set, returns it value.
- Otherwise, search for `wx-config' in the PATH directories and return the
- first match found. Failing that, return None.
- """
-
- wxconfig = os.getenv('WX_CONFIG')
- if wxconfig is not None:
- return wxconfig
-
- path = os.getenv('PATH') or ''
- for dir in path.split(':'):
- wxconfig = os.path.join(dir, 'wx-config')
- if os.path.exists(wxconfig):
- return wxconfig
-
- return None
-
-def check_wxpython_broken_macosx104_version(wxconfig):
- """Determines if we're using a broken wxPython installed by Mac OS X 10.4"""
- if sys.platform == 'darwin':
- if wxconfig == '/usr/bin/wx-config':
- version_full = getoutput(wxconfig + ' --version-full')
- if version_full == '2.5.3.1':
- return False
- return True
-
-def add_wx_flags(module, wxconfig):
- """
- Add the module flags to build extensions which use wxPython.
- """
-
- if sys.platform == 'win32': # just added manually
- wxlibs = ['wxexpath', 'wxjpegh', 'wxmsw26uh',
- 'wxmsw26uh_animate', 'wxmsw26uh_gizmos', 'wxmsw26uh_gizmos_xrc',
- 'wxmsw26uh_gl', 'wxmsw26uh_stc', 'wxpngh', 'wxregexuh', 'wxtiffh', 'wxzlibh']
- module.libraries.extend(wxlibs)
- module.libraries.extend(wxlibs)
- return
-
- get_pkgconfig(module, '', flags='--cppflags --libs', pkg_config_exec='wx-config')
-
# Make sure you use the Tk version given by Tkinter.TkVersion
# or else you'll build for a wrong version of the Tcl
# interpreter (leading to nasty segfaults).
@@ -1200,25 +1104,6 @@
BUILT_TKAGG = True
-def build_wxagg(ext_modules, packages):
- global BUILT_WXAGG
- if BUILT_WXAGG:
- return
-
- deps = ['src/_wxagg.cpp', 'src/mplutils.cpp']
- deps.extend(glob.glob('CXX/*.cxx'))
- deps.extend(glob.glob('CXX/*.c'))
-
- module = Extension('matplotlib.backends._wxagg', deps)
-
- add_agg_flags(module)
- add_ft2font_flags(module)
- wxconfig = find_wx_config()
- add_wx_flags(module, wxconfig)
-
- ext_modules.append(module)
- BUILT_WXAGG = True
-
def build_macosx(ext_modules, packages):
global BUILT_MACOSX
if BUILT_MACOSX: return # only build it if you you haven't already
Deleted: trunk/matplotlib/src/_wxagg.cpp
===================================================================
--- trunk/matplotlib/src/_wxagg.cpp 2010-09-14 15:59:35 UTC (rev 8701)
+++ trunk/matplotlib/src/_wxagg.cpp 2010-09-16 00:17:09 UTC (rev 8702)
@@ -1,273 +0,0 @@
-// File: _wxagg.cpp
-// Purpose: Accelerate WXAgg by doing the agg->wxWidgets conversions in C++.
-// Author: Ken McIvor <mc...@ii...>
-//
-// Copyright 2005 Illinois Institute of Technology
-// Derived from `_gtkagg.cpp', Copyright 2004-2005 John Hunter
-//
-// See the file "LICENSE" for information on usage and redistribution
-// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-
-
-// TODO:
-// * Better type checking.
-//
-// * Make the `bbox' argument optional.
-//
-// * Determine if there are any thread-safety issues with this implementation.
-//
-// * Perform some AGG kung-fu to let us slice a region out of a
-// rendering_buffer and convert it from RGBA to RGB on the fly, rather than
-// making itermediate copies. This could be of use in _gtkagg and _tkagg as
-// well.
-//
-// * Write an agg_to_wx_bitmap() that works more like agg_to_gtk_drawable(),
-// drawing directly to a bitmap.
-//
-// This was the initial plan, except that I had not idea how to take a
-// wx.Bitmap Python shadow class and turn it into a wxBitmap pointer.
-//
-// It appears that this is the way to do it:
-// bool success = wxPyConvertSwigPtr(pyBitmap, (void**)&bitmap,
-// _T("wxBitmap"));
-//
-// I'm not sure this will speed things up much, since wxWidgets requires you
-// to go AGG->wx.Image->wx.Bitmap before you can blit using a MemoryDC.
-
-
-#include <cstring>
-#include <cerrno>
-#include <cstdio>
-#include <iostream>
-#include <cmath>
-#include <utility>
-#include <fstream>
-#include <stdlib.h>
-
-#include "agg_basics.h"
-#include "_backend_agg.h"
-#include "agg_pixfmt_rgba.h"
-#include "util/agg_color_conv_rgb8.h"
-#include "agg_py_transforms.h"
-
-#include <wx/image.h>
-#include <wx/bitmap.h>
-#include <wx/wxPython/wxPython.h>
-
-
-// forward declarations
-static wxImage *convert_agg2image(RendererAgg *aggRenderer, Py::Object clipbox);
-static wxBitmap *convert_agg2bitmap(RendererAgg *aggRenderer, Py::Object clipbox);
-
-
-// the extension module
-class _wxagg_module : public Py::ExtensionModule<_wxagg_module>
-{
-public:
-
- _wxagg_module()
- : Py::ExtensionModule<_wxagg_module>("_wxkagg")
- {
- add_varargs_method("convert_agg_to_wx_image",
- &_wxagg_module::convert_agg_to_wx_image,
- "Convert the region of the agg buffer bounded by bbox to a wx.Image."
- " If bbox\nis None, the entire buffer is converted.\n\nNote: agg must"
- " be a backend_agg.RendererAgg instance.");
-
- add_varargs_method("convert_agg_to_wx_bitmap",
- &_wxagg_module::convert_agg_to_wx_bitmap,
- "Convert the region of the agg buffer bounded by bbox to a wx.Bitmap."
- " If bbox\nis None, the entire buffer is converted.\n\nNote: agg must"
- " be a backend_agg.RendererAgg instance.");
-
- initialize("The _wxagg module");
- }
-
- virtual ~_wxagg_module() {}
-
-private:
-
- Py::Object convert_agg_to_wx_image(const Py::Tuple &args)
- {
- args.verify_length(2);
-
- RendererAgg* aggRenderer = static_cast<RendererAgg*>(
- args[0].getAttr("_renderer").ptr());
-
- Py::Object clipbox = args[1];
-
- // convert the buffer
- wxImage *image = convert_agg2image(aggRenderer, clipbox);
-
- // wrap a wx.Image around the result and return it
- PyObject *pyWxImage = wxPyConstructObject(image, _T("wxImage"), 1);
- if (pyWxImage == NULL)
- {
- throw Py::MemoryError(
- "_wxagg.convert_agg_to_wx_image(): could not create the wx.Image");
- }
-
- return Py::asObject(pyWxImage);
- }
-
-
- Py::Object convert_agg_to_wx_bitmap(const Py::Tuple &args)
- {
- args.verify_length(2);
-
- RendererAgg* aggRenderer = static_cast<RendererAgg*>(
- args[0].getAttr("_renderer").ptr());
-
- Py::Object clipbox = args[1];
-
- // convert the buffer
- wxBitmap *bitmap = convert_agg2bitmap(aggRenderer, clipbox);
-
- // wrap a wx.Bitmap around the result and return it
- PyObject *pyWxBitmap = wxPyConstructObject(bitmap, _T("wxBitmap"), 1);
- if (pyWxBitmap == NULL)
- {
- throw Py::MemoryError(
- "_wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap");
- }
-
- return Py::asObject(pyWxBitmap);
- }
-};
-
-
-//
-// Implementation Functions
-//
-
-static wxImage *convert_agg2image(RendererAgg *aggRenderer, Py::Object clipbox)
-{
- int srcWidth = 1;
- int srcHeight = 1;
- int srcStride = 1;
-
- bool deleteSrcBuffer = false;
- agg::int8u *srcBuffer = NULL;
-
- double l, b, r, t;
-
- if (!py_convert_bbox(clipbox.ptr(), l, b, r, t))
- {
- // Convert everything: rgba => rgb -> image
- srcBuffer = aggRenderer->pixBuffer;
- srcWidth = (int) aggRenderer->get_width();
- srcHeight = (int) aggRenderer->get_height();
- srcStride = (int) aggRenderer->get_width() * 4;
- }
- else
- {
- // Convert a region: rgba => clipped rgba => rgb -> image
- srcWidth = (int)(r - l);
- srcHeight = (int)(t - b);
- srcStride = srcWidth * 4;
-
- deleteSrcBuffer = true;
- srcBuffer = new agg::int8u[srcStride*srcHeight];
- if (srcBuffer == NULL)
- {
- throw Py::MemoryError(
- "_wxagg::convert_agg2image(): could not allocate `srcBuffer'");
- }
-
- int h = (int) aggRenderer->get_height();
- agg::rect_base<int> region(
- (int) l, // x1
- h - (int) t, // y1
- (int) r, // x2
- h - (int) b); // y2
-
- agg::rendering_buffer rbuf;
- rbuf.attach(srcBuffer, srcWidth, srcHeight, srcStride);
- pixfmt pf(rbuf);
- renderer_base rndr(pf);
- rndr.copy_from(aggRenderer->renderingBuffer, ®ion,
- (int) - l, (int)(t - h));
- }
-
- // allocate the RGB data array
-
- // use malloc(3) because wxImage will use free(3)
- agg::int8u *destBuffer = (agg::int8u *) malloc(
- sizeof(agg::int8u) * srcWidth * 3 * srcHeight);
-
- if (destBuffer == NULL)
- {
- if (deleteSrcBuffer)
- {
- delete [] srcBuffer;
- }
-
- throw Py::MemoryError(
- "_wxagg::convert_agg2image(): could not allocate `destBuffer'");
- }
-
- // convert from RGBA to RGB
- agg::rendering_buffer rbSource;
- rbSource.attach(srcBuffer, srcWidth, srcHeight, srcStride);
-
- agg::rendering_buffer rbDest;
- rbDest.attach(destBuffer, srcWidth, srcHeight, srcWidth*3);
-
- agg::color_conv(&rbDest, &rbSource, agg::color_conv_rgba32_to_rgb24());
-
- // Create a wxImage using the RGB data
- wxImage *image = new wxImage(srcWidth, srcHeight, destBuffer);
- if (image == NULL)
- {
- if (deleteSrcBuffer)
- {
- delete [] srcBuffer;
- }
-
- free(destBuffer);
- throw Py::MemoryError(
- "_wxagg::convert_agg2image(): could not allocate `image'");
- }
-
- if (deleteSrcBuffer)
- {
- delete [] srcBuffer;
- }
-
- return image;
-}
-
-
-static wxBitmap *convert_agg2bitmap(RendererAgg *aggRenderer, Py::Object clipbox)
-{
- // Convert everything: rgba => rgb -> image => bitmap
- // Convert a region: rgba => clipped rgba => rgb -> image => bitmap
- wxImage *image = convert_agg2image(aggRenderer, clipbox);
- wxBitmap *bitmap = new wxBitmap(*image);
-
- image->Destroy();
- delete image;
-
- if (bitmap == NULL)
- {
- throw Py::MemoryError(
- "_wxagg::convert_agg2bitmap(): could not allocate `bitmap'");
- }
-
- return bitmap;
-}
-
-
-//
-// Module Initialization
-//
-
-extern "C"
- DL_EXPORT(void)
- init_wxagg(void)
-{
- wxPyCoreAPI_IMPORT();
- //suppress an unused variable warning by creating _wxagg_module in two lines
- static _wxagg_module* _wxagg = NULL;
- _wxagg = new _wxagg_module;
-};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|