RSS/Atom feed Twitter
Site is read-only, email is disabled

dynamic plugin menu

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

dynamic plugin menu Gena Batsyan 16 Feb 09:27
  dynamic plugin menu LightningIsMyName 16 Feb 13:11
   dynamic plugin menu Sven Neumann 16 Feb 13:27
    dynamic plugin menu Gena Batsyan 17 Feb 15:33
     201002171719.13607.tneuer@i... Torsten Neuer 17 Feb 17:19
   dynamic plugin menu Gena Batsyan 17 Feb 15:22
Gena Batsyan
2010-02-16 09:27:41 UTC (almost 15 years ago)

dynamic plugin menu

Hi!
I've been trying to find a way for a plugin to update menu entries it has initially registered from query() via gimp_install_procedure()

When the plugin is being run it wishes to update the menu entries, for instance putting some named presets previously selected in the plugin interface to be easily and directly accessible from the gimp menu without opening plugin interface again.

Is there a way to affect menu entries generated by a plugin after it's query() has been called?

I thought maybe using gimp_install_temp_proc instead of gimp_install_procedure would do the trick, but documentation says:

"A temporary procedure is a procedure which is only available while one of your plug-in's "real" procedures is running. "

What exactly does it mean "while my 'real' procedure is RUNNING"?

gimp_install_temp_proc does also accept the menu spec, so the procedure should also be available in menu, but at which times?

Kind regards

LightningIsMyName
2010-02-16 13:11:52 UTC (almost 15 years ago)

dynamic plugin menu

Hello Gena,

I tried to browse the source of the script-fu plugin to answer your question, and this is what I came up with:

"A temporary procedure is a procedure which is only available while one of your plug-in's "real" procedures is running. "

That is correct - If you will look at line 107 http://git.gnome.org/browse/gimp/tree/plug-ins/script-fu/script-fu.c#n107, you will see that the plugin is registerd as an extension and not as a regular GIMP plugin. On line 217 and 221, the plugin registers itself as an extension, and this way it allows itself to run from the moment gimp starts up, untill GIMP is exited. When registering an extension instead of a "normal" GIMP plugin, the run procedure will be called during GIMP's start-up, and the plugin will then be able to register temporary procedures (exactly like the Script-Fu scripts) that will be available untill GIMP exits.

Just to show you how the script-fu extension continues to run after it was intialized, look at the list of all the running procedures on your computer and you should see that as long as gimp is open, there is also a procedure called script-fu running.

After creating the temporary procedures with your extension, you can unregister them using gimp_uninstall_temp_proc, and the register them again inside another menu.
What I suggested is probably not the best way in the world, but it's the only way I can think of.

Hope this helps, ~ LightningIsMyName

On Tue, Feb 16, 2010 at 10:27 AM, Gena Batsyan wrote:

Hi!
I've been trying to find a way for a plugin to update menu entries it has initially registered from query() via gimp_install_procedure()

When the plugin is being run it wishes to update the menu entries, for instance putting some named presets previously selected in the plugin interface to be easily and directly accessible from the gimp menu without opening plugin interface again.

Is there a way to affect menu entries generated by a plugin after it's query() has been called?

I thought maybe using gimp_install_temp_proc instead of gimp_install_procedure would do the trick, but documentation says:

"A temporary procedure is a procedure which is only available while one of your plug-in's "real" procedures is running. "

What exactly does it mean "while my 'real' procedure is RUNNING"?

gimp_install_temp_proc does also accept the menu spec, so the procedure should also be available in menu, but at which times?

Kind regards

Sven Neumann
2010-02-16 13:27:18 UTC (almost 15 years ago)

dynamic plugin menu

Hi,

On Tue, 2010-02-16 at 14:11 +0200, LightningIsMyName wrote:

"A temporary procedure is a procedure which is only available while one of your plug-in's "real" procedures is running. "

That is correct - If you will look at line 107 http://git.gnome.org/browse/gimp/tree/plug-ins/script-fu/script-fu.c#n107, you will see that the plugin is registerd as an extension and not as a regular GIMP plugin. On line 217 and 221, the plugin registers itself as an extension, and this way it allows itself to run from the moment gimp starts up, untill GIMP is exited. When registering an extension instead of a "normal" GIMP plugin, the run procedure will be called during GIMP's start-up, and the plugin will then be able to register temporary procedures (exactly like the Script-Fu scripts) that will be available untill GIMP exits.

