From 7118bacb78d5c2769b2ea62736ad2d49e18a4b83 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:03:34 +0100 Subject: troubleshoot/linear gradient: add no linear gradient warning (#2779) --- lib/elements/fill_stitch.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/elements/fill_stitch.py') diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py index 117bb379..203c9fe8 100644 --- a/lib/elements/fill_stitch.py +++ b/lib/elements/fill_stitch.py @@ -103,6 +103,15 @@ class StrokeAndFillWarning(ValidationWarning): ] +class NoGradientWarning(ValidationWarning): + name = _("No linear gradient color") + description = _("Linear Gradient has no linear gradient color.") + steps_to_solve = [ + _('* Open the Fill and Stroke dialog.'), + _('* Set a linear gradient as a fill and adapt colors to your liking.') + ] + + 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.') @@ -659,6 +668,10 @@ class FillStitch(EmbroideryElement): yield DisjointGuideLineWarning(self.shape.centroid) return None + # linear gradient fill + if self.fill_method == 'linear_gradient_fill' and self.gradient is None: + yield NoGradientWarning(self.shape.representative_point()) + if self.node.style('stroke', None) is not None: if not self.shape.is_empty: yield StrokeAndFillWarning(self.shape.representative_point()) -- cgit v1.2.3