From ea4d48119ab1b20dd35b022004212ffd1ae46d8e Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Mon, 11 Mar 2024 13:54:20 +0100 Subject: troubleshoot: stroke and fill warning (#2761) --- lib/elements/fill_stitch.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/elements') diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py index 267dbbd5..dc98e3c7 100644 --- a/lib/elements/fill_stitch.py +++ b/lib/elements/fill_stitch.py @@ -94,6 +94,14 @@ class BorderCrossWarning(ValidationWarning): ] +class StrokeAndFillWarning(ValidationWarning): + name = _("Fill and Stroke color") + description = _("Element has both a fill and a stroke color. It is recommended to use two separate elements instead.") + steps_to_solve = [ + _('* Duplicate the element. Remove stroke color from the first and fill color from the second.'), + _('* Adapt the shape of the second element to compensate for push and pull fabric distortion.') + ] + class InvalidShapeError(ValidationError): name = _("This shape is invalid") description = _('Fill: This shape cannot be stitched out. Please try to repair it with the "Break Apart Fill Objects" extension.') @@ -650,6 +658,13 @@ class FillStitch(EmbroideryElement): yield DisjointGuideLineWarning(self.shape.centroid) return None + if self.node.style('stroke', None) is not None: + if not self.shape.is_empty: + yield StrokeAndFillWarning(self.shape.representative_point()) + else: + # they may used a fill on a straight line + yield StrokeAndFillWarning(self.paths[0][0]) + for warning in super(FillStitch, self).validation_warnings(): yield warning -- cgit v1.2.3