diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2022-05-20 12:06:31 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-20 12:06:31 -0400 |
| commit | 8ab4abf190778867a8eccde08733c45f3760b2d0 (patch) | |
| tree | f5b63f5e192c36d8c6bf47e4c30c68d8b1a73728 /lib/elements/element.py | |
| parent | 1316e8132e58361f42cb4315c586e0e2cccfc64c (diff) | |
| parent | 47123198760f8740acda0799d3b22f14b3f69550 (diff) | |
Merge pull request #1548 from inkstitch/feature_guided_fill
Feature guided fill
Diffstat (limited to 'lib/elements/element.py')
| -rw-r--r-- | lib/elements/element.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py index 05bfd353..3648760b 100644 --- a/lib/elements/element.py +++ b/lib/elements/element.py @@ -20,7 +20,7 @@ from ..utils import Point, cache 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): + options=[], default=None, tooltip=None, sort_index=0, select_items=None): self.name = name self.description = description self.unit = unit @@ -32,6 +32,7 @@ class Param(object): self.default = default self.tooltip = tooltip self.sort_index = sort_index + self.select_items = select_items def __repr__(self): return "Param(%s)" % vars(self) @@ -86,8 +87,11 @@ class EmbroideryElement(object): return params def replace_legacy_param(self, param): - value = self.node.get(param, "").strip() - self.set_param(param[10:], value) + # remove "embroider_" prefix + new_param = param[10:] + if new_param in INKSTITCH_ATTRIBS: + value = self.node.get(param, "").strip() + self.set_param(param[10:], value) del self.node.attrib[param] @cache @@ -202,7 +206,7 @@ class EmbroideryElement(object): # L10N options to allow lock stitch before and after objects options=[_("Both"), _("Before"), _("After"), _("Neither")], default=0, - sort_index=4) + sort_index=10) @cache def ties(self): return self.get_int_param("ties", 0) @@ -214,7 +218,7 @@ class EmbroideryElement(object): 'even if the distance to the next object is shorter than defined by the collapse length value in the Ink/Stitch preferences.'), type='boolean', default=False, - sort_index=5) + sort_index=10) @cache def force_lock_stitches(self): return self.get_boolean_param('force_lock_stitches', False) @@ -263,6 +267,11 @@ class EmbroideryElement(object): return apply_transforms(self.path, self.node) @property + @cache + def paths(self): + return self.flatten(self.parse_path()) + + @property def shape(self): raise NotImplementedError("INTERNAL ERROR: %s must implement shape()", self.__class__) |
