summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/element.py4
-rw-r--r--lib/elements/satin_column.py38
-rw-r--r--lib/elements/stroke.py2
3 files changed, 25 insertions, 19 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py
index 51555129..c0b7ee0f 100644
--- a/lib/elements/element.py
+++ b/lib/elements/element.py
@@ -74,7 +74,9 @@ class EmbroideryElement(object):
# convert legacy fill_method
legacy_fill_method = self.get_int_param('fill_method', None)
- if legacy_fill_method == 1:
+ if legacy_fill_method == 0:
+ self.set_param('fill_method', 'auto_fill')
+ elif legacy_fill_method == 1:
self.set_param('fill_method', 'contour_fill')
elif legacy_fill_method == 2:
self.set_param('fill_method', 'guided_fill')
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index b5086171..8c39b4d2 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -33,17 +33,6 @@ class TooFewPathsError(ValidationError):
]
-class UnequalPointsError(ValidationError):
- name = _("Unequal number of points")
- description = _("Satin column: There are no rungs and rails have an an unequal number of points.")
- steps_to_solve = [
- _('The easiest way to solve this issue is to add one or more rungs. '),
- _('Rungs control the stitch direction in satin columns.'),
- _('* With the selected object press "P" to activate the pencil tool.'),
- _('* Hold "Shift" while drawing the rung.')
- ]
-
-
class NotStitchableError(ValidationError):
name = _("Not stitchable satin column")
description = _("A satin column consists out of two rails and one or more rungs. This satin column may have a different setup.")
@@ -56,14 +45,25 @@ class NotStitchableError(ValidationError):
rung_message = _("Each rung should intersect both rails once.")
+class TooManyIntersectionsError(ValidationError):
+ name = _("Rungs intersects too many times")
+ description = _("Satin column: A rung intersects a rail more than once.") + " " + rung_message
+
+
class DanglingRungWarning(ValidationWarning):
name = _("Rung doesn't intersect rails")
description = _("Satin column: A rung doesn't intersect both rails.") + " " + rung_message
-class TooManyIntersectionsError(ValidationError):
- name = _("Rungs intersects too many times")
- description = _("Satin column: A rung intersects a rail more than once.") + " " + rung_message
+class UnequalPointsWarning(ValidationError):
+ name = _("Unequal number of points")
+ description = _("Satin column: There are no rungs and rails have an an unequal number of points.")
+ steps_to_solve = [
+ _('The easiest way to solve this issue is to add one or more rungs. '),
+ _('Rungs control the stitch direction in satin columns.'),
+ _('* With the selected object press "P" to activate the pencil tool.'),
+ _('* Hold "Shift" while drawing the rung.')
+ ]
class SatinColumn(EmbroideryElement):
@@ -407,10 +407,13 @@ class SatinColumn(EmbroideryElement):
def _synthesize_rungs(self):
rung_endpoints = []
+ # check for unequal length of rails
+ equal_length = len(self.rails[0]) == len(self.rails[1])
+
for rail in self.rails:
points = self.strip_control_points(rail)
- if len(points) > 2:
+ if len(points) > 2 or not equal_length:
# Don't bother putting rungs at the start and end.
points = points[1:-1]
else:
@@ -513,6 +516,8 @@ class SatinColumn(EmbroideryElement):
return sections
def validation_warnings(self):
+ if len(self.csp) == 2 and len(self.rails[0]) != len(self.rails[1]):
+ yield UnequalPointsWarning(self.flattened_rails[0].interpolate(0.5, normalized=True))
for rung in self.flattened_rungs:
for rail in self.flattened_rails:
intersection = rung.intersection(rail)
@@ -526,9 +531,6 @@ class SatinColumn(EmbroideryElement):
yield TooFewPathsError((0, 0))
elif len(self.rails) < 2:
yield TooFewPathsError(self.shape.centroid)
- elif len(self.csp) == 2:
- if len(self.rails[0]) != len(self.rails[1]):
- yield UnequalPointsError(self.flattened_rails[0].interpolate(0.5, normalized=True))
else:
for rung in self.flattened_rungs:
for rail in self.flattened_rails:
diff --git a/lib/elements/stroke.py b/lib/elements/stroke.py
index 9fe6fee1..8f5a6347 100644
--- a/lib/elements/stroke.py
+++ b/lib/elements/stroke.py
@@ -285,6 +285,7 @@ class Stroke(EmbroideryElement):
_('Starting scale'),
tooltip=_('How big the first copy of the line should be, in percent.') + " " + _('Used only for ripple stitch with a guide line.'),
type='float',
+ unit='%',
default=100,
select_items=[('stroke_method', 1)],
sort_index=13)
@@ -296,6 +297,7 @@ class Stroke(EmbroideryElement):
_('Ending scale'),
tooltip=_('How big the last copy of the line should be, in percent.') + " " + _('Used only for ripple stitch with a guide line.'),
type='float',
+ unit='%',
default=0.0,
select_items=[('stroke_method', 1)],
sort_index=14)