After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 372244 - Gimpshelf give stale/invalid defaults when parameter count changes
Gimpshelf give stale/invalid defaults when parameter count changes
Status: RESOLVED INVALID
Product: GIMP
Classification: Other
Component: Gimp-Python
2.0.x
Other Linux
: Normal normal
: ---
Assigned To: Manish Singh
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-07 22:48 UTC by t3rmin4t0r
Modified: 2006-11-08 21:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Quick patch for mangled keys for gimpshelf (1.19 KB, patch)
2006-11-08 13:44 UTC, t3rmin4t0r
none Details | Review

Description t3rmin4t0r 2006-11-07 22:48:47 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:

  • File "/usr/lib/gimp/2.0/python/gimpfu.py", line 400 in _interact
    def_val = defaults[i]
IndexError: list index out of range

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 !).
Comment 1 Sven Neumann 2006-11-08 07:42:53 UTC
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.
Comment 2 Michael Natterer 2006-11-08 09:57:04 UTC
(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)
Comment 3 t3rmin4t0r 2006-11-08 13:42:45 UTC
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.
Comment 4 t3rmin4t0r 2006-11-08 13:44:44 UTC
Created attachment 76206 [details] [review]
Quick patch for mangled keys for gimpshelf

Against gimpfu.py included in gimp-2.0.5-6 (centos/RHEL4)
Comment 5 Sven Neumann 2006-11-08 21:58:14 UTC
GIMP 2,0 is outdated, we don't take bug reports for it any longer.