Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting python plugin-in shellout.py from gimp 2.x to 3.x
#1
Dear Gimp developers,

Background: the shellout.py (7 years old script) is an approach for calling NikCollection Filters and using the result in GIMP. It still worked with win10 & win11 until GIMP 3.x.

I’m having trouble converting the Python plug-in script from GIMP 2.x to 3.x.
Thank @Ofnuts for pointing out the helloworld plugin example, that helped me understand the basics a little bit.

Currently, I’m stuck on adapting the part that opens a popup-menu with RATIO and OPTION (see youtube video) choices within the register() function (v2.x).

Here is the code snippet which can show ShellOut in menu Filters/ but still missing the functionality, I took a look in v3.0 API but got confuse..:
Code:
def plugin_main(procedure, run_mode, image, n_drawables, drawables, config, data):
 ...

class ShellOut(Gimp.PlugIn):

  def do_query_procedures(self):
      return [PROC_NAME]

  def do_create_procedure(self, name):
      procedure = Gimp.ImageProcedure.new(self, name,
                                         Gimp.PDBProcType.PLUGIN,
                                         plugin_main, None)
     
      procedure.set_image_types("RGB*, GRAY*")
      procedure.set_menu_label("ShellOut...")
      procedure.set_attribution(AUTHOR, COPYRIGHT, DATE)
      procedure.set_documentation(HELP, DOC, None)

      procedure.add_menu_path("<Image>/Filters/ShellOut...")

      # FIXME: How to open menu and get return values and pass into main_plugin()?
     
      return procedure

Gimp.main(ShellOut.__gtype__, sys.argv)

Could someone give me the concrete instructions how rewrite the script to make it work again in GIMP 3.x?
Thank you very much for your help!

Best regards,

PS: Attached is the 'in-progress' reworked version for v3.x in comparison to the original 2.x script could be found in the link above.


Attached Files
.txt   shellout_v3.txt (Size: 8 KB / Downloads: 32)
Reply


Messages In This Thread
Converting python plugin-in shellout.py from gimp 2.x to 3.x - by iiey - 03-24-2025, 08:34 AM

Forum Jump: