2 hours ago
I try to migrate my Python plug-in to decorate a jpeg photo with margin, border and description from Gimp 2 to Gimp 3.
it works as intended as long as I don't add a color-argument. What is wrong with this code?
If I omit the procedure.add_color_argument all is well, but with it the plug-in doesn't even show up in Gimp.
I can't find any code errors, or do you?
Thanks in advance for your help.
it works as intended as long as I don't add a color-argument. What is wrong with this code?
Code:
import sys
import os
from glob import glob
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 GObject
from gi.repository import GLib
#from gi.repository import Gtk
from gi.repository import Gio
from gi.repository import Gegl
...
class MarginBorder(Gimp.PlugIn):
def do_query_procedures(self):
return [plugInMBProc]
def do_create_procedure(self, name):
procedure = None
if name == plugInMBProc:
procedure = Gimp.ImageProcedure.new(self, name,
Gimp.PDBProcType.PLUGIN,
margin_border_run, None)
procedure.set_sensitivity_mask(Gimp.ProcedureSensitivityMask.DRAWABLE |
Gimp.ProcedureSensitivityMask.NO_DRAWABLES)
procedure.set_menu_label("Rand und Rahmen")
procedure.set_attribution("Volker", "Volker Lenhardt", "2025")
procedure.add_menu_path("<Image>/Volker")
procedure.set_documentation("Volkers Rand, Rahmen und Bildtext",
"Fügt dem aktiven Bild die Dekorationsebenen "\
+ "Rand, Rahmen und Bildtext hinzu.",
None)
procedure.add_font_argument("font", # name
"Font", # nick
None, # blurb
True, # none_ok
Gimp.Font.get_by_name(
"URW Gothic L Book"), # default_value
False, # default_to_context
GObject.ParamFlags.READWRITE) # flags
procedure.add_string_argument("desc", # name
"Bildbeschreibung", # nick
None, # blurb
"Irgendwo", # value
GObject.ParamFlags.READWRITE) # flags
procedure.add_double_argument("marginRelation", # name
"Randbreite in Promille der größten Bildausdehnung", # nick
None, # blurb
0.0, # min
30.0, # max
9.0, # value
GObject.ParamFlags.READWRITE) # flags
procedure.add_double_argument("borderRelation", # name
"Rahmenbreite in Promille der größten Bildausdehnung", # nick
None, # blurb
0.0, # min
10.0, # max
1.8, # value
GObject.ParamFlags.READWRITE) # flags
procedure.add_color_argument("borderColor", # name
"Rahmenfarbe", # nick
None, # blurb
False, # has_alpha
Gegl.Color.new("black"), # value
GObject.ParamFlags.READWRITE) # flags
return procedure
Gimp.main(MarginBorder.__gtype__, sys.argv)If I omit the procedure.add_color_argument all is well, but with it the plug-in doesn't even show up in Gimp.
I can't find any code errors, or do you?
Thanks in advance for your help.

