Gimp3 python plugin with dependant choices

Hi, I’m porting a plugin that uses StableHorde to create images given a prompt.

I want to change the choice options from a given select that depends of the selection of another choice. Is it feasible? or maybe the amount of work is big enough that maybe it’s better to have different plugins?

In which case to avoid repeating a lot of code from them, is there a plugin that I can follow to look for insights on maybe inheriting classes or making some ordering on the code to avoid repeating myself? And thinking on making easy to distribute the code for the users?

The best solution is of course to do you own dialog, so you can control everything and dynamically change the dialog contents.

Otherwise, my usual solution is to have several menu entries that lead to different dialogs. To do this, it is easy to share code between plugins:

  • one plugin file, with one single plugin class, that will support several Gimp.Procedure
  • the do_query_procedures() returns a list of names (one for each dialog type)
  • the do_create_procedure() checks the name and creates the appropriate procedure
  • the procedures can call common code
1 Like

You can make certain options sensitive based on the values of another option:

You can see a code example with our screenshot plug-in enabling certain options: plug-ins/screenshot/screenshot.c · master · GNOME / GIMP · GitLab

1 Like

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.