You are here

Python plugin examples templates using gimpfu, for programmers

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!
AttachmentSize
plugin-examples.py.txt13.14 KB

This file contains examples, or templates, of registering plugins using gimpfu.register().
This is for GIMP Python programmers, not users.
When installed, this one file puts many (nine) demo plugins into GIMP.
The demo plugins don't do much except make an appearance.

These demonstrate various combinations of:
- where plugins appear (or not) in the menus (or elsewhere) in GIMP
- when the plugin's menu items are enabled (sensitive)
- what parameters a plugin_main() receives
- whether a plugin opens a GUI dialog for user to choose options (set parameters.)

For more information, read the file.

Code License: 
GIMP Version: 
Scripting Engine: 

Comments

Use with caution. I just noticed that sometimes this crashes Gimp. After a new installation of this plugin, it seems to run, but with an error message:
GIMP-Error: save handler "file-plugin8-load" does not take the standard save handler args
Then the next time you start Gimp, you get the same error message, then a segmentation fault and Gimp fails to start.

So you might be able to install it, use it once, then remove it. Or you can just read the file and not install it.

The bug might have something to do with plugin_8, the load_handler, so you might be able to excise that and it won't crash Gimp.

My best guess is that it is an obscure but inconsequential bug in Gimp itself. A Python script should not be able to crash Gimp, even if the script is not correct.

I fixed one of the bugs. It turns out if you pass a menu without a label, it crashes Gimp. The Gimp developers will fix it in future versions. For now, don't do that. And I fixed plugin-examples.py so it doesn't do that.

It still has a problem with plugin_8, a load_handler, but it doesn't crash.

I have read the file in one word: nice!
Only one remark can this be put in the documentation section under "gimpfu for programmers" or something lookalike?? I like to look only in one place for information about programming plugins/scripts not to search the registry.

Subscribe to Comments for "Python plugin examples templates using gimpfu, for programmers"