It is currently Sun May 05, 2024 1:02 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 17 posts ] 
Author Message
 Post subject: Re: Can a Python Plug-in be called from Script-fu
PostPosted: Wed Oct 19, 2011 3:27 am  (#11) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Rod wrote:
Didn't Ofnuts fix that though?Seems to me that he did.


My impression was that you fixed your copy. It's still the same problematic version offered for download.


Top
 Post subject: Re: Can a Python Plug-in be called from Script-fu
PostPosted: Wed Oct 19, 2011 4:13 am  (#12) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
Rod wrote:
Didn't Ofnuts fix that though?Seems to me that he did.

I don't remember. The header of the version I have here says:
#   v0.2: 2011-05-22: Enhance error message to track mysterious '9' bug                                                               

Looking at the code, I just chnage the code I execute when I get an exception to print more detailed information. So the problem is acknowledged but likely not solved, because I didn't get significant feedback since...

_________________
Image


Top
 Post subject: Re: Can a Python Plug-in be called from Script-fu
PostPosted: Wed Oct 19, 2011 5:49 am  (#13) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
Some investigation leads me to believe that it is some external console message interception that does uncouth things with the I/O stream. So I removed most traces, and reorganized a bit the context save/restore so it should not damage the undo stack even if it crashes.

https://sourceforge.net/projects/gimp-t ... s/scripts/

_________________
Image


Top
 Post subject: Re: Can a Python Plug-in be called from Script-fu
PostPosted: Wed Oct 19, 2011 11:36 am  (#14) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
saulgoode wrote:
The only special case occurs when you wish to execute another script from your script. In other words, when your script calls a PDB procedure whose name starts with "script-fu-". When this happens, Script-fu is already running (executing your script) and so there is no need to "run the Script-fu plug-in with the name of the procedure to run".

That's the rub though, isn't it? If the interface to the interactive dialog can't be called while you already have a script running in the scheme interpreter, then the interface code lies outside the interpreter.

saulgoode wrote:
There is no need to specify the 'run mod' because the invoked procedure will be executed by the same Script-fu interpreter/plug-in as your script and using whatever run mode that Script-fu plug-in was already using.

I'm not following you here. If an invoked script-fu procedure inherits the run mode, wouldn't it run interactively when invoked from a script that was initially ran from a menu (interactively)? Seems it could never run interactively, if there were no interface available. So in other words, a script-fu script can't call another script-fu script in interactive mode, no matter how it was initially invoked, correct?

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Can a Python Plug-in be called from Script-fu
PostPosted: Wed Oct 19, 2011 12:26 pm  (#15) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
GnuTux wrote:
That's the rub though, isn't it? If the interface to the interactive dialog can't be called while you already have a script running in the scheme interpreter, then the interface code lies outside the interpreter.
:
:
I'm not following you here. If an invoked script-fu procedure inherits the run mode, wouldn't it run interactively when invoked from a script that was initially ran from a menu (interactively)? Seems it could never run interactively, if there were no interface available.

You are correct. It was a mistake for me to describe it as "inheriting". The run mode is taken care of before the script code is ever executed -- if interactive then the dialog is presented, the user's settings accepted, and then the script run non-interactively with those settings. The script code itself is in actuality always run non-interactively.

GnuTux wrote:
So in other words, a script-fu script can't call another script-fu script in interactive mode, no matter how it was initially invoked, correct?

Correct. It should also be mentioned that if a script wishes to call a plug-in using interactive mode, it should not typically use RUN-INTERACTIVE, but instead should use SF-RUN-MODE. SF-RUN-MODE is a system variable that holds the initial run mode of the running script (how it was initially invoked). Even though the script is running in non-interactive mode (per the preceding discussion), it may have been invoked either non-interactively (from a menu, script, or plug-in) or interactively (from a menu or plug-in). If it has been invoked non-interactively then it should not be having plug-in dialogs popping up asking for user input; this should only occur if the script has been invoked interactively (the Difference Clouds script provides a suitable example of this).

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Can a Python Plug-in be called from Script-fu
PostPosted: Wed Oct 19, 2011 9:12 pm  (#16) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
Well, I guess the only option is to create the input dialogs in python-fu and call our script-fu scripts (or vise versa), as Graechan is looking to do. Sounds messy. Either that or modify the script-fu interface to allow more options on the screen.

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Can a Python Plug-in be called from Script-fu
PostPosted: Wed Oct 19, 2011 9:31 pm  (#17) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
This worked fine in windows.

(python-fu-random-ellipse RUN-NONINTERACTIVE image bkg-layer 50 1 50 5 50 5 45 5)

All I need is to replace the numeric values I want to make variable with a string and enter in my menu.

Image

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
Post new topic Reply to topic  [ 17 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Curve Bend tool called from python giving error not very consistent.

0

No new posts use in python of plug-in lighting

4

No new posts Attachment(s) GIMP Python-Fu Plug-in template

4

No new posts GIMP 2.10 doesn't install my python plug-ins

1

No new posts Plug-in crashes after OS upgrade: python version mismatch? maybe?

4



* Login  



Powered by phpBB3 © phpBB Group