Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plug-in help
#1
Hello,

I am having an hard time writing my first plus-in in Python.
I wrote a simple "Hello World" plug-in.
It show up in the menus (so the do_create_procedure member function work as intended).
It show up in the python procedures browser (so the do_query_procedures member function work as intended).
But it does not produce anything in the errors window and that leave me completly clueless.
What did I do wrong ?

Here is the source code:
Code:
import sys
import gi
gi.require_version('Gimp', '3.0')
from gi.repository import Gimp
gi.require_version('GimpUi', '3.0')
from gi.repository import GimpUi
from gi.repository import GLib

class Plugin (Gimp.PlugIn):
   def do_query_procedures(self):
       return [ "fl-plug-in-Hello-World" ]

   def do_set_i18n (self, name):
       return False

   def do_create_procedure(self, name):
       procedure = Gimp.ImageProcedure.new(self, name,
                                           Gimp.PDBProcType.PLUGIN,
                                           self.run, None)

       procedure.set_image_types("*")

       procedure.set_menu_label("Hello World Python plug-in")
       procedure.add_menu_path('<Image>/Filters/My Scripts/')

       procedure.set_documentation("Hello World",
                                   "Python 3 plug-in for GIMP 3.0",
                                   name)
       procedure.set_attribution("Fabrice", "Lambert", "2025")

       return procedure

   def run(self, procedure, run_mode, image, n_drawables, drawables, config, run_data):
       Gimp.message("Hello world!")
       # do what you want to do, then, in case of success, return:
       return procedure.new_return_values(Gimp.PDBStatusType.SUCCESS, GLib.Error())

Gimp.main(Plugin.__gtype__, sys.argv)
Reply


Messages In This Thread
Plug-in help - by Deedolith - 01-07-2025, 05:28 PM
RE: Plug-in help - by programmer_ceds - 01-07-2025, 06:39 PM
RE: Plug-in help - by Deedolith - 01-07-2025, 07:45 PM
RE: Plug-in help - by Ofnuts - 01-07-2025, 10:41 PM
RE: Plug-in help - by gasMask - 01-08-2025, 08:45 AM
RE: Plug-in help - by MrsP-from-C - 01-08-2025, 03:43 PM
RE: Plug-in help - by gasMask - 01-09-2025, 09:18 AM
RE: Plug-in help - by Deedolith - 01-08-2025, 04:48 PM
RE: Plug-in help - by Ofnuts - 01-09-2025, 02:03 AM
RE: Plug-in help - by MrsP-from-C - 01-08-2025, 06:36 PM
RE: Plug-in help - by Deedolith - 01-08-2025, 06:40 PM
RE: Plug-in help - by MrsP-from-C - 01-08-2025, 06:51 PM
RE: Plug-in help - by MrsP-from-C - 01-09-2025, 09:49 AM

Forum Jump: