summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2021-07-21 17:25:11 +0200
committerGitHub <noreply@github.com>2021-07-21 17:25:11 +0200
commit36815f977d7236311e9b345c33fbc74390766385 (patch)
tree3827222bd0b18e985c6729fec5e6797bc86f8d80
parent1f725f42bbd299b6e5192a5404471a4fd89ae7f8 (diff)
label hard to find troubleshoot objects (#1247)
-rw-r--r--lib/elements/auto_fill.py4
-rw-r--r--lib/elements/empty_d_object.py4
-rw-r--r--lib/elements/validation.py3
-rw-r--r--lib/extensions/troubleshoot.py2
4 files changed, 10 insertions, 3 deletions
diff --git a/lib/elements/auto_fill.py b/lib/elements/auto_fill.py
index 69533f62..cf7a44a7 100644
--- a/lib/elements/auto_fill.py
+++ b/lib/elements/auto_fill.py
@@ -11,6 +11,7 @@ from shapely import geometry as shgeo
from ..i18n import _
from ..stitches import auto_fill
+from ..svg.tags import INKSCAPE_LABEL
from ..utils import cache, version
from .element import Patch, param
from .fill import Fill
@@ -264,7 +265,8 @@ class AutoFill(Fill):
def validation_warnings(self):
if self.shape.area < 20:
- yield SmallShapeWarning(self.shape.centroid)
+ label = self.node.get(INKSCAPE_LABEL) or self.node.get("id")
+ yield SmallShapeWarning(self.shape.centroid, label)
if self.shrink_or_grow_shape(self.expand, True).is_empty:
yield ExpandWarning(self.shape.centroid)
diff --git a/lib/elements/empty_d_object.py b/lib/elements/empty_d_object.py
index dbb43bc4..19fb58a4 100644
--- a/lib/elements/empty_d_object.py
+++ b/lib/elements/empty_d_object.py
@@ -4,6 +4,7 @@
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
from ..i18n import _
+from ..svg.tags import INKSCAPE_LABEL
from .element import EmbroideryElement
from .validation import ObjectTypeWarning
@@ -19,7 +20,8 @@ class EmptyD(ObjectTypeWarning):
class EmptyDObject(EmbroideryElement):
def validation_warnings(self):
- yield EmptyD((0, 0))
+ label = self.node.get(INKSCAPE_LABEL) or self.node.get("id")
+ yield EmptyD((0, 0), label)
def to_patches(self, last_patch):
return []
diff --git a/lib/elements/validation.py b/lib/elements/validation.py
index c14b634c..9ac8e745 100644
--- a/lib/elements/validation.py
+++ b/lib/elements/validation.py
@@ -25,11 +25,12 @@ class ValidationMessage(object):
description = None
steps_to_solve = []
- def __init__(self, position=None):
+ def __init__(self, position=None, label=""):
if isinstance(position, ShapelyPoint):
position = (position.x, position.y)
self.position = InkstitchPoint(*position)
+ self.label = label
class ValidationError(ValidationMessage):
diff --git a/lib/extensions/troubleshoot.py b/lib/extensions/troubleshoot.py
index 39c68d86..8e37acc3 100644
--- a/lib/extensions/troubleshoot.py
+++ b/lib/extensions/troubleshoot.py
@@ -93,6 +93,8 @@ class Troubleshoot(InkstitchExtension):
tspan = etree.Element(SVG_TSPAN_TAG)
tspan.text = problem.name
+ if problem.label:
+ tspan.text += " (%s)" % problem.label
text.append(tspan)
def create_troubleshoot_layer(self):