[Gimp-developer] Creation of script-fu dialogs?

2009-11-30 Thread Rob Antonishen
I am trying to make a script-fu that provides different options
depending on whether other scripts are present.

I was trying to use this line in the register call:

SF-OPTION Grid Type (if (defined? 'script-fu-hex_grid) (list
Square Hex) (list Square))

and it sometimes works, but not always.

from the console, using

(if (defined? 'script-fu-hex_grid) (list Square Hex) (list Square)

will always work, returning the two item list if the function exists
and the single item list of it doesn't.

I'm guessing this is a startup thing, where the pdb menus are being
built as the scripts are loaded, so if the hex script is loaded first
then it will work, but if not it won't?

Any suggestion if I am wasting my time?  (I can just trap the
selection in the script, and pop a message box if they pick hex and
the script isn't installed...but that isn't as elegant.

Thanks,

-Rob A
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Creation of script-fu dialogs?

2009-11-30 Thread saulgoode
Quoting Rob Antonishen rob.antonis...@gmail.com:

 I'm guessing this is a startup thing, where the pdb menus are being
 built as the scripts are loaded, so if the hex script is loaded first
 then it will work, but if not it won't?

 Any suggestion if I am wasting my time?  (I can just trap the
 selection in the script, and pop a message box if they pick hex and
 the script isn't installed...but that isn't as elegant.

You can't guarantee the order with which scripts within a particular  
directory are loaded, but you can guarantee that a particular separate  
directory will be loaded before another directory.

So if you were place your hex_grid.scm script in  
~/.gimp-2.6/scripts/preload/ and add that folder to the TOP of the  
list of scripts folders in your Preferences (or prepend it to the  
'script-fu-path' argument in gimprc), you will guarantee that it will  
be loaded before the other scripts. (Alternately, you could place the  
script that requires hex_grid into a post-load directory which gets  
specified at the bottom of the list of script folders in Preferences.)

This is probably not of much help to you, though. :)

___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer