From e84a86d4ac0caf29d6074728376ff0a594243fec Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Thu, 4 Mar 2021 18:40:53 +0100 Subject: Update for Inkscape 1.0 (#880) * update for inkscape 1.0 * add about extension * Build improvements for the inkscape1.0 branch (#985) * zip: export real svg not stitch plan * #411 and #726 * Tools for Font Creators (#1018) * ignore very small holes in fills * remove embroider (#1026) * auto_fill: ignore shrink_or_grow if result is empty (#589) * break apart: do not ignore small fills Co-authored-by: Hagen Fritsch Co-authored-by: Lex Neva --- lib/extensions/input.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/extensions/input.py') diff --git a/lib/extensions/input.py b/lib/extensions/input.py index 957d355c..c6dcb698 100644 --- a/lib/extensions/input.py +++ b/lib/extensions/input.py @@ -1,8 +1,9 @@ import os -import pyembroidery -from inkex import etree import inkex +from lxml import etree + +import pyembroidery from ..stitch_plan import StitchPlan from ..svg import PIXELS_PER_MM, render_stitch_plan @@ -10,7 +11,7 @@ from ..svg.tags import INKSCAPE_LABEL class Input(object): - def affect(self, args): + def run(self, args): embroidery_file = args[0] pattern = pyembroidery.read(embroidery_file) @@ -47,11 +48,11 @@ class Input(object): # rename the Stitch Plan layer so that it doesn't get overwritten by Embroider layer = svg.find(".//*[@id='__inkstitch_stitch_plan__']") - layer.set(INKSCAPE_LABEL, os.path.basename(embroidery_file.decode("UTF-8"))) + layer.set(INKSCAPE_LABEL, os.path.basename(embroidery_file)) layer.attrib.pop('id') # Shift the design so that its origin is at the center of the canvas # Note: this is NOT the same as centering the design in the canvas! layer.set('transform', 'translate(%s,%s)' % (extents[0], extents[1])) - print etree.tostring(svg) + print(etree.tostring(svg).decode('utf-8')) -- cgit v1.2.3