On Sat, 2010-02-27 at 14:35 -0500, lloyd konneker wrote:
> This is an enhancement request. Repeated calls to gimp_env_init should
> yield warnings and not fatal errors. It has benefits for gimp plugins
> written in Python.
> Currently gimp_env_init() calls g_error (fatal) if called a second time.
> Instead, pygimp_main(), which calls gimp_env_init(), should check
> whether this is a repeated call and issue a warning then return an
> error. (I'm not sure if any changes are needed for ScriptFu, whether
> Pygimp should check the return from gimp_main and raise a warning
> exception, etc.)
We would definitely have to change gimp_main() then as it must not be
called more than once. I have a bad feeling about doing this change.
> Currently, you can't import a plugin from another plugin unless the
> imported plugin guards the call to main() to prevent it from being
> called unless this is a top level invocation:
> if __name__=='__main__':
> It could be sufficient to have a convention for plugins to guard the
> call to main(), but the convention is not usually followed. Or you could
> have a convention that any shared code needs to be in a separate module
> from the top plugin module, but again, that convention is not often
> If you could import a plugin from within a Gimp plugin, then you could
> share more code. You could use classes etc. from imported plugins. You
> could also invoke the imported plugin's top function without invoking it
> as a registered PDB procedure. Neither reason is compelling.
Importing a plug-in from within a GIMP plug-in only makes sense for
Python. So I would suggest that we seek for a solution that only
involves changes to the GIMP Python bindings but does not require a
change to libgimp or libgimpbase. I haven't looked at the code, but it
should be possible to deal with this in pygimp_main().
Gimp-developer mailing list