It is currently Sat Jul 06, 2024 9:13 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Trigger Export dialog?
PostPosted: Fri Sep 04, 2020 2:49 am  (#1) 
Offline
GimpChat Member

Joined: Jul 02, 2018
Posts: 7
I've got a Python plugin that generates a new Gimp image.

I would now like the user to confirm the filename & save location first. Is there a recommended method?

I can automatically force export, but I would prefer to trigger the File → Export As dialog on the new image - is this possible?
pdb.gimp_file_save(image, drawable, "c:\\testa.bmp", "c:\\testa.bmp")


On v2.10.20-1 I tried using ...
filename = pdb.file_bmp_save(0, image, drawable, "c:\\testa.bmp")

but get errors like:
Procedure 'gimp-item-get-name' has been called with value '5' for argument 'item' (#1, type GimpItemID). This value is out of range.

Does the above code look correct? The pdb documention for file-*-save commands is a little cryptic!

gimp_export_dialog_new() documented in gimplib looks promising, but I can't figure out how to call it from Python.

Cheers,
moon


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Trigger Export dialog?
PostPosted: Fri Sep 04, 2020 11:34 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
The number of parameters does not match
pdb.file_bmp_save(image, drawable, "c:\\testa.bmp", "c:\\testa.bmp", run_mode=RUN_INTERACTIVE)


Attachments:
File bmp save Interactiwe.png
File bmp save Interactiwe.png [ 18.24 KiB | Viewed 2220 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: Trigger Export dialog?
PostPosted: Fri Sep 04, 2020 3:51 pm  (#3) 
Offline
GimpChat Member

Joined: Jul 02, 2018
Posts: 7
Thanks Marero.

Is this documented somewhere? Or is there a rule like "interactive always must be named parameter" or ???
I would never have figured this out!

After getting it working, I found that file_bmp_save command prompts for the bmp save options (Run-Length encoded, etc.) but doesn't prompt the user for filename.

Do you know if this is possible?


Top
 Post subject: Re: Trigger Export dialog?
PostPosted: Fri Sep 04, 2020 6:19 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Not in a simple way.
You can find a solution by looking for example at the Export Layers code:
https://github.com/khalim19/gimp-plugin-export-layers

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Trigger Export dialog?
PostPosted: Sat Sep 05, 2020 2:13 am  (#5) 
Offline
GimpChat Member

Joined: Jul 02, 2018
Posts: 7
Thanks again.
I'll use GTK I think!


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts How to tab to an open dialog, i.e. Scale Tool dialog?

1

No new posts Attachment(s) SCROLLING SCRIPT-FU dialog modification

9

No new posts Can't get my layers to show up in the RGB compose dialog

3

No new posts Attachment(s) Toolbox and Dialog Box for Layers/Paths/Channels, etc.

26

No new posts Invalid parameter name dialog status error

4



* Login  



Powered by phpBB3 © phpBB Group