02-07-2019, 09:17 PM
(This post was last modified: 02-07-2019, 09:23 PM by DougCoffland.)
(02-07-2019, 04:39 PM)Ofnuts Wrote: I don't really understand why you import gtk just to open a FileChooser.
If you want to create a file from the current image, then you define a file-export plugin. Gimp will then handle the file picker for you. Registration is a bit more complicated that your regular plugin but there are examples (for instance the file-openraster.py plugin that comes in Gimp 2.10).
Otherwise you can just as well make it an independent application and remove the dependency on Gimp. There are Python libraries to load images (PIL or its "pillow" derivative, among others).
(02-07-2019, 09:17 PM)DougCoffland Wrote:(02-07-2019, 04:39 PM)Ofnuts Wrote: I don't really understand why you import gtk just to open a FileChooser.
If you want to create a file from the current image, then you define a file-export plugin. Gimp will then handle the file picker for you. Registration is a bit more complicated that your regular plugin but there are examples (for instance the file-openraster.py plugin that comes in Gimp 2.10).
Otherwise you can just as well make it an independent application and remove the dependency on Gimp. There are Python libraries to load images (PIL or its "pillow" derivative, among others).
I used gtk because I couldn't figure out how to get the standard file chooser to warn the user that the file that was selected already exists and to ask the user if they want to replace it. If there is a way to configure the standard file chooser to do this, it would certainly make things simpler.
Do you have any suggestions on how to do this?