Re: [Gimp-user] Debugging register function for registration of a python plugin under Windows XP
- From: Ofnuts <ofnuts laposte net>
- To: gimp-user-list gnome org
- Subject: Re: [Gimp-user] Debugging register function for registration of a python plugin under Windows XP
- Date: Fri, 20 Jun 2014 12:18:44 +0200
On 15/06/14 23:45, SeldomNeedy wrote:
Obviously, normal fault-hunting can be done via gimp.pdb.message(someMessage)
once a plugin is successfully registered. Windows/Dockable dialogs/Error console
is obviously very helpful once an extension is up-and-running, HOWEVER I found
registration fairly trying and had a number of problems getting this to work
with basically no feedback about what I might be doing wrong. Ideally, getting
started should be the easiest part of the process, not the hardest. Thanks for
posting the guide. I'll definitely consider using that approach in future. I
came across an alternative which you may consider adding (though I haven't
compared the techniques for getting error-output so I don't know which one is
better).
Anyways, for the reference of other users developing GIMP Pythonfu plugins under
Windows, I'll repeat some information which I found very helpful when I was
searching. At the very top of the .py file, it's can be useful to do something
like:
import sys
sys.stderr = open("C:\\tmp\\errs.txt",'a')
This will cause the python environment to show some otherwise-hidden startup and
register-registration errors by outputting / printing them to the specified
location. The example I saw used mode 'a' to append errors, rather than
overwrite. Doing this allowed me to spot a mistake I was making.
In addition, one can also do
import sys
sys.stout = open("C:\\"tmp\\msgs.txt",'a')
if it's more convenient to receive output this way.
Additionally, Toolbox-prefix category is deprecated (since at least Gimp 2.6).
you
should be putting your menu entry in Image-prefix category (the window
displaying
the current image), or in Layers-prefix category (the right-click menu in the
layers list), but the latter requires your plug-in to take image and drawable
parameters.
Can you link to where this deprecation is publicly documented? The information
available on GIMP Python-fu is often out-of-date and extremely disparate, I've
found. Even http://www.gimp.org/docs/python/ is out of date in some respects, at
least comparing it stylistically to some examples I've seen here and elsewhere.
It would be helpful to know what calls are deprecated or now broken between
versions so users will have some idea of whether they're looking at an outdated
(and possibly broken or unreliable) way of doing things.
Your response also makes me wonder what of the other plugin-categories are (the
ones that get specified in angle brackets) still work, and what their
requirements are. An (outdated?) list of them I wrote down at some point went:
"Toolbox", "Image", "Layers", "Channels", "Vectors", "Colormap", "Load", "Save",
"Brushes", "Gradients", "Palettes", "Patterns" or "Buffers".
Thanks!
IIRC in 2.6 you got a "Location deprecated" message in the startup
messages (but of course you see this on Linux only :)). Anything you put
in <Toolbox> actually went to <Image>. In 2.8 you don't get the message
at all and the registration seems ignored.
Expect for <Image> (and, I think, <Load> and <Save>) all others correspond the menu of the dockable dialog of
the same name.
When the object is specific to an image (Layer/Channel/Path) the
registered function should take an image as the first parameter, and the
relevant object type as a second one. They are automatically filled with
the image and the object on which you right-clicked). Other menus don't
require any specific parameters.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]