On Sun, 26 Jun 2005, James Graham wrote:

There's an irritating UI bug in the export dialog where entering a filename without the correct extension for the file type being exported causes the export to needlessly fail. Attached is a patch which automatically appends the correct extension to the file when one is not supplied. It should deal with the case of multiple extensions per type gracefully too (it will append the first known extension for the selected type). Note that there are other possible solutions to this problem (like passing a type name to the function that actually performs the export) but I think this is consistent with the save behavior and with user expectations for the common case (except, perhaps on the Mac which actually has a sane way of mapping files to applications).

Thanks for the patch, James. I've put it in with a couple of modifications. The main one is that if the user enters "foo.png", but "eps" is still selected, then a png is saved. I quite often forget to choose the appropriate type. If someone really wants to call their file foo.png.eps, then they can type it in full.

I've also used os.path.splitext for completeness, but that's pretty irrelevent.

Jeremy

--
Jeremy Sanders <[EMAIL PROTECTED]>
http://www.jeremysanders.net/                Cambridge, UK
Public Key Server PGP Key ID: E1AAE053

Répondre à