Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
updating documentation
#1
Hi there,
I sometimes bump into inconsistencies in the python script documentation (or things that look like so to me, I'm not at all an expert). 

Here is an example : the gimp_image_insert_layer's documentation displayed in the python procedure navigator is :

Quote:This procedure adds the specified layer to the image at the given position. If the specified parent is a valid layer group (See 'gimp-item-is-group' and 'gimp-layer-group-new') then the layer is added inside the group. If the parent is 0, the layer is added inside the main stack, outside of any group. The position argument specifies the location of the layer inside the stack (or the group, if a valid parent was supplied), starting from the top (0) and increasing. If the position is specified as -1 and the parent is specified as 0, then the layer is inserted above the active layer, or inside the group if the active layer is a layer group. The layer type must be compatible with the image base type.

But specifying 0 as parent returns an error
Code:
➤> img=gimp.image_list()[0]
➤> layer = pdb.gimp_layer_new(img, 100, 100, RGB_IMAGE, "layer", 100, 0)
➤> pdb.gimp_image_insert_layer(img, layer, 0, 0)
Traceback (most recent call last):
 File "<input>", line 1, in <module>
TypeError: wrong parameter type
➤>


after struggling a little, I found out that you should use None instead of 0
Code:
➤> img=gimp.image_list()[0]
➤> layer = pdb.gimp_layer_new(img, 100, 100, RGB_IMAGE, "layer", 100, 0)
➤> pdb.gimp_image_insert_layer(img, layer, None, 0)
➤> img.layers
[<gimp.Layer 'layer'>, <gimp.Layer 'Arrière-plan'>]
➤>
From my point of view, the documentation should be modified (correct me if I'm wrong).
It's not a bug as such, but maybe it would be useful to report it through the bug report procedure ?
Reply


Messages In This Thread
updating documentation - by jacques_duflos - 08-15-2023, 04:50 PM
RE: updating documentation - by Ofnuts - 08-15-2023, 07:39 PM
RE: updating documentation - by jacques_duflos - 08-15-2023, 09:51 PM
RE: updating documentation - by Rendu - 08-22-2023, 10:10 PM

Forum Jump: