From 077f7ea72ba38790bf030d3181c44787fef953b6 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Tue, 6 Aug 2019 04:42:48 +0200 Subject: add Troubleshoot extension (#465) adds an extension to help you understand what's wrong with an object and how to fix it, e.g. "invalid" fill shapes --- lib/elements/polyline.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'lib/elements/polyline.py') diff --git a/lib/elements/polyline.py b/lib/elements/polyline.py index 5bfe5022..a9870172 100644 --- a/lib/elements/polyline.py +++ b/lib/elements/polyline.py @@ -1,8 +1,22 @@ from shapely import geometry as shgeo -from .element import EmbroideryElement, Patch -from ..utils.geometry import Point +from ..i18n import _ from ..utils import cache +from ..utils.geometry import Point +from .element import EmbroideryElement, Patch +from .validation import ValidationWarning + + +class PolylineWarning(ValidationWarning): + name = _("Object is a PolyLine") + description = _("This object is an SVG PolyLine. Ink/Stitch can work with this shape, " + "but you can't edit it in Inkscape. Convert it to a manual stitch path " + "to allow editing.") + steps_to_solve = [ + _("* Select this object."), + _("* Do Path > Object to Path."), + _('* Optional: Run the Params extension and check the "manual stitch" box.') + ] class Polyline(EmbroideryElement): @@ -70,6 +84,9 @@ class Polyline(EmbroideryElement): return stitches + def validation_warnings(self): + yield PolylineWarning(self.points[0]) + def to_patches(self, last_patch): patch = Patch(color=self.color) -- cgit v1.2.3