diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2022-04-24 08:27:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-24 08:27:42 +0200 |
| commit | f9d57f6ea51ea8da186c41b70950b7d87fa2c20b (patch) | |
| tree | 7c2664fc201933b64cc224adb28ff717e6f08c61 /lib/extensions/duplicate_params.py | |
| parent | 4058712139b56a2419e01db700581b3c9554a88a (diff) | |
Fix lettering scale, etc. (#1620)
* fix lettering scale
* adapt to updated inkex: transform operator, selections
* fix #1597
* no traceback error message on broken satin columns
* highlight troubleshoot "steps to solve" through additional headline
* set a minimum value for running stitch repeats
* rename "import" thread list to "apply" thread list
Diffstat (limited to 'lib/extensions/duplicate_params.py')
| -rw-r--r-- | lib/extensions/duplicate_params.py | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/lib/extensions/duplicate_params.py b/lib/extensions/duplicate_params.py index 9fcdbf1c..46110691 100644 --- a/lib/extensions/duplicate_params.py +++ b/lib/extensions/duplicate_params.py @@ -3,10 +3,9 @@ # Copyright (c) 2021 Authors # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. -import inkex +from inkex import NSS, ShapeElement, errormsg from ..i18n import _ -from ..svg.tags import EMBROIDERABLE_TAGS, SVG_GROUP_TAG from .base import InkstitchExtension @@ -14,36 +13,29 @@ class DuplicateParams(InkstitchExtension): # Transfer inkstitch namespaced attributes from the first selected element to the rest of selection def effect(self): - objects = self.get_selected_in_order() + objects = self.svg.selection.get(ShapeElement) if len(objects) < 2: - inkex.errormsg(_("This function copies Ink/Stitch parameters from the first selected element to the rest of the selection. " - "Please select at least two elements.")) + errormsg(_("This function copies Ink/Stitch parameters from the first selected element to the rest of the selection. " + "Please select at least two elements.")) return - copy_from = objects[0] + copy_from = objects.first() copy_from_attribs = self.get_inkstitch_attributes(copy_from) - copy_to_selection = objects[1:] - self.copy_to = [] - - # extract copy_to group elements - for element in copy_to_selection: - if element.tag == SVG_GROUP_TAG: - for descendant in element.iterdescendants(EMBROIDERABLE_TAGS): - self.copy_to.append(descendant) - elif element.tag in EMBROIDERABLE_TAGS: - self.copy_to.append(element) + copy_to = objects # remove inkstitch params from copy_to elements - for element in self.copy_to: + for element in copy_to: + if element == copy_to.first(): + continue copy_to_attribs = self.get_inkstitch_attributes(element) for attrib in copy_to_attribs: element.pop(attrib) # paste inkstitch params from copy_from element to copy_to elements for attrib in copy_from_attribs: - for element in self.copy_to: + for element in copy_to: element.attrib[attrib] = copy_from_attribs[attrib] def get_inkstitch_attributes(self, node): - return {k: v for k, v in node.attrib.iteritems() if inkex.NSS['inkstitch'] in k} + return {k: v for k, v in node.attrib.iteritems() if NSS['inkstitch'] in k} |
