I am trying to get gimp to use a reasonable default path in a "save as" plugin, and to do that I need to be able to specify the default with the return value of a function (I believe).
Currently, my code is something like:
def do_the_foo(image, __unused_drawable, directory):
# ... do something
register(
"python_fu_something",
"Blah de blah",
"Blah de blah",
"Blah de blah",
"Blah de blah",
"2013",
"<Image>/File/Save as blah...",
"*",
[
(PF_DIRNAME, "directory", "Directory to save files to", "/")
],
[],
do_the_foo
)
Naturally this means that the dialog pops up with "/" as the default directory. That's not ideal. I'd like it to start with the path to the currently loaded image if known and then fall back to "/" if the currently loaded image has no path (not saved, whatever).
But to get there I need to know how to replace "/" with a function. I've tried doing just that (create a function, reference it in the PF_DIRNAME line) but no joy (and no error message, either).