Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threading / Loops in Python Plugin
#11
(01-09-2024, 01:12 PM)JBreckeen Wrote: Thanks for the discussion.

I stepped away from this plugin for a bit - had to do some work.  I have gotten the "outbound" part of my integration working by having the Gimp plugin write a command .json and have my bridge script pick it up and do its thing.

But the issue I am having is trying to get the "looping" script to be able to execute an inbound command in Gimp.  The simple version would be that I want to have the Gimp plugin (running under Gimp's py2.7) constantly checking the command directory for a .json, and when it finds one it executes something such as

 pdb.gimp_file_save(image, drawable, savePath, savePath).




If I setup a static function that checks the directory once during the plugin load, it works.  But as soon as I put in checking loop (which is blocking of course), then Gimp will not continue the load.  So then I move the checking loop to a thread, but whenever I try to connect the threads, I get a crash.  I believe it comes from the two processes being in separate threads.



So what I really need is to have some way that the checking loop can execute the Gimp commands in Gimp's thread.



Hope that makes sense,





JBreckeen.

Looking at my code that runs in parallel with Gimp, the code doesn't use the simplified registration you have for Python-fu plugins with an auto-generated arguments dialog. It runs a registration "closer to the metal".
Reply


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

Forum Jump: