label hard to find troubleshoot objects (#1247)

feature_tangential_fill
Kaalleen 2021-07-21 17:25:11 +02:00 zatwierdzone przez GitHub
rodzic 1f725f42bb
commit 36815f977d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -11,6 +11,7 @@ from shapely import geometry as shgeo
from ..i18n import _ from ..i18n import _
from ..stitches import auto_fill from ..stitches import auto_fill
from ..svg.tags import INKSCAPE_LABEL
from ..utils import cache, version from ..utils import cache, version
from .element import Patch, param from .element import Patch, param
from .fill import Fill from .fill import Fill
@ -264,7 +265,8 @@ class AutoFill(Fill):
def validation_warnings(self): def validation_warnings(self):
if self.shape.area < 20: 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: if self.shrink_or_grow_shape(self.expand, True).is_empty:
yield ExpandWarning(self.shape.centroid) yield ExpandWarning(self.shape.centroid)

Wyświetl plik

@ -4,6 +4,7 @@
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
from ..i18n import _ from ..i18n import _
from ..svg.tags import INKSCAPE_LABEL
from .element import EmbroideryElement from .element import EmbroideryElement
from .validation import ObjectTypeWarning from .validation import ObjectTypeWarning
@ -19,7 +20,8 @@ class EmptyD(ObjectTypeWarning):
class EmptyDObject(EmbroideryElement): class EmptyDObject(EmbroideryElement):
def validation_warnings(self): 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): def to_patches(self, last_patch):
return [] return []

Wyświetl plik

@ -25,11 +25,12 @@ class ValidationMessage(object):
description = None description = None
steps_to_solve = [] steps_to_solve = []
def __init__(self, position=None): def __init__(self, position=None, label=""):
if isinstance(position, ShapelyPoint): if isinstance(position, ShapelyPoint):
position = (position.x, position.y) position = (position.x, position.y)
self.position = InkstitchPoint(*position) self.position = InkstitchPoint(*position)
self.label = label
class ValidationError(ValidationMessage): class ValidationError(ValidationMessage):

Wyświetl plik

@ -93,6 +93,8 @@ class Troubleshoot(InkstitchExtension):
tspan = etree.Element(SVG_TSPAN_TAG) tspan = etree.Element(SVG_TSPAN_TAG)
tspan.text = problem.name tspan.text = problem.name
if problem.label:
tspan.text += " (%s)" % problem.label
text.append(tspan) text.append(tspan)
def create_troubleshoot_layer(self): def create_troubleshoot_layer(self):