[Gimp-user] A plug-in for those who still don't like the new Save/Export



Yet another thread about Save vs. Export this morning.
I guess it's time to post this.

Early on in the discussions, I posted something saying, basically,
  I don't like the new model either, but I'm going to work with it for
  a while and see if I continue to feel that way. But if I do, it's
  easy enough to write a plug-in that does what you want Save to
  do, perhaps involving gimp-file-save, and bind it to Ctrl-S.

Well, actually I've found it surprisingly easy to adapt to using
ctrl-E instead of ctrl-S. It's only a minor irritation that I have to
ignore the "you have unsaved images" when I quit (and that I can
no longer use it to tell me whether I *really* have unsaved images).

But obviously a lot of people on the mailing lists are having a lot
more trouble adapting. So yesterday I looked into the plug-in idea.
And found out it was trivial. Aside from registering the plug-in,
all you really need are two lines of Python:

    pdb.gimp_file_save(img, drawable, img.filename, img.filename)
    pdb.gimp_image_clean_all(img)

The first line saves the image back to its current filename.
(The gimp-file-save PDB call still handles all types, not just XCF.)
The second line marks the image as clean, so you don't see an
"unsaved image" warning when you quit. Since these are both
PDB calls, you could also do them in Script-Fu.

Of course, I couldn't just stop there -- I wanted it to handle
images that didn't have filenames yet. For those, I couldn't use the
standard GIMP save-as dialog, because as far as I can tell, there's
no way to call that dialog from a plug-in. So it uses the standard
GTK save-as dialog, and it starts in whatever directory is most
prevalent in your currently open images. The dialog part isn't
doable in Script-Fu, I don't think (which is why I used Python).

Anyway, the Python plug-in is available here:
https://github.com/akkana/gimp-plugins/blob/master/save-export-clean.py
It shows up as File->Save/Export clean.
Lousy name.  Feel free to suggest a better one.

Use at your own risk. I haven't tested it much. It WILL OVERWRITE
the image file, without any warnings or confirmation dialogs.
If you decide you like it, you can bind it to Ctrl-S.  Or whatever.

Now can we move on and talk about gegl graphs and improving
the brush UI? :-)

Alexandre Prokoudine writes (in response to the latest save-export thread):
By the way, what does it take to make you less sour a more
broad-minded and positive thinking? Would a mug of cocoa and a bun do
the trick, perhaps?

That sounds lovely, Alexandre. I think I'll go make some.

        ...Akkana



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]