From 31fbdf521b0e584ca3395e3827a6f2a02db688c1 Mon Sep 17 00:00:00 2001 From: Rick Levine Date: Thu, 2 Feb 2023 21:27:16 -0800 Subject: Add filename to .dst header --- lib/output.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/output.py') diff --git a/lib/output.py b/lib/output.py index a65a3af1..a6edfe86 100644 --- a/lib/output.py +++ b/lib/output.py @@ -3,6 +3,7 @@ # Copyright (c) 2010 Authors # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. +import os import sys import inkex @@ -60,6 +61,10 @@ def write_embroidery_file(file_path, stitch_plan, svg, settings={}): # origin = origin * scale pattern = pyembroidery.EmbPattern() + + # For later use when writing .dst header title field. + pattern.extras['filename'] = os.path.splitext(os.path.basename(file_path))[0] + stitch = Stitch(0, 0) for color_block in stitch_plan: -- cgit v1.2.3 From d2805f23de87d168d836d6bc4fabaa7023aba285 Mon Sep 17 00:00:00 2001 From: Rick Levine Date: Wed, 8 Feb 2023 16:29:16 -0800 Subject: Set pattern.extras['name'] for .dst header --- lib/output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/output.py') diff --git a/lib/output.py b/lib/output.py index a6edfe86..0b9e4ad5 100644 --- a/lib/output.py +++ b/lib/output.py @@ -63,7 +63,7 @@ def write_embroidery_file(file_path, stitch_plan, svg, settings={}): pattern = pyembroidery.EmbPattern() # For later use when writing .dst header title field. - pattern.extras['filename'] = os.path.splitext(os.path.basename(file_path))[0] + pattern.extras['name'] = os.path.splitext(os.path.basename(file_path))[0] stitch = Stitch(0, 0) -- cgit v1.2.3 From b1ffd8ad92b4803998b5447b45e71c30250db739 Mon Sep 17 00:00:00 2001 From: Rick Levine Date: Wed, 15 Feb 2023 14:27:36 -0800 Subject: Update output.py Retrieve svg file name for .dst header --- lib/output.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/output.py') diff --git a/lib/output.py b/lib/output.py index 0b9e4ad5..3ce6e5cd 100644 --- a/lib/output.py +++ b/lib/output.py @@ -63,7 +63,8 @@ def write_embroidery_file(file_path, stitch_plan, svg, settings={}): pattern = pyembroidery.EmbPattern() # For later use when writing .dst header title field. - pattern.extras['name'] = os.path.splitext(os.path.basename(file_path))[0] + svg_docname = svg.root.attrib['{http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}docname'] + pattern.extras['name'] = os.path.splitext(os.path.basename(svg_docname))[0] stitch = Stitch(0, 0) -- cgit v1.2.3 From ca819c51fc20a694bbbf6a47876dc0546c508509 Mon Sep 17 00:00:00 2001 From: Rick Levine Date: Thu, 16 Feb 2023 10:32:37 -0800 Subject: Simplify getting docname --- lib/output.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/output.py') diff --git a/lib/output.py b/lib/output.py index 3ce6e5cd..fb4580b7 100644 --- a/lib/output.py +++ b/lib/output.py @@ -63,8 +63,7 @@ def write_embroidery_file(file_path, stitch_plan, svg, settings={}): pattern = pyembroidery.EmbPattern() # For later use when writing .dst header title field. - svg_docname = svg.root.attrib['{http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}docname'] - pattern.extras['name'] = os.path.splitext(os.path.basename(svg_docname))[0] + pattern.extras['name'] = os.path.splitext(svg.name)[0] stitch = Stitch(0, 0) -- cgit v1.2.3