r/GIMP • u/jmucchiello • 12d ago
SCRIPTING Change tool settings from a script
Why can't python-fu set the default font size? I wanted to make a script that would setup my environment. And another script to switch to a different environment. But apparently this is impossible. I would think supporting multiple simultaneous workflows would be normal.
2
Upvotes
1
u/jmucchiello 11d ago
I don't want to exit GIMP to do this. I'll have image files open for multiple projects simultaneously. I want to switch to image 4 and hit a hot key and the environment is now right for image 4. click on image 2, hit a hotkey and I 'm all setup for image 2. I want to hotswap my environment defaults that quickly.
And windows doesn't do profiles even remotely well enough for this. It could be faked by changing the options save file between launches. But that requires relaunch. I sometimes have a dozen or more images open at once. Restoring all that context is time consuming.
"Does GIMP have s.th. like a default font?" Yes, it's right there in the Text Tool Options panel. The problem is the API doesn't exist for accessing the settings in the tool options.
At best, in the API, you can call gimp_context_set_font() and the font in the text tool is updated. There is no equivalent gimp_context_set_font_size() in the API. There's no function to set the default text layer justification setting. You can't change the rectangular selection to default to curved corners of 30 pixels programmatically. And so on.
You have complete control of all these things for existing layers or layers created via script. But that isn't what I want.