summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/auto_fill.py4
-rw-r--r--lib/elements/element.py10
-rw-r--r--lib/elements/fill.py5
3 files changed, 14 insertions, 5 deletions
diff --git a/lib/elements/auto_fill.py b/lib/elements/auto_fill.py
index cfee6d7d..65b11fb1 100644
--- a/lib/elements/auto_fill.py
+++ b/lib/elements/auto_fill.py
@@ -8,7 +8,7 @@ from .fill import Fill
class AutoFill(Fill):
- element_name = _("Auto-Fill")
+ element_name = _("AutoFill")
@property
@param('auto_fill', _('Automatically routed fill stitching'), type='toggle', default=True)
@@ -55,7 +55,7 @@ class AutoFill(Fill):
def fill_underlay_angle(self):
underlay_angle = self.get_float_param("fill_underlay_angle")
- if underlay_angle:
+ if underlay_angle is not None:
return math.radians(underlay_angle)
else:
return self.angle + math.pi / 2.0
diff --git a/lib/elements/element.py b/lib/elements/element.py
index 4edb00c0..ec50ce22 100644
--- a/lib/elements/element.py
+++ b/lib/elements/element.py
@@ -197,7 +197,11 @@ class EmbroideryElement(object):
# In a path, each element in the 3-tuple is itself a tuple of (x, y).
# Tuples all the way down. Hasn't anyone heard of using classes?
- return cubicsuperpath.parsePath(self.node.get("d"))
+ d = self.node.get("d", "")
+ if not d:
+ self.fatal(_("Object %(id)s has an empty 'd' attribute. Please delete this object from your document.") % dict(id=self.node.get("id")))
+
+ return cubicsuperpath.parsePath(d)
@cache
def parse_path(self):
@@ -264,5 +268,7 @@ class EmbroideryElement(object):
return patches
def fatal(self, message):
- print >> sys.stderr, "error:", message
+ # L10N used when showing an error message to the user such as "satin column: One or more of the rungs doesn't
+ # intersect both rails."
+ print >> sys.stderr, self.node.get("id") + ":", _("error:"), message
sys.exit(1)
diff --git a/lib/elements/fill.py b/lib/elements/fill.py
index 626573e6..4156a24b 100644
--- a/lib/elements/fill.py
+++ b/lib/elements/fill.py
@@ -120,7 +120,10 @@ class Fill(EmbroideryElement):
poly_ary.sort(key=lambda point_list: shgeo.Polygon(point_list).area, reverse=True)
polygon = shgeo.MultiPolygon([(poly_ary[0], poly_ary[1:])])
- # print >> sys.stderr, "polygon valid:", polygon.is_valid
+
+ if not polygon.is_valid:
+ self.fatal(_("shape is not valid. This can happen if the border crosses over itself."))
+
return polygon
def to_patches(self, last_patch):