Just to make this clear. The point of being an extension is not being run at start-up. You can have that without making your plug-in an extension. The point of registering as an extension is that your plug-in will install temporary procedures. If you want to be called at every startup, you can get that simply by installing an init_proc handler in the GimpPlugInInfo struct.

I don't think though that the extension mechanism should be used for the purpose of being able to install changing menu procedures. It seems like quite some overkill to keep a plug-in process running just for this.

Sven

Gena Batsyan
2010-02-17 15:22:55 UTC (almost 15 years ago)

dynamic plugin menu

LightningIsMyName wrote:

Thanks a lot for your help!

With a just a little of refactoring I've managed to let the plugin be launched at startup as an extension, and handling procedures as temps. Works great and I could dynamically change the menu items after a procedure has been executed.

The only "problem" - the plugin has to be damn clean since it will live as long as gimp does.

Hello Gena,

I tried to browse the source of the script-fu plugin to answer your question, and this is what I came up with:

"A temporary procedure is a procedure which is only available while one of your plug-in's "real" procedures is running. "

That is correct - If you will look at line 107 http://git.gnome.org/browse/gimp/tree/plug-ins/script-fu/script-fu.c#n107, you will see that the plugin is registerd as an extension and not as a regular GIMP plugin. On line 217 and 221, the plugin registers itself as an extension, and this way it allows itself to run from the moment gimp starts up, untill GIMP is exited. When registering an extension instead of a "normal" GIMP plugin, the run procedure will be called during GIMP's start-up, and the plugin will then be able to register temporary procedures (exactly like the Script-Fu scripts) that will be available untill GIMP exits.

Just to show you how the script-fu extension continues to run after it was intialized, look at the list of all the running procedures on your computer and you should see that as long as gimp is open, there is also a procedure called script-fu running.

After creating the temporary procedures with your extension, you can unregister them using gimp_uninstall_temp_proc, and the register them again inside another menu.
What I suggested is probably not the best way in the world, but it's the only way I can think of.

Hope this helps, ~ LightningIsMyName

On Tue, Feb 16, 2010 at 10:27 AM, Gena Batsyan wrote:

Hi!
I've been trying to find a way for a plugin to update menu entries it has initially registered from query() via gimp_install_procedure()

When the plugin is being run it wishes to update the menu entries, for instance putting some named presets previously selected in the plugin interface to be easily and directly accessible from the gimp menu without opening plugin interface again.

Is there a way to affect menu entries generated by a plugin after it's query() has been called?

I thought maybe using gimp_install_temp_proc instead of gimp_install_procedure would do the trick, but documentation says:

"A temporary procedure is a procedure which is only available while one of your plug-in's "real" procedures is running. "

What exactly does it mean "while my 'real' procedure is RUNNING"?

gimp_install_temp_proc does also accept the menu spec, so the procedure should also be available in menu, but at which times?

Kind regards

Gena Batsyan
2010-02-17 15:33:23 UTC (almost 15 years ago)

dynamic plugin menu

Sven Neumann wrote:

Hi,

On Tue, 2010-02-16 at 14:11 +0200, LightningIsMyName wrote:

"A temporary procedure is a procedure which is only available while one of your plug-in's "real" procedures is running. "

That is correct - If you will look at line 107 http://git.gnome.org/browse/gimp/tree/plug-ins/script-fu/script-fu.c#n107, you will see that the plugin is registerd as an extension and not as a regular GIMP plugin. On line 217 and 221, the plugin registers itself as an extension, and this way it allows itself to run from the moment gimp starts up, untill GIMP is exited. When registering an extension instead of a "normal" GIMP plugin, the run procedure will be called during GIMP's start-up, and the plugin will then be able to register temporary procedures (exactly like the Script-Fu scripts) that will be available untill GIMP exits.

Just to make this clear. The point of being an extension is not being run at start-up. You can have that without making your plug-in an extension. The point of registering as an extension is that your plug-in will install temporary procedures. If you want to be called at every startup, you can get that simply by installing an init_proc handler in the GimpPlugInInfo struct.

I don't think though that the extension mechanism should be used for the purpose of being able to install changing menu procedures. It seems like quite some overkill to keep a plug-in process running just for this.

I agree, it's not very clean and is a waste of resources.

I'd gladly avoid this if there was a clean way for a plugin to modify it's menu without hanging all the time in memory as an extension.

For instance GIMP could introduce an internal procedure one could call from a plugin that would trigger plugin's query() again. I think this would be a nice non-intrusive add-on without the need to modify the API.

Anyone interested to add this functionality to the mainline?

Kind regards, Gena

Sven