> On Fri, May 29, 2009 at 3:59 PM, Ryan Krauss <ryanli...@gmail.com> wrote:
> > pdb.gimp_xcf_save(1, img, drawable, xcf_path, xcf_path)
> > pdb.gimp_file_save(img, drawable, xcf_path, xcf_path)

That leads into something I've been needing from Python:
I'd like a way of bringing up a Save-as or Export-as dialog
from a Python script. There's no API for this currently, as far
as I can tell. If I call pdb.gimp_file_save like this:

    pdb.gimp_file_save(img, newimg.active_layer, pathname, pathname,

it goes straight to the jpeg save dialog, or the png save dialog,
or whatever, skipping the dialog that would let the user change the
filename. I'd like to set the filename, but then give the user a
chance to change it and to see or change where it's being saved.

Would be be possible to add an API for this, or maybe an optional
argument in gimp_file_save and the corresponding _export function?
I can try to implement it and submit a patch, but I'd like to know
if such an API would be acceptable, and how you'd want it to look.
For instance, maybe

    pdb.gimp_file_save(img, newimg.active_layer, pathname, pathname,
                       run_mode=0, show_save_dialog=True)

Or, possibly, should the code be changed so that it always shows the
save-as dialog if run_mode is interactive? It would change the
behavior of existing scripts ... but only in the interactive case.

David Gowers writes:
> The recently introduced Export framework may end up simplifying your
> situation.. It considers a file 'clean' only when it has just been
> saved to XCF (or xcf.gz, etc) format, and introduces a separate
> 'Export' action for producing a 'rendered result' in eg. PNG format.

In the new framework, will gimp_file_save() fail if the filename isn't
xcf?  Will scripts need to be rewritten to call gimp_file_export
instead? If authors have to rewrite their scripts anyway, making a
small change to what run_mode=0 does at the same time might not be
much of a problem.

Gimp-developer mailing list

Reply via email to