This is mildly hackish, but my approach is to pop up a Tk save as dialog:

filetypes = [('png files', '*.png'), ('jpg files', '*.jpg'),\
             ('all files', '.*')]


def save_as(initialdir=None, initialfile=None):
    filename = tkFileDialog.asksaveasfilename(initialdir=initialdir, \
                                              initialfile=initialfile, \
                                              filetypes=filetypes)
    return filename

It would prettier to do a wxPython gtk one, but that requires a parent frame
AFAIK.

FWIW,

Ryan

On Fri, May 29, 2009 at 12:18 PM, Akkana Peck <akk...@shallowsky.com> wrote:

> Martin Nordholts writes:
> > IMO we should not reuse gimp_file_save() for this but instead introduce
> > gimp_show_save_dialog() and gimp_show_export_dialog(). I am a bit
> > worried however that plug-ins will abuse this power. In your case, why
> > do you need to show these dialogs? Isn't it better if the user has to go
> > through a single place to save or export?
>
> I need to show the dialogs because the plug-in needs to save a
> file (that's the whole point of the plug-in) and it seems like
> bad UI to pop up the JPEG save dialog without ever showing the
> user where the file is being saved, or offering them a chance
> to save it somewhere else. (Have you ever been frustrated when
> Firefox downloaded a file and you can't figure out where it ended up?)
> Seems like it's always better UI to go through this step, so the
> user knows what is being saved and where.
>
> Of course, this being python, I could put up my own save-as
> dialog and let the user choose the filename that way, then call
> gimp_file_save() on the result; but I'd rather go through GIMP's
> standard framework, with the File Type menu and other nice features.
>
>        ...Akkana
> _______________________________________________
> Gimp-developer mailing list
> Gimp-developer@lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
>
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to