diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-06-20 16:56:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-20 16:56:00 +0200 |
| commit | c017cae01aa33a876795ec5da1438e8ec0f11fc5 (patch) | |
| tree | ace90dd7c09b6bbddd53cf4b351cb55ef56f42c0 /lib/elements | |
| parent | c030e3283530bc1d0f4bad219f4c61db22750506 (diff) | |
gray out randomize stitch length param when random stitch length is disabled (#3002)
Diffstat (limited to 'lib/elements')
| -rw-r--r-- | lib/elements/element.py | 3 | ||||
| -rw-r--r-- | lib/elements/fill_stitch.py | 21 | ||||
| -rw-r--r-- | lib/elements/stroke.py | 15 |
3 files changed, 21 insertions, 18 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py index 5c463c53..4ce47c79 100644 --- a/lib/elements/element.py +++ b/lib/elements/element.py @@ -27,7 +27,7 @@ from ..utils.cache import get_stitch_plan_cache, is_cache_disabled, CacheKeyGene class Param(object): def __init__(self, name, description, unit=None, values=[], type=None, group=None, inverse=False, - options=[], default=None, tooltip=None, sort_index=0, select_items=None): + options=[], default=None, tooltip=None, sort_index=0, select_items=None, enables=None): self.name = name self.description = description self.unit = unit @@ -40,6 +40,7 @@ class Param(object): self.tooltip = tooltip self.sort_index = sort_index self.select_items = select_items + self.enables = enables def __repr__(self): return "Param(%s)" % vars(self) diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py index f65c9c2b..188c2ad7 100644 --- a/lib/elements/fill_stitch.py +++ b/lib/elements/fill_stitch.py @@ -487,19 +487,20 @@ class FillStitch(EmbroideryElement): return max(self.get_float_param("running_stitch_tolerance_mm", 0.2), 0.01) @property - @param('enable_random_stitches', - _('Randomize stitches'), + @param('enable_random_stitch_length', + _('Randomize stitch length'), tooltip=_('Randomize stitch length and phase instead of dividing evenly or staggering. ' 'This is recommended for closely-spaced curved fills to avoid Moiré artefacts.'), type='boolean', + enables=['random_stitch_length_jitter_percent'], select_items=[('fill_method', 'auto_fill'), ('fill_method', 'contour_fill'), ('fill_method', 'guided_fill'), ('fill_method', 'circular_fill')], default=False, sort_index=44) - def enable_random_stitches(self): - return self.get_boolean_param('enable_random_stitches', False) + def enable_random_stitch_length(self): + return self.get_boolean_param('enable_random_stitch_length', False) @property @param('random_stitch_length_jitter_percent', @@ -1023,7 +1024,7 @@ class FillStitch(EmbroideryElement): ending_point, self.underpath, self.gap_fill_rows, - self.enable_random_stitches, + self.enable_random_stitch_length, self.random_stitch_length_jitter, self.random_seed, ) @@ -1049,7 +1050,7 @@ class FillStitch(EmbroideryElement): self.smoothness, starting_point, self.avoid_self_crossing, - self.enable_random_stitches, + self.enable_random_stitch_length, self.random_stitch_length_jitter, self.random_seed ) @@ -1059,7 +1060,7 @@ class FillStitch(EmbroideryElement): self.max_stitch_length, self.running_stitch_tolerance, starting_point, - self.enable_random_stitches, + self.enable_random_stitch_length, self.random_stitch_length_jitter, self.random_seed ) @@ -1069,7 +1070,7 @@ class FillStitch(EmbroideryElement): self.max_stitch_length, self.running_stitch_tolerance, starting_point, - self.enable_random_stitches, + self.enable_random_stitch_length, self.random_stitch_length_jitter, self.random_seed ) @@ -1110,7 +1111,7 @@ class FillStitch(EmbroideryElement): ending_point, self.underpath, self.guided_fill_strategy, - self.enable_random_stitches, + self.enable_random_stitch_length, self.random_stitch_length_jitter, self.random_seed, ) @@ -1164,7 +1165,7 @@ class FillStitch(EmbroideryElement): ending_point, self.underpath, target, - self.enable_random_stitches, + self.enable_random_stitch_length, self.random_stitch_length_jitter, self.random_seed, ) diff --git a/lib/elements/stroke.py b/lib/elements/stroke.py index 0bb18ce8..1be3953d 100644 --- a/lib/elements/stroke.py +++ b/lib/elements/stroke.py @@ -130,16 +130,17 @@ class Stroke(EmbroideryElement): return max(self.get_float_param("running_stitch_tolerance_mm", 0.2), 0.01) @property - @param('enable_random_stitches', - _('Randomize stitches'), + @param('enable_random_stitch_length', + _('Randomized stitch length'), tooltip=_('Randomize stitch length and phase instead of dividing evenly or staggering. ' 'This is recommended for closely-spaced curved fills to avoid Moiré artefacts.'), type='boolean', select_items=[('stroke_method', 'running_stitch'), ('stroke_method', 'ripple_stitch')], + enables=['random_stitch_length_jitter_percent'], default=False, sort_index=5) - def enable_random_stitches(self): - return self.get_boolean_param('enable_random_stitches', False) + def enable_random_stitch_length(self): + return self.get_boolean_param('enable_random_stitch_length', False) @property @param('random_stitch_length_jitter_percent', @@ -490,9 +491,9 @@ class Stroke(EmbroideryElement): return stitch_group - def running_stitch(self, path, stitch_length, tolerance, enable_random, random_sigma, random_seed): + def running_stitch(self, path, stitch_length, tolerance, enable_random_stitch_length, random_sigma, random_seed): # running stitch with repeats - stitches = running_stitch(path, stitch_length, tolerance, enable_random, random_sigma, random_seed) + stitches = running_stitch(path, stitch_length, tolerance, enable_random_stitch_length, random_sigma, random_seed) repeated_stitches = [] # go back and forth along the path as specified by self.repeats @@ -573,7 +574,7 @@ class Stroke(EmbroideryElement): # running stitch else: stitch_group = self.running_stitch(path, self.running_stitch_length, self.running_stitch_tolerance, - self.enable_random_stitches, self.random_stitch_length_jitter, self.random_seed) + self.enable_random_stitch_length, self.random_stitch_length_jitter, self.random_seed) # bean stitch if any(self.bean_stitch_repeats): stitch_group.stitches = self.do_bean_repeats(stitch_group.stitches) |
