Declaring a plain Gimp.Procedure in Python (original) (raw)
If I use this:
def myProcedure(procedure: Gimp.Procedure,
run_mode: Gimp.RunMode,
image: Gimp.Image,
drawables: list[Gimp.Drawable],
config:Gimp.ProcedureConfig,
run_data: Any):
trace(f'Executing procedure {procedure.get_name()}')
return procedure.new_return_values(Gimp.PDBStatusType.SUCCESS, GLib.Error())
#[...] and create an ImageProcedure:
procedure: Gimp.Procedure = Gimp.ImageProcedure.new(self, procName,
Gimp.PDBProcType.PLUGIN,
run_func=myProcedure)
it works. But I don’t want an image procedure (the plugin doesn’t even need an image to do something meaningful) bur if I do:
def myProcedure(procedure: Gimp.Procedure,
run_mode: Gimp.RunMode,
run_data: Any):
trace(f'Executing procedure {procedure.get_name()}')
return procedure.new_return_values(Gimp.PDBStatusType.SUCCESS, GLib.Error())
#[...] and create an ImageProcedure:
procedure: Gimp.Procedure = Gimp.Procedure.new(self, procName,
Gimp.PDBProcType.PLUGIN,
run_func=myProcedure)
I get the message:
Plug-in “myplugin.py” attempted to install procedure “resource-manager-dynamics” which does not take the standard plug-in’s arguments: (GimpRunMode).
As a test I tried to add the plugin to the <Image>
menu and I get the same error with GimpRunMode
Given that in Python the type of arguments is completely dynamic I wonder how it can tell… as far as I understand it the only thing it can check is the number of arguments? But I tried with some more arguments without success. Otherwise what is the acceptable “Prototype” for a plain Gimp.Procedure function?
Edit: curiouser and curiouser: according to the doc, there is not even a run_mode
argument for a plain Procedure
…