Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threading / Loops in Python Plugin
#1
Hello all.

I have been using Gimp for work for a while now, but never got into building plugins for it - though I do code Python for other programs and plugins.  Sorry for this long post, but it is complicated (to me at least)

Want I am trying to do is to integrate Gimp into my graphics pipeline.  This entails making a plugin so that my outside pipeline software can communicate and execute some simple Gimp functions such as .xcf save and file export.  And inside Gimp, I would like my menu items to be able to execute functions in my pipeline software such as call other scripts.

I understand Gimp 2.10 uses Python 2.7, but I need to use Py3.9 for my external software .  I have managed to insert a menu and items into Gimp, and can get it to execute functions--uphill battle but woohoo!

The issue is I need the Gimp plugin to communicate with my pipeline.  So the first issue I have is the Py mismatch.  My solution was to use a bridge script, and it works statically.  Basically, Gimp loads the plugin, and the plugin launches the bridge script in a Py3.9 process and I am able to execute functions both ways.  But I need dynamic comms between the two.  I tried sockets but could not get that to work in Gimp.  So I then fell back to the old .json file, but I need a non-blocking way to check for the command file inside Gimp.  I then tried using a thread for the checking loop which works, but that thread cannot then execute anything in the main Gimp thread (at least that is where I am at).

So the question is:  can I get it so Gimp will have comms with an outside script?  Is there a way to have a thread launched under the Gimp plugin to be able to execute in the main Gimp thread?

Hopefully that makes sense, and I can provide code if needed.  I did not include it since it is not working anyway . . . 

Thanks in advance,

JBreckeen. Huh
Reply


Messages In This Thread
Threading / Loops in Python Plugin - by JBreckeen - 01-01-2024, 05:11 PM

Forum Jump: