Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python-fu: add more user input dialogs?
#1
Apart from the dialog that you define in register() and the gimp.message command (which doesn't allow for any user input), I don't know if Gimp's api provides a way to pop a dialog to, say, ask for confirmation about something or provide other sliders, spinners, etc based on what you selected in the main plug'in's dialog.
Do we have to revert to other python libraries like zenity or GTK?
Reply
#2
There are no other dialogs available. You would have to create whatever extra you require, probably with GTK as that's all that's available cross-platform.

Also I'm currently unclear about whether the automatic dialog generation defined by the register() mechanism will continue to be available when GIMP 3.0 arrives - these may need to be built manually as well.
Reply
#3
(02-09-2021, 08:40 PM)ChameleonScales Wrote: Apart from the dialog that you define in register() and the gimp.message command (which doesn't allow for any user input), I don't know if Gimp's api provides a way to pop a dialog to, say, ask for confirmation about something or provide other sliders, spinners, etc based on what you selected in the main plug'in's dialog.
Do we have to revert to other python libraries like zenity or GTK?

You can build a whole dialog using PyGTK (recommended solution since it is available on all platforms that support Gimp with Python).

Personally, I wrote over a hundred Gimp scripts and never had to request confirmation, I just ensure that Ctrl-Z will allow the user to express regrets  about the result.  Given you recent post history I think such confirmation should be done before even calling Gimp.

Ergonomics-wise, using two successive dialogs is bad, if some initial choice leads to very different parameters, I use two menu entries leading to two different auto-generated dialogs.
Reply
#4
ok thanks. I'll use PyGTK. It would be a pity if that register dialog goes away in GIMP 3.0. It helps a lot to have an api that lets you make GUIS with ease and few lines of code.

Quote:I use two menu entries leading to two different auto-generated dialogs.

I was mostly thinking of a follow-up dialog for a confirmation like "File already exists, do you want to replace it?" Yes - No

But for adding GUI settings the best for me would be a dynamic dialog where if you check a box, some elements related to it could appear or if you uncheck, some elements get greyed out. It doesn't seem like the register( dialog lets you do any of that.

In any case I might make my python plug-in(s) from outside of Gimp so I should fiddle with GTK more, especially if the register( dialog will disappear.
Reply
#5
@Kevin, GIMP 3.0 will have the same feature of dialogs generation:
https://www.gimp.org/news/2020/12/25/gim...r-plug-ins
Reply
#6
Glad to hear it (◠⊿◠)
Reply


Forum Jump: