Python plug-in error when no image - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Gimp 2.99 & Gimp 3.0 (https://www.gimp-forum.net/Forum-Gimp-2-99-Gimp-3-0) +--- Thread: Python plug-in error when no image (/Thread-Python-plug-in-error-when-no-image) |
Python plug-in error when no image - gasMask - 02-04-2024 Hi guys, So I'm on the road to develop a plug-in for GIMP 2.99.16, but I've just started out. I am taking baby steps and ran into this error at the get-go. What I want to achieve: I want the plug-in menu item to be enabled when there is no image opened. What I changed: procedure.set_image_types('*') <- Works. to: procedure.set_image_types('') # <- Broken. What happens is that the menu item becomes enabled, but when I start the plug-in, I get an error: "Procedure 'jb-plug-in-first-try' has been called with an invalid ID for argument 'image'. Most likely a plug-in is trying to work on an image that doesn't exist any longer." I am using the code found at: plug-in tutorial This code doesn't reference an image. Code: #!/usr/bin/env python3 On another matter, is there a way to refresh the plug-in, as in have GIMP reload it, so that I can edit code and not have to restart GIMP? Thank you all for your attention, Charles RE: Python plug-in error when no image - nelo - 02-04-2024 You don't have to reload or restart, unless you change stuff in what formerly was the registration. To start without an image check this answer here: https://discourse.gnome.org/t/gimp-2-99-how-to-write-python-plugin-that-doesnt-require-an-existing-open-image/12544 A first little tutorial is here: https://testing.docs.gimp.org/2.99/en/gimp-using-python-plug-in-tutorial.html RE: Python plug-in error when no image - gasMask - 02-04-2024 Thank you nelo. I found the solution. The correct way is to start the plug-in without an image is to call: procedure.set_sensitivity_mask(Gimp.ProcedureSensitivityMask.ALWAYS) Cheers, Charles |