summaryrefslogtreecommitdiff
path: root/lib/elements/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/elements/element.py')
-rw-r--r--lib/elements/element.py30
1 files changed, 26 insertions, 4 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py
index f06982b2..75d22580 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,12 +206,24 @@ 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=50)
@cache
def ties(self):
return self.get_int_param("ties", 0)
@property
+ @param('force_lock_stitches',
+ _('Force lock stitches'),
+ tooltip=_('Sew lock stitches after sewing this element, '
+ '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=51)
+ @cache
+ def force_lock_stitches(self):
+ return self.get_boolean_param('force_lock_stitches', False)
+
+ @property
def path(self):
# A CSP is a "cubic superpath".
#
@@ -251,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__)
@@ -312,6 +333,7 @@ class EmbroideryElement(object):
for patch in patches:
patch.tie_modus = self.ties
+ patch.force_lock_stitches = self.force_lock_stitches
if patches:
patches[-1].trim_after = self.has_command("trim") or self.trim_after