[Gimp-developer] Script-Fu error ... GUI shows different image selection than what script gets

2002-09-05 Thread Roland Roberts

I have a script-fu set up which has the following initialization:

(script-fu-register script-fu-astro-rescale-for-web
Toolbox/Xtns/Script-Fu/Astronomy/Scale for Web
Rescale current image to \standard\ sizes for web display
Roland B. Roberts [EMAIL PROTECTED]
Roland B. Roberts [EMAIL PROTECTED]
4 September 2002

SF-IMAGE Image 0
SF-VALUE Size List '(1600 1280 1024 800 640 320 160))

When the script is run by selecting it from the menu, an option list
is presented which shows the current (and only, in this case) as
selected.  If I simply hit Okay, I get the following error:

Script-Fu Error while executing (script-fu-astro-rescale-for-web 0 '(320))
ERROR: Procedural database executinog failed: (gimp_image_width 0)

The problem is that my image is *not* image 0.  It is image 5.  I
realize I have 0 as a default and most of the time that will probably
make sense.  But why is it showing me image 5 in the option list and
then not using it.  If I click on the option list and select the
only image showing, it works correctly.

Also, I tried evaluating (gimp-image-list) in the Script-Fu console
and there really is only one image; i.e., I don't have any invisible
ones hanging around.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



Re: [Gimp-developer] Script-Fu error ... GUI shows different image selection than what script gets

2002-09-05 Thread Simon Budig

Roland Roberts ([EMAIL PROTECTED]) wrote:
 I have a script-fu set up which has the following initialization:
[... The default value of SF_IMAGE gets returned even if there is just
 one image open ...]
 The problem is that my image is *not* image 0.  It is image 5.  I
 realize I have 0 as a default and most of the time that will probably
 make sense.  But why is it showing me image 5 in the option list and
 then not using it.  If I click on the option list and select the
 only image showing, it works correctly.

I can reproduce this behaviour and I think it is a bug.
If the user sees the entry to be correct he is likely to not click
on the image-option menu. However, the GUI will happily pass the default
value to the script.

To work around this: You could use an invalid image ID (for example -1)
as the default value. So you can easily check if this is a real image ID
or the default value. You could for example query (gimp-images-list) for
the ID of the image. But I think this behaviour should be fixed.

Another suggestion: You use SF_VALUE for the size of your images. It
most probably would be better to use 
   SF-OPTION Size List '(1600 1280 1024 ...))

you then get an integer 0,1,2 indicating the selected option. This could
be translated to the intended value by (nth index '(1600 1280 1024 ...)).

I will file a bugreport for the other issue.

Bye,
Simon
-- 
  [EMAIL PROTECTED]   http://www.home.unix-ag.org/simon/
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



Re: [Gimp-developer] Script-Fu error ... GUI shows different image selection than what script gets

2002-09-05 Thread Roland Roberts

 Simon == Simon Budig [EMAIL PROTECTED] writes:

Simon [...] There is no real concept of a active image. This is
Simon the primary reason, why there is no save entry in the
Simon toolbox menu.

Simon If you register your script in the context menu of the
Simon image (Image) you always get the image/drawable the user
Simon operates on as the first parameter.

Thanks.  This makes sense and, in fact, it really makes more sense to
put my script in either the image or file context menu since I want it
to both rescale and save the results.

roland
-- 
   PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
[EMAIL PROTECTED] 76-15 113th Street, Apt 3B
[EMAIL PROTECTED]   Forest Hills, NY 11375
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer