diff options
Diffstat (limited to 'lib/elements')
| -rw-r--r-- | lib/elements/__init__.py | 1 | ||||
| -rw-r--r-- | lib/elements/empty_d_object.py | 20 | ||||
| -rw-r--r-- | lib/elements/utils.py | 8 |
3 files changed, 27 insertions, 2 deletions
diff --git a/lib/elements/__init__.py b/lib/elements/__init__.py index 75509e29..92ef94a3 100644 --- a/lib/elements/__init__.py +++ b/lib/elements/__init__.py @@ -1,6 +1,7 @@ from auto_fill import AutoFill from clone import Clone from element import EmbroideryElement +from empty_d_object import EmptyDObject from fill import Fill from image import ImageObject from polyline import Polyline diff --git a/lib/elements/empty_d_object.py b/lib/elements/empty_d_object.py new file mode 100644 index 00000000..69a128ad --- /dev/null +++ b/lib/elements/empty_d_object.py @@ -0,0 +1,20 @@ +from ..i18n import _ +from .element import EmbroideryElement +from .validation import ObjectTypeWarning + + +class EmptyD(ObjectTypeWarning): + name = _("Empty D-Attribute") + description = _("There is an invalid path object in the document, the d-attribute is missing.") + steps_to_solve = [ + _('* Run Extensions > Ink/Stitch > Troubleshoot > Cleanup Document...') + ] + + +class EmptyDObject(EmbroideryElement): + + def validation_warnings(self): + yield EmptyD((0, 0)) + + def to_patches(self, last_patch): + return [] diff --git a/lib/elements/utils.py b/lib/elements/utils.py index c34c4b25..378cec0c 100644 --- a/lib/elements/utils.py +++ b/lib/elements/utils.py @@ -1,9 +1,10 @@ from ..commands import is_command -from ..svg.tags import (EMBROIDERABLE_TAGS, SVG_IMAGE_TAG, SVG_POLYLINE_TAG, - SVG_TEXT_TAG) +from ..svg.tags import (EMBROIDERABLE_TAGS, 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 .polyline import Polyline @@ -19,6 +20,9 @@ def node_to_elements(node): # noqa: C901 elif is_clone(node): return [Clone(node)] + elif node.tag == SVG_PATH_TAG and not node.get('d', ''): + return [EmptyDObject(node)] + elif node.tag in EMBROIDERABLE_TAGS: element = EmbroideryElement(node) |
