|
From: <jd...@us...> - 2008-06-22 16:15:26
|
Revision: 5631
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5631&view=rev
Author: jdh2358
Date: 2008-06-22 09:15:24 -0700 (Sun, 22 Jun 2008)
Log Message:
-----------
changed wx backend to respect extension over gui dialog default type
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py 2008-06-22 15:08:05 UTC (rev 5630)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py 2008-06-22 16:15:24 UTC (rev 5631)
@@ -94,7 +94,7 @@
cvs_id = '$Id$'
-import sys, os, os.path, math, StringIO
+import sys, os, os.path, math, StringIO, warnings
# Debugging settings here...
# Debug level set here. If the debug level is less than 5, information
@@ -1716,8 +1716,14 @@
filename = dlg.GetFilename()
DEBUG_MSG('Save file dir:%s name:%s' % (dirname, filename), 3, self)
format = exts[dlg.GetFilterIndex()]
- # Explicitly pass in the selected filetype to override the
- # actual extension if necessary
+ basename, ext = os.path.splitext(filename)
+ if ext.startswith('.'):
+ ext = ext[1:]
+ if ext in ('svg', 'pdf', 'ps', 'eps', 'png') and format!=ext:
+ #looks like they forgot to set the image type drop
+ #down, going with the extension.
+ warnings.warn('extension %s did not match the selected image type %s; going with %s'%(ext, format, ext), stacklevel=0)
+ format = ext
try:
self.canvas.print_figure(
os.path.join(dirname, filename), format=format)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|