Re: [Gimp-user] Script-fu SF-FILENAME don't show the default setting

2007-09-03 Thread Pere Pujal i Carabantes
On Wed, 2007-08-29 at 01:17 +0200, Pere Pujal i Carabantes wrote:

> When using SF-FILENAME, if the file exist, the name of the file is
> shown
> in the button, but if the file does not exist, ie. has to be created,
> there is "(none)" in the button.
> 
> Is there a way to show the name on the button even if the file does
> not
> exist? 

After some try/error and a look at the code, it seems not. 

SF-Filename uses gtk_file_chooser_button, and acording to
http://library.gnome.org/devel/gtk/2.10/GtkFileChooserButton.html#id3631060
gtk_file_chooser_button only supports the GtkFileChooserActions
GTK_FILE_CHOOSER_ACTION_OPEN and GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
not the GTK_FILE_CHOOSER_ACTION_SAVE

GTK_FILE_CHOOSER_ACTION_OPEN Indicates open mode. The file chooser will
only let the user pick an existing file. 
GTK_FILE_CHOOSER_ACTION_SAVE Indicates save mode. The file chooser will
let the user pick an existing file, or type in a new filename.


So, if someone like I wants to write a nonexistent file, and this file
has to be selected by the user, the obvious solution is to use
SF-DIRNAME to get the directory and follow a SF-STRING to get the
filename.
After that, a (string-append dirname "/" filename) in the code gives the
full path.

Yours
Pere

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


[Gimp-user] Script-fu SF-FILENAME don't show the default setting

2007-08-28 Thread Pere Pujal i Carabantes
Hi all!



When using SF-FILENAME, if the file exist, the name of the file is shown
in the button, but if the file does not exist, ie. has to be created,
there is "(none)" in the button.

Can someone else reproduce?
Is there a way to show the name on the button even if the file does not
exist? 




To test install and run the script below, if you click on "OK" without
selecting a file, the string "nonexistentfile" is shown as a message.

If you select a existent file via the file selector, the name of the
file is show on the button and when click on "OK" the full path is
shown. (the desired behaviour)

If you select a non existent file via file selector (say type the
desired name on "Location:" and press "Open"),  "(none)" is shown on the
button, confusing as one can imagine that the selection has failed, but
when click on "OK" the full path is shown as desired.



The test script:

(define ( script-fu-test-filename
  filename)
  (gimp-message (string-append "Filename: " filename)))
( script-fu-register 
  "script-fu-test-filename"
  "/Script-Fu/Test/testfilename" 
  "Test for SF-FILENAME" 
  ""
  ""
  ""
  ""
  SF-FILENAME "Filename" "nonexistentfile"
  )



Gimp 2.4 RC1 linux Debian unstable


Thanks
Pere

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