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

Documentation about menu hooks

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.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Documentation about menu hooks bart@neeneenee.de 01 Sep 22:15
  Documentation about menu hooks Akkana Peck 03 Sep 23:32
   Documentation about menu hooks scl 06 Sep 19:10
bart@neeneenee.de
2013-09-01 22:15:14 UTC (about 11 years ago)

Documentation about menu hooks

Dear developers,

is there a documentation about menu hooks in GIMP? Is there a listing at the source code?

I tired to try out how to get my python plugins in the right place. So i'd like to do
a visual documentation for any developer. I attached an example on this mail.

This could be later published on gimp.org.

Cheers Eckhard.

Akkana Peck
2013-09-03 23:32:55 UTC (about 11 years ago)

Documentation about menu hooks

bart@neeneenee.de writes:

is there a documentation about menu hooks in GIMP? Is there a listing at the source code?

I tired to try out how to get my python plugins in the right place. So i'd like to do
a visual documentation for any developer. I attached an example on this mail.

I don't think I've seen formal documentation, but if you look in the source, in the menus/ subdirectory are all the menu definitions in XML.

For hooks I think you're talking about pseudo-submenus like "/File/Save/", where Save/ isn't an actual menu item, just a place in the menus where you'd want to group all the actions related to saving. In image-menu.xml I see things like , and so forth.
So if you take all the " menus/*.xml

Does that help?

...Akkana

scl
2013-09-06 19:10:00 UTC (about 11 years ago)

Documentation about menu hooks

Hi,

Akkana already wrote about the most important part, the file image_menu.xml.in. I'd like to add some things that might be interesting, too:

1. Positions: - If you register a script in a menu, i.e. /File, it is appended at the end of this menu. - If you register a script in a placeholder, i.e. /Filter/Light and Shadow/Glass, it is also appended at its end.
- Registering a script in will append it at the end of the menubar, that is after the Help menu. - Registering a script in /File will append it at the end of the File menu, after the items registered at /File.
However, registrations at shouldn't happen anymore as this is deprecated. Register at instead. Menus can be subdivided with separators. For instance see the main menus and Filters/Light and Shadow. Within every group of menu items are sorted alphabetically and they are grayed-out if no images are open. Plug-ins you registered yourself break these two rules.

2. Time of registration: Registration is triggered on GIMPs initialization and if you call Filters/Script-Fu/Refresh Scripts. If you want to look into the code, the function gimp_plugin_manager_restore in gimp_plugin_manager_restore is the place to look at. It is called from the after-'restore' signal callback function in /app/core/gimp. Looking how the signals 'initialize' and 'restore' are handled will give more insights if you are interested in that.

3. Conflicts: First come, first serve: if two scripts register functions with the same name only the last registration gets a menu item. The registrations before get lost, but only halfway: all their positions are replaced with the last registered plug-in, even if it never registered there (IMHO this is a bug).

If somebody knows more additions are welcome.

> > I tired to try out how to get my python plugins in the right place. So > i'd like to do
> a visual documentation for any developer.

+1.

> I attached an example on this mail.

... which was unfortunately cut off. Please don't attach images to the mailing lists, because the lists areread by ca. 1000 people each and not everyone of them likes his postbox filled with images without prior request You will have success if you upload your image to a hoster and post the link here.

>
> This could be later published on gimp.org.

... and/or the devel-docs folder or the wiki.

Thanks for your suggestion.

Kind regards,

Sven