GNOME Bugzilla – Bug 372244
Gimpshelf give stale/invalid defaults when parameter count changes
Last modified: 2006-11-08 21:58:14 UTC
While live-editing a gimp python script, the gimpshelf gets in the way of adding new parameters. To reproduce: ------------- create a gimp python script with the following in the register call [ (PF_FILE, "watermark", "Watermark image:", "watermark.png"), (PF_RADIO, "position", "Position:", 'rb', \ (("Left Top","lt"), ("Right Top", "rt"), \ ("Left Bottom", "lb"), ("Right Bottom", "rb"))), ] Run the script from gimp with valid values (ensure _set_defaults was called with two values in the defaults list). Without restarting gimp, add a PF_SLIDER entry with defaults, re-run the script. See error:
+ Trace 84173
def_val = defaults[i]
To fix: ------- Please use function signature (param types + count) in the key used in gimpshelf, so that stale entries aren't picked up in _get_defaults. Thank you (and gimp-py really rocks !).
Changing the signature of a PDB function at runtime is not supported by GIMP. That's not a Python problem, but a missing feature in GIMP. It might be possible to change this at some point, but definitely not before 2.4. Closing as INVALID.
(Actually, it is possible. Just register the same function again. Note that this is completely untested and I don't know if anybody ever used this "feature". We make no guarantees, esp. not about fixing anything here for 2.4, but feel free to add comments to this bug to let us know whether it works or not)
While working on gimp scripts, I've always edited them without restarting gimp and till I run it the first time with values (i.e press cancel the first time), updates to pdb params are reflected in the UI. And commenting out the gimpshelf code in _get_defaults makes the error go away as well. Attaching a possible patch - at least, it works for me.
Created attachment 76206 [details] [review] Quick patch for mangled keys for gimpshelf Against gimpfu.py included in gimp-2.0.5-6 (centos/RHEL4)
GIMP 2,0 is outdated, we don't take bug reports for it any longer.