From: <jd...@us...> - 2008-06-02 17:13:09
|
Revision: 5361 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5361&view=rev Author: jdh2358 Date: 2008-06-02 10:13:01 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Merged revisions 5360 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r5360 | jdh2358 | 2008-06-02 10:06:41 -0500 (Mon, 02 Jun 2008) | 1 line added switch_backend bugfix from sf patch 1979402 ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/pyplot.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-5334 + /branches/v0_91_maint:1-5360 Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2008-06-02 15:06:41 UTC (rev 5360) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2008-06-02 17:13:01 UTC (rev 5361) @@ -740,7 +740,7 @@ or matplotlib.backends is imported for the first time. """ -def use(arg): +def use(arg, warn=True): """ Set the matplotlib backend to one of the known backends. @@ -752,12 +752,17 @@ will specify a default of pdf output generated by Cairo. - Note: this function must be called *before* importing pylab - for the first time; or, if you are not using pylab, it must - be called before importing matplotlib.backends. + Note: this function must be called *before* importing pylab for + the first time; or, if you are not using pylab, it must be called + before importing matplotlib.backends. If warn is True, a warning + is issued if you try and callthis after pylab or pyplot have been + loaded. In certain black magic use cases, eg + pyplot.switch_backends, we are doing the reloading necessary to + make the backend switch work (in some cases, eg pure image + backends) so one can set warn=False to supporess the warnings """ if 'matplotlib.backends' in sys.modules: - warnings.warn(_use_error_msg) + if warn: warnings.warn(_use_error_msg) be_parts = arg.split('.') name = validate_backend(be_parts[0]) rcParams['backend'] = name Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-06-02 15:06:41 UTC (rev 5360) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-06-02 17:13:01 UTC (rev 5361) @@ -52,12 +52,12 @@ """ close('all') global new_figure_manager, draw_if_interactive, show - matplotlib.use(newbackend) - reload(backends) - from backends import new_figure_manager, draw_if_interactive, show + matplotlib.use(newbackend, warn=False) + reload(matplotlib.backends) + from matplotlib.backends import pylab_setup + new_figure_manager, draw_if_interactive, show = pylab_setup() - def isinteractive(): """ Return the interactive status This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |