From 9b20fbae52919c9977143ee75c395b6f0e8f6897 Mon Sep 17 00:00:00 2001 From: Scott Pakin Date: Thu, 5 Dec 2024 23:37:46 -0700 Subject: [PATCH] Support two means of initializing Simple Inkscape Scripting An extension class can either derive from `SimpleInkscapeScripting` and invoke `super.effect()` from its `effect` method or derive from an arbitrary `inkex` extension type and invoke `SimpleInkscapeScripting(self).effect()` from its `effect` method. --- simpinkscr/simple_inkscape_scripting.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/simpinkscr/simple_inkscape_scripting.py b/simpinkscr/simple_inkscape_scripting.py index f1b68ef..2791d46 100644 --- a/simpinkscr/simple_inkscape_scripting.py +++ b/simpinkscr/simple_inkscape_scripting.py @@ -3634,12 +3634,14 @@ def to_list(e): class SimpleInkscapeScripting(inkex.EffectExtension): 'Help the user create Inkscape objects with a simple API.' - def __init__(self): + def __init__(self, obj=None): super().__init__() self.options.user_args = [] self.options.encoding = '' self.options.py_source = None self.options.program = None + if obj is not None: + self.svg = obj.svg def filename_arg(self, name): """Existing file to read or option used in script arguments"""