Python Fu - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Python Fu (/Thread-Python-Fu) |
Python Fu - DoggoOfSpeed - 06-07-2023 Tried to create my first script to save all open files and while it works, I've encountered a strange issue. Code: #!/usr/bin/env python RE: Python Fu - programmer_ceds - 06-07-2023 (06-07-2023, 12:03 PM)DoggoOfSpeed Wrote: Tried to create my first script to save all open files and while it works, I've encountered a strange issue.I think that the first two arguments to save_all() should be image and layer, then your dialog arguments (from PF_OPTION and PF_DIRNAME) follow. RE: Python Fu - DoggoOfSpeed - 06-07-2023 (06-07-2023, 04:35 PM)programmer_ceds Wrote: I think that the first two arguments to save_all() should be image and layer, then your dialog arguments (from PF_OPTION and PF_DIRNAME) follow. Yeah, that's pretty much what I found out as well... To be honest all is fine as I got it to work, but I'm just interested what causes this behavior as the script I took inspiration from (Github link) was able to proceed with just the two arguments for some reason. I wonder what is the difference causing this. Also, sorry for the non-descriptive title :/ RE: Python Fu - Ofnuts - 06-07-2023 This is because you are using the "old style" registration model (where the 7th arg is the complete menu path). Code: register( In the new style, the 7th arg is only the menu item label, and there is an additional keyword argument menu= that specifies the menu hierarchy: Code: register( and when you use it, the image/drawable parameters are no longer implicit, and must be specified. But they are set automatically from current Image/drawable and are not shown in the parameter dialog when Gimp can figure them out. |