Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to develop python plugins after Gimp 2.10.22 ?
#1
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.
Reply
#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
#3
(09-12-2021, 04:14 PM)programmer_ceds Wrote: gimpfu still works in GIMP V2.10.26

There is no longer a gimp-python package in the repositories. I'm on Debian 11 and I get the message " No module named 'gimpfu' " when trying to start Gimp with my plugin.
I don't see any package that looks like a replacement in the repositories.

(09-12-2021, 04:14 PM)programmer_ceds Wrote: The 'fun' starts when you try to migrate Python scripts to GIMP V2.99.

To be more precise, I want to develop "up-to-date" but also "stable". I will upgrade to 2.99 or 3.0 when it has an official release.
Reply
#4
Quote:There is no longer a gimp-python package in the repositories. I'm on Debian 11 and I get the message " No module named 'gimpfu' " when trying to start Gimp with my plugin.
I don't see any package that looks like a replacement in the repositories.

It is possible, but a bit-of-a-pain locating dependencies. This a demo of the installation in Debian 11 duration 3' 40" no audio https://youtu.be/-8OWDWD5QDA

let me know if you want the .deb packages
Reply
#5
Thanks but again : "no legacy stuff". This is python2. The release notes say :

Quote:Python plug-ins have been ported to Python 3 and new GIMP 3 API (this work started over a year ago and is now finished

I'd like to know how to port my plugin to python 3 for the current stable release, if that's possible.
Reply
#6
The release notes say that the transition to Python 3 has been done for the development 2.99 branch, not the stable, 2.10 branch.
Reply
#7
(*′☉.̫☉) you are correct I misunderstood that.
So right now we're in a gap where neither the python2 nor the python3 api are "officially" provided. This isn't ideal but at least I understand the situation better now.
Reply
#8
(09-12-2021, 11:36 PM)ChameleonScales Wrote: (*′☉.̫☉) you are correct I misunderstood that.
So right now we're in a gap where neither the python2 nor the python3 api are "officially" provided. This isn't ideal but at least I understand the situation better now.

Python2 support is officially provided by Gimp. But it requires things that are no longer defaults in Linux distros (on Windows, the situation is different since Gimp comes with its own Python runtime).
Reply
#9
Thanks everyone. rich2005's video instructions worked great, although I also had to install python-is-python2 for it to work and it seems I have to keep it, otherwise Synaptic wants to remove all the previously installed deb packages.
Reply


Forum Jump: