summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
authorKaalleen <reni@allenka.de>2021-06-24 22:25:13 +0200
committerKaalleen <reni@allenka.de>2021-06-24 22:25:13 +0200
commitd6df8084f4a0fe8c8e174ea230d158512bd8f094 (patch)
treea0c000b5c37e7211bbb42e1f8198e96262dcd9cc /lib/elements
parent1adfa87a68be6bcc92d9521b97ab59dc022ab3be (diff)
add start markers, add troubleshoot pattern warning and fix wxpython language issue
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/pattern.py32
-rw-r--r--lib/elements/utils.py8
2 files changed, 38 insertions, 2 deletions
diff --git a/lib/elements/pattern.py b/lib/elements/pattern.py
new file mode 100644
index 00000000..98f29456
--- /dev/null
+++ b/lib/elements/pattern.py
@@ -0,0 +1,32 @@
+# 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 ..i18n import _
+from .element import EmbroideryElement
+from .validation import ObjectTypeWarning
+
+
+class PatternWarning(ObjectTypeWarning):
+ name = _("Pattern Element")
+ description = _("This element will only be stitched out as a pattern within the specified object.")
+ steps_to_solve = [
+ _("If you want to remove the pattern configuration for a pattern object follow these steps:"),
+ _("* Select pattern element(s)"),
+ _('* Run Extensions > Ink/Stitch > Troubleshoot > Remove embroidery settings...'),
+ _('* Make sure "Remove params" is enables'),
+ _('* Click "Apply"')
+ ]
+
+
+class PatternObject(EmbroideryElement):
+
+ def validation_warnings(self):
+ repr_point = next(inkex.Path(self.parse_path()).end_points)
+ yield PatternWarning(repr_point)
+
+ def to_patches(self, last_patch):
+ return []
diff --git a/lib/elements/utils.py b/lib/elements/utils.py
index aceab485..03ea48d4 100644
--- a/lib/elements/utils.py
+++ b/lib/elements/utils.py
@@ -4,14 +4,15 @@
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
from ..commands import is_command
-from ..svg.tags import (EMBROIDERABLE_TAGS, SVG_IMAGE_TAG, SVG_PATH_TAG,
- SVG_POLYLINE_TAG, SVG_TEXT_TAG)
+from ..svg.tags import (EMBROIDERABLE_TAGS, INKSTITCH_ATTRIBS, SVG_IMAGE_TAG,
+ SVG_PATH_TAG, SVG_POLYLINE_TAG, SVG_TEXT_TAG)
from .auto_fill import AutoFill
from .clone import Clone, is_clone
from .element import EmbroideryElement
from .empty_d_object import EmptyDObject
from .fill import Fill
from .image import ImageObject
+from .pattern import PatternObject
from .polyline import Polyline
from .satin_column import SatinColumn
from .stroke import Stroke
@@ -28,6 +29,9 @@ def node_to_elements(node): # noqa: C901
elif node.tag == SVG_PATH_TAG and not node.get('d', ''):
return [EmptyDObject(node)]
+ elif node.get(INKSTITCH_ATTRIBS['pattern']):
+ return [PatternObject(node)]
+
elif node.tag in EMBROIDERABLE_TAGS:
element = EmbroideryElement(node)