Thanks for the report.
As far as I can tell, this has been broken for a long time, at least since r3798 (September 2007). I just hacked at this and arrived at the same conclusion John did.
I have an interesting finding about consistency. For the use case you describe, on my machine at least Gtk, Wx and Tk don't add any extension, whereas Qt and Qt4 implicitly add an extension. In all cases, the matplotlib backend isn't doing anything to the filename -- it's just using the filename handed back from the file dialog. All of this is reasonable, unlike the problem in Fernando's original bug report. I suspect the differences are probably based on differences in HIGs. This wxWidgets bug suggests that not implicitly adding an extension is correct behavior for Gtk+.
Is it worth making this consistent between backends, or is it more important for each of the toolkits to feel native in their respective worlds. I'm leaning toward the latter -- mainly because it's less work
These are my versions. I wonder if different toolkit versions may also have different behavior in this regard.
Gtk+: gtk+: 2.10.9, glib: 2.16.1, pygtk: 2.10.4, pygobject: 2.13.1
Qt: Qt: 3.3.3, PyQt: 3.17.2
Qt4: Qt: 4.3.0, PyQt4: 4.2
Fernando Perez wrote:
Howdy. This is using Tk, svn build from just now:
In : plot([1,2])
Out: [<matplotlib.lines.Line2D object at 0x31262d0>]
In : savefig('foo')
# Then, click on the 'save' icon in the figure window, and simply type
'foo2' in the dialog. Result:
In : d foo*
-rw-r--r-- 1 fperez 35100 2009-04-15 10:02 foo2png.png
-rw-r--r-- 1 fperez 35100 2009-04-15 10:02 foo.png
The dialog, instead of adding '.png', is adding 'png.png' to the
filename. I'm pretty sure this used to work fine a while ago.
I don't know if the problem exists with all the backends. Wx at least
seems to manually add the .png extension in the right place...
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
Matplotlib-devel mailing list
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA