Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to develop python plugins after Gimp 2.10.22 ?
#2
(09-12-2021, 03:40 PM)ChameleonScales Wrote: Since Gimp 2.10.22, python2 has been replaced by python3, that's great!
But what has 'gimpfu' been replaced with ?
The release notes say :

Quote:The new way to make Python plug-ins is streamlined, following the same logics as for other supported languages


but it doesn't say what library should be called from python instead of gimpfu and all the documentation I found predates this change in Gimp.

To be clear I don't want to install any legacy stuff. I want to write proper up-to-date python code.

gimpfu still works in GIMP V2.10.26 and I thought that this would apply to any further 2.10 versions. The 'fun' starts when you try to migrate Python scripts to GIMP V2.99. The interface for Python scripts in the 2.99 versions has changed at least once already and may change again (according to GIMP developers). So far I have ported two Python scripts to run under V2.99.7 but am currently looking at what may be a bug in GIMP or the standard Python scripts that are shipped with GIMP. This problem only occurs when not running the script interactively. A segmentation fault occurs if the code calls the get_buffer function for a drawable. The work-around is to call GimpUi.init() in all paths of the script - not just the interactive path. I still have some investigation to do on this before (if necessary) reporting it.

Apart from that Python scripts have to go into sub-folders of your plug-ins folder. Name the sub-folders the same as the name of the script that it holds (less the .py extension).

If you download the latest V2.99 sources the Python plug-ins with which it ships are in folder ...gimp/plug-ins/python. Looking at what you find there is probably the closest thing to documentation on the subject.

Note that some of the scripts construct their own dialogs but some use a function call to do this based on the defined parameters for the script (I haven't tried this route yet).

Have fun and try not to pull out too much of your hair in the process :-)
Reply


Messages In This Thread
RE: How to develop python plugins after Gimp 2.10.22 ? - by programmer_ceds - 09-12-2021, 04:14 PM

Forum Jump: