Question

i am confused a little about the art of how gimp generates the gui for python plug-ins.

gimp generates two, for my script, needless fields. "Input image" and "Input drawable". how can i disable them?

I didn't find anything about it in the standart documetation.

my register method:

register(
  "fixPngColors",
  "fixPngColors",
  "fixPngColors",
  "Author",
  "Author",
  "2013",
  "<Image>/plug-ins/BATCH PNG Color Fix",
  "",
  [
  (PF_DIRNAME, "png_input_directory", "Png directory(INPUT)", ""),
  (PF_DIRNAME, "png_output_directory", "Png directory(OUTPUT)", ""),
  (PF_INT, "c_count", "Max Colors", "255"),
  ],
  [],
  launcher
  )

like you can see, nothing about the other two.

Était-ce utile?

La solution

It's because of

"<Image>/plug-ins/BATCH PNG Color Fix",

in the register function!

Had the same Problem. Move the menu to another place like

"<Toolbox>/MyScripts/BATCH PNG Color Fix",

and you dont need an input image anymore.

If you place an plug-in under "Image", Gimp assumes you need an image and a drawable as input. This seems to override everything else.

Autres conseils

Indeed - you solution is the way to fix it

The docs are outdated actually - it used to work this way - and still does, due to backward compatibility: the first part of the menu path indicates teh context were your plug-in shows up - and python-fu automatically generates the field(s) for that context. (, , )

Due to the confusion and non-explicit side-effects this casued, this form of calling register is deprecated. Instead, on that 8th parameter, one should pass only the Menu entry name for the script - "BATCH PNG Color Fix" - in this case, and you should add a named parameter "menu='/plug-ins/BATCH PNG Color Fix' parameter to the register call. (IIRC this last parameter can be a list, and your plug-in can show up in multiple palces in the menus - but I've never tried it).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top