diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-03-25 19:45:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-25 19:45:36 +0100 |
| commit | 221ff2a645d453a974160a155af1a047c224d80b (patch) | |
| tree | f0f7979903a2f87e0593f34eade2e37679dad3ca /lib/elements/satin_column.py | |
| parent | d8e80f4df8c12d2f7921bfa282ba06390ff09974 (diff) | |
Stitch selection methods (#2114)
Diffstat (limited to 'lib/elements/satin_column.py')
| -rw-r--r-- | lib/elements/satin_column.py | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index 7af64382..887aec01 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -19,9 +19,10 @@ from ..stitch_plan import StitchGroup from ..stitches import running_stitch from ..svg import line_strings_to_csp, point_lists_to_csp from ..utils import Point, cache, cut, cut_multiple, prng +from ..utils.param import ParamOption +from ..utils.threading import check_stop_flag from .element import PIXELS_PER_MM, EmbroideryElement, param from .validation import ValidationError, ValidationWarning -from ..utils.threading import check_stop_flag class TooFewPathsError(ValidationError): @@ -77,17 +78,26 @@ class SatinColumn(EmbroideryElement): def satin_column(self): return self.get_boolean_param("satin_column") - # I18N: "E" stitch is so named because it looks like the letter E. + _satin_methods = [ParamOption('satin_column', _('Satin Column')), + ParamOption('e_stitch', _('"E" Stitch'))] + @property - @param('e_stitch', _('"E" stitch'), type='boolean', default='false') - def e_stitch(self): - return self.get_boolean_param("e_stitch") + @param('satin_method', + _('Method'), + type='combo', + default=0, + options=_satin_methods, + sort_index=0) + def satin_method(self): + return self.get_param('satin_method', 'satin_column') @property @param('max_stitch_length_mm', _('Maximum stitch length'), tooltip=_('Maximum stitch length for split stitches.'), - type='float', unit="mm") + type='float', + unit="mm", + sort_index=1) def max_stitch_length_px(self): return self.get_float_param("max_stitch_length_mm") or None @@ -150,8 +160,10 @@ class SatinColumn(EmbroideryElement): @param('short_stitch_inset', _('Short stitch inset'), tooltip=_('Stitches in areas with high density will be inset by this amount.'), - type='float', unit="%", - default=15) + type='float', + unit="%", + default=15, + sort_index=3) def short_stitch_inset(self): return self.get_float_param("short_stitch_inset", 15) / 100 @@ -159,8 +171,10 @@ class SatinColumn(EmbroideryElement): @param('short_stitch_distance_mm', _('Short stitch distance'), tooltip=_('Inset stitches if the distance between stitches is smaller than this.'), - type='float', unit="mm", - default=0.25) + type='float', + unit="mm", + default=0.25, + sort_index=4) def short_stitch_distance(self): return self.get_float_param("short_stitch_distance_mm", 0.25) @@ -174,7 +188,8 @@ class SatinColumn(EmbroideryElement): tooltip=_('Peak-to-peak distance between zig-zags. This is double the mm/stitch measurement used by most mechanical machines.'), unit='mm/cycle', type='float', - default=0.4) + default=0.4, + sort_index=5) def zigzag_spacing(self): # peak-to-peak distance between zigzags return max(self.get_float_param("zigzag_spacing_mm", 0.4), 0.01) @@ -187,7 +202,8 @@ class SatinColumn(EmbroideryElement): 'Two values separated by a space may be used for an aysmmetric effect.'), unit='% (each side)', type='float', - default=0) + default=0, + sort_index=6) @cache def pull_compensation_percent(self): # pull compensation as a percentage of the width @@ -202,7 +218,8 @@ class SatinColumn(EmbroideryElement): 'Two values separated by a space may be used for an aysmmetric effect.'), unit='mm (each side)', type='float', - default=0) + default=0, + sort_index=7) @cache def pull_compensation_px(self): # In satin stitch, the stitches have a tendency to pull together and @@ -250,7 +267,9 @@ class SatinColumn(EmbroideryElement): _('Inset distance (fixed)'), tooltip=_('Shrink the outline by a fixed length, to prevent the underlay from showing around the outside of the satin column.'), group=_('Contour Underlay'), - unit='mm (each side)', type='float', default=0.4, + unit='mm (each side)', + type='float', + default=0.4, sort_index=2) @cache def contour_underlay_inset_px(self): @@ -1125,7 +1144,7 @@ class SatinColumn(EmbroideryElement): # zigzags sit on the contour walk underlay like rail ties on rails. patch += self.do_zigzag_underlay() - if self.e_stitch: + if self.satin_method == 'e_stitch': patch += self.do_e_stitch() else: patch += self.do_satin() |
