On 14/06/14 17:54, SeldomNeedy wrote:
Debugging register function for registration of a python plugin under Windows XP

Hey, all.

I've started writing plugins in Python for GIMP but have so far only been able
to successfully register a plugin via the following form:

# in C:\Program Files\GIMP 2_8\lib\gimp\2.0\plug-ins
# synch-current-frame.py

def synch_current_frame(*args):
         # code

          N_("Adjust layers to the current animation-frame."),
          "June 2014",
          N_("_Synchronize Layers to Current Frame"),
          domain=("gimp20-python", gimp.locale_directory)

Changing the leading category from "<Toolbox>" to "<Image>" or "<Layer>" seems
to immediately break something and cause GIMP to skip over the script, as does
adding tuples to describe parameters to the first list.

I'm aware that Linux users can see what errors are raised by register during
startup but I'm not aware of how to do this with Windows. The Error Console and
builtin Python shell seem only to display errors from plugins that are able to
first load in correctly and show no record of what GIMP did while it was
loading. After I'm past that, things are straight-forward, but at present I have
no idea what I'm doing right or wrong as I register a function and currently
have to "pass" parameters to plugins in some awkward ways, unable to achieve
gimpfu registration with parameters. To avoid this, I need to debug the register
function's registration, which happens at startup, where errors are hidden.

How do I avoid flying blind on Windows (XP) with GIMP 2.8.8?

- Seldom

traceback (most recent call last):
  File "/home/me/.gimp-2.8/plug-ins/badone.py", line 7, in <module>
NameError: name 'register' is not defined

In practice you are missing "from gimpfu import *" at the beginning of the file.

Additionally, <Toolbox> is deprecated (since at least Gimp 2.6). you should be putting your menu entry in "<Image>" (the window displaying the current image), or in "<Layers>" (the right-click menu in the layers list), but the latter requires your plug-in to take image and drawable parameters.

Debugging Python plugins under Windows isn't too easy. I just made a small write-up on the subject:


gimp-user-list mailing list
List address:    gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list

Reply via email to