Run-Mode & Enums
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
Run-Mode & Enums | Pablo Yaggi | 18 Dec 13:27 |
Run-Mode & Enums | Rob Antonishen | 18 Dec 15:19 |
Run-Mode & Enums | Pablo Yaggi | 18 Dec 16:35 |
Run-Mode & Enums | Rob Antonishen | 18 Dec 17:10 |
Run-Mode & Enums | saulgoode@flashingtwelve.brickfilms.com | 18 Dec 20:43 |
Run-Mode & Enums | Rob Antonishen | 18 Dec 21:01 |
Run-Mode & Enums | Pablo Yaggi | 19 Dec 05:55 |
Run-Mode & Enums | David Gowers | 19 Dec 11:38 |
Run-Mode & Enums | Pablo Yaggi | 19 Dec 13:09 |
Run-Mode & Enums | David Gowers | 19 Dec 14:32 |
Run-Mode & Enums | Pablo Yaggi | 19 Dec 15:09 |
Run-Mode & Enums
Hi,
In the scrupt-fu browser under parameters most of the scripts even my own show as first parameter:
run-mode INT32 Interactive,non-interactive
but it can not be specified in call nor used inside the script as is was implicit declared. Why is it there ? what does it mean ?
About Enums, I still can't find a way to
declare de enums. I need to use SF-ENUM
and present the user a combo with a list
of modes, but I don't know how to define
the enums to include in SF-ENUM.
Also I'm learning what available functions
I have (like if, cond, etc) reading other scripts,
I couldn't find any documentation out there,
is there any ?
Best Regards
Pablo
Run-Mode & Enums
If you specify RUN-NONINTERACTIVE it will run without the dialog box appearing.
On 12/18/08, Pablo Yaggi wrote:
Hi,
In the scrupt-fu browser under parameters most of the scripts even my own show as first parameter:
run-mode INT32 Interactive,non-interactive
but it can not be specified in call nor used inside the script as is was implicit declared. Why is it there ? what does it mean ?
About Enums, I still can't find a way to declare de enums. I need to use SF-ENUM and present the user a combo with a list of modes, but I don't know how to define the enums to include in SF-ENUM.
Also I'm learning what available functions I have (like if, cond, etc) reading other scripts, I couldn't find any documentation out there, is there any ?Best Regards
Pablo
Run-Mode & Enums
But I try to call my own script with the RUN-NONINTERACTIVE argument and it complains about the argument list, if i remove it, it works just fine, then when i use my script with the parameters i declared in the define everything goes perfect but adding the parameter run-mode as it gets listed in the browser help then it fails.
On Thursday 18 December 2008 12:19:31 Rob Antonishen wrote:
If you specify RUN-NONINTERACTIVE it will run without the dialog box appearing.
On 12/18/08, Pablo Yaggi wrote:
Hi,
In the scrupt-fu browser under parameters most of the scripts even my own show as first parameter:
run-mode INT32 Interactive,non-interactive
but it can not be specified in call nor used inside the script as is was implicit declared. Why is it there ? what does it mean ?
About Enums, I still can't find a way to declare de enums. I need to use SF-ENUM and present the user a combo with a list of modes, but I don't know how to define the enums to include in SF-ENUM.
Also I'm learning what available functions I have (like if, cond, etc) reading other scripts, I couldn't find any documentation out there, is there any ?Best Regards
Pablo
Run-Mode & Enums
I just checked and you are correct that when calling your own scripts you must leave out that parameter for it to work even though the pdb browser shows it.
-Rob A>
On 12/18/08, Pablo Yaggi wrote:
But I try to call my own script with the RUN-NONINTERACTIVE argument and it complains about the argument list, if i remove it, it works just fine, then when i use my script with the parameters i declared in the define everything goes perfect but adding the parameter run-mode as it gets listed in the browser help then it fails.
On Thursday 18 December 2008 12:19:31 Rob Antonishen wrote:
If you specify RUN-NONINTERACTIVE it will run without the dialog box appearing.
On 12/18/08, Pablo Yaggi wrote:
Hi,
In the scrupt-fu browser under parameters most of the scripts even my own show as first parameter:
run-mode INT32 Interactive,non-interactive
but it can not be specified in call nor used inside the script as is was implicit declared. Why is it there ? what does it mean ?
About Enums, I still can't find a way to declare de enums. I need to use SF-ENUM and present the user a combo with a list of modes, but I don't know how to define the enums to include in SF-ENUM.
Also I'm learning what available functions I have (like if, cond, etc) reading other scripts, I couldn't find any documentation out there, is there any ?Best Regards
Pablo
Run-Mode & Enums
Quoting Pablo Yaggi :
But I try to call my own script with the RUN-NONINTERACTIVE argument and it complains about the argument list, if i remove it, it works just fine, then when i use my script with the parameters i declared in the define everything goes perfect but adding the parameter run-mode as it gets listed in the browser help then it fails.
A Script-fu called by another Script-fu can not be run interactively, therefore a 'run-mode' of RUN-NONINTERACTIVE is assumed. Unfortunately, this means that when writing your script, you must know whether the PDB function is providing a "plug-in" or a "script-fu".
Run-Mode & Enums
So a python script can can a script-fu interactively?
Rob A>
On 12/18/08, saulgoode@flashingtwelve.brickfilms.com wrote:
Quoting Pablo Yaggi :
But I try to call my own script with the RUN-NONINTERACTIVE argument and it complains about the argument list, if i remove it, it works just fine, then when i use my script with the parameters i declared in the define everything goes perfect but adding the parameter run-mode as it gets listed in the browser help then it fails.
A Script-fu called by another Script-fu can not be run interactively, therefore a 'run-mode' of RUN-NONINTERACTIVE is assumed. Unfortunately, this means that when writing your script, you must know whether the PDB function is providing a "plug-in" or a "script-fu".
Run-Mode & Enums
So, there will be no case of somebody passing the RUN-(NON)INTERACTIVE parameter to my script, will be ? If that is the case, why the pdb browser is showing as the first parameter to my scrypt the run-mode, isn't it confusing ? Shouldn't the pdb browser hide that for scripts-fu ?
About the enums, any ideas ? I want to upload 3 plugins I made but it is not nice to pass options as numeric mode selector, sorry to annoy with this ...
Bests, Pablo
On Thursday 18 December 2008 17:43:24 saulgoode@flashingtwelve.brickfilms.com wrote:
Quoting Pablo Yaggi :
But I try to call my own script with the RUN-NONINTERACTIVE argument and it complains about the argument list, if i remove it, it works just fine, then when i use my script with the parameters i declared in the define everything goes perfect but adding the parameter run-mode as it gets listed in the browser help then it fails.
A Script-fu called by another Script-fu can not be run interactively, therefore a 'run-mode' of RUN-NONINTERACTIVE is assumed. Unfortunately, this means that when writing your script, you must know whether the PDB function is providing a "plug-in" or a "script-fu".
Run-Mode & Enums
On Fri, Dec 19, 2008 at 3:25 PM, Pablo Yaggi wrote:
So, there will be no case of somebody passing the
RUN-(NON)INTERACTIVE parameter to my script, will be ?
If that is the case, why the pdb browser is showing as the
first parameter to my scrypt the run-mode, isn't it confusing ?
Shouldn't the pdb browser hide that for scripts-fu ?
Script-fu has no special status, it's just an extension to gimp In fact, Gimp-Python has been the standard recommended language interface for quite a while now.
Python scripts or C plugins can call your script NONINTERACTIVE or INTERACTIVE It's simply that script-fu automatically fills in the run_mode, and provides no way for you to change it.
in Python, you can call interactively like this
pdb.script_fu_something (image, drawable, (more parameters...), run_mode = 0)
for example.
David.
Run-Mode & Enums
Script-fu has no special status, it's just an extension to gimp In fact, Gimp-Python has been the standard recommended language interface for quite a while now.
Will it be deprecated some time soon ? Gimp-python is packed as an optional package in mi distro (mandriva) besides you need python installed, script-fu is supported in the gimp core, that sounds like python being the extension, don't you think ?
Python scripts or C plugins can call your script NONINTERACTIVE or INTERACTIVE It's simply that script-fu automatically fills in the run_mode, and provides no way for you to change it.
I think that is not strictly the case, because run_mode is not available inside the script, and in the pdb-browser is shown as the first argument so it will be no valid for python either, if the order of your example parameters is correct. Also the pdb-browser its a helper for the console (it launches from there), but entering commands in the console prompt like it shows, in many cases (when calling other scripts) you get errors.
Bests,
Pablo
Run-Mode & Enums
On Fri, Dec 19, 2008 at 10:39 PM, Pablo Yaggi wrote:
Script-fu has no special status, it's just an extension to gimp
In fact, Gimp-Python has been the standard recommended language interface
for quite a while now.
Will it be deprecated some time soon ?
No, Script-Fu will not be deprecated soon. Though it's less powerful than Gimp-Python, it is more secure than Gimp-Python, and people have lots of Script-Fu scripts.
Gimp-python is packed as an optional package in mi distro (mandriva) besides
you need python installed, script-fu is supported in the gimp core, that
sounds like python being the extension, don't you think ?
No, extension is an actual idea GIMP recognises, you can find it in
the plugin browser.
'Type' says 'extension' or 'plugin' or 'temp procedure'
Script-fu is supported in the gimp core in the same way that Gimp-Python is: Not at all.
They are both plugins. Script-fu is classified as an extension, Gimp-Python is classified as a plugin. Either can be removed from GIMP by deleting some files; I once removed script-fu because it filled my menus with items I did not have any use for. GIMP continued to work perfectly.
so it will be no valid for python either, if the order of your example parameters is correct. Also the pdb-browser its a helper
Speculating, and taking no action, only makes you look foolish.
This has been working for a long time. The PDB is a standard mechanism that doesn't care at all about Script-fu or any other plugin. I have tried it myself.
For example (commands that can be executed in Gimp-Python console):
# this calls script_fu_sphere non-interactively pdb.script_fu_sphere (10, 180, 1, (1,1,1), (1,0,0))
# this calls script_fu_sphere interactively, a window will pop-up. pdb.script_fu_sphere (10, 180, 1, (1,1,1), (1,0,0), run_mode = 0)
for the console (it launches from there)
No, it is not a helper for the script-fu console. It's a helper for plugin programming, which means *any* plugin, whether written in C, C++, Python, Script-Fu, Ruby, Perl, or Lua.
, but entering commands in the
console prompt like it shows, in many cases (when calling other scripts)
you get errors.
That is because of the inflexible behaviour of script-fu, and the fact that GIMP doesn't care about what it's plugins do, script-fu is not special, it's just an extension to GIMP, not a vital part of it.
The inability for script-fus to call other script-fus with control over run-mode is purely a design decision that the author of the Script-Fu extension made.
David
Run-Mode & Enums
Speculating, and taking no action, only makes you look foolish.
Sorry, I didn't take actions because I never used python, now I notice, from your example, in python you can pass and argument naming it, very nice ...
You were very clear, and my assumption of seeing script-fu as core instead a plugin lead me to wrong conclusions about what PDB-browser should do. Thank's a lot david, you were very helpful.
Best Regards Pablo