ofnuts wrote:
There is no real way to implement "logic" in the gimpfu dialogs. One way to do it is to have your main choice as two different menu entries leading to two different dialogs (you can register several menu entries). For instance if you have an some hypothetic "fill" plugin that can use either a pattern or a gradient, have the user make that choice by selecting in the menu either "Fill with gradient" or "Fill with pattern". Then each dialog can have specific widgets, while everything ends up processed by the same code.
OK, so my sample code, for example, might be:
#!/usr/bin/env python
from gimpfu import *
def test_register_A(test_A):
pass
def test_register_B(test_B):
pass
register(
"test_register_A", # proc_name The name of the command that you can call from the command line or from scripting
"", # blurb Information about the plug-in that displays in the procedure browser
"", # help Help for the plug-in
"", # author The plug-in's author
"", # copyright The copyright holder for the plug-in (usually the same as the author)
"", # date The copyright date
"Test Register", # label "<Image>/Image/Plug_In_A" The label that the plug-in uses in the menu
"", # imagetypes "RGB*, GRAY*" The types of images the plug-in is made to handle
[
(PF_INT, "test_A", "THIS IS A TEST A", 500)
], # params The parameters for the plug-in's method
[], # results The results of the plug-in's method
test_register_A, # function The name of the method to call in your Python code
menu="<Image>/MyScripts" #
)
register(
"test_register_B", # proc_name The name of the command that you can call from the command line or from scripting
"", # blurb Information about the plug-in that displays in the procedure browser
"", # help Help for the plug-in
"", # author The plug-in's author
"", # copyright The copyright holder for the plug-in (usually the same as the author)
"", # date The copyright date
"Test Register", # label "<Image>/Image/Plug_In_B" The label that the plug-in uses in the menu
"", # imagetypes "RGB*, GRAY*" The types of images the plug-in is made to handle
[
(PF_INT, "test_B", "THIS IS A TEST B", 500)
], # params The parameters for the plug-in's method
[], # results The results of the plug-in's method
test_register_B, # function The name of the method to call in your Python code
menu="<Image>/MyScripts" #
)
main()
Or you could register two menu entries going to the same function with different arguments possible. And etc.