summaryrefslogtreecommitdiff
path: root/lib/extensions/convert_to_stroke.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2025-03-25 06:14:23 +0000
committerGitHub <noreply@github.com>2025-03-25 07:14:23 +0100
commit23dcbd58bc8f26a71b0483ed907c0052ca348899 (patch)
treeb64dd0db745d8ded761bcd483faf134c8d7793b1 /lib/extensions/convert_to_stroke.py
parent333717c2e378aeb862609a7d4143083ca7824925 (diff)
rename convert to extensions (#3605)
Diffstat (limited to 'lib/extensions/convert_to_stroke.py')
-rw-r--r--lib/extensions/convert_to_stroke.py56
1 files changed, 0 insertions, 56 deletions
diff --git a/lib/extensions/convert_to_stroke.py b/lib/extensions/convert_to_stroke.py
deleted file mode 100644
index af6563df..00000000
--- a/lib/extensions/convert_to_stroke.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# Authors: see git history
-#
-# Copyright (c) 2010 Authors
-# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-
-import inkex
-
-from ..elements import SatinColumn
-from ..i18n import _
-from ..svg import get_correction_transform
-from .base import InkstitchExtension
-
-
-class ConvertToStroke(InkstitchExtension):
- """Convert a satin column into a running stitch."""
-
- def __init__(self, *args, **kwargs):
- InkstitchExtension.__init__(self, *args, **kwargs)
- self.arg_parser.add_argument("--notebook")
- self.arg_parser.add_argument("-k", "--keep_satin", type=inkex.Boolean, default=False, dest="keep_satin")
-
- def effect(self):
- if not self.svg.selection or not self.get_elements():
- inkex.errormsg(_("Please select at least one satin column to convert to a running stitch."))
- return
-
- if not any(isinstance(item, SatinColumn) for item in self.elements):
- # L10N: Convert To Satin extension, user selected one or more objects that were not lines.
- inkex.errormsg(_("Please select at least one satin column to convert to a running stitch."))
- return
-
- for element in self.elements:
- if not isinstance(element, SatinColumn):
- continue
-
- parent = element.node.getparent()
- center_line = element.center_line.simplify(0.05)
-
- d = "M"
- for x, y in center_line.coords:
- d += "%s,%s " % (x, y)
- d += " "
-
- stroke_element = inkex.PathElement(
- id=self.uniqueId("path"),
- style=self.path_style(element),
- transform=get_correction_transform(element.node),
- d=d
- )
- parent.insert(parent.index(element.node), stroke_element)
- if not self.options.keep_satin:
- element.node.delete()
-
- def path_style(self, element):
- color = element.get_style('stroke', '#000000')
- return "stroke:%s;stroke-width:1px;stroke-dasharray:3, 1;fill:none" % (color)