diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-08-25 11:47:48 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-08-25 11:47:48 -0400 |
| commit | 11d3cea80caeb9738a2eb02473801487c2acba3b (patch) | |
| tree | 13510f23e5041628ef96997f14d852482ff04000 /lib/extensions/base.py | |
| parent | c5bd1878846c17309c99ad7554d4645088de9629 (diff) | |
| parent | 6a16e90081e619eac5921bd8614c0c46dc83f852 (diff) | |
Merge remote-tracking branch 'origin/master' into simulator-timeline
Diffstat (limited to 'lib/extensions/base.py')
| -rw-r--r-- | lib/extensions/base.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/extensions/base.py b/lib/extensions/base.py index 571e3c2d..25de441f 100644 --- a/lib/extensions/base.py +++ b/lib/extensions/base.py @@ -3,11 +3,12 @@ import re import json from copy import deepcopy from collections import MutableMapping +from stringcase import snakecase -from ..svg.tags import * +from ..svg.tags import SVG_GROUP_TAG, INKSCAPE_GROUPMODE, SVG_DEFS_TAG, EMBROIDERABLE_TAGS, SVG_POLYLINE_TAG from ..elements import AutoFill, Fill, Stroke, SatinColumn, Polyline, EmbroideryElement -from ..utils import cache from ..commands import is_command, layer_commands +from ..i18n import _ SVG_METADATA_TAG = inkex.addNS("metadata", "svg") @@ -98,17 +99,21 @@ class InkStitchMetadata(MutableMapping): class InkstitchExtension(inkex.Effect): """Base class for Inkstitch extensions. Not intended for direct use.""" + @classmethod + def name(cls): + return snakecase(cls.__name__) + def hide_all_layers(self): for g in self.document.getroot().findall(SVG_GROUP_TAG): if g.get(INKSCAPE_GROUPMODE) == "layer": g.set("style", "display:none") def no_elements_error(self): - if self.selected: - inkex.errormsg(_("No embroiderable paths selected.")) - else: - inkex.errormsg(_("No embroiderable paths found in document.")) - inkex.errormsg(_("Tip: use Path -> Object to Path to convert non-paths.")) + if self.selected: + inkex.errormsg(_("No embroiderable paths selected.")) + else: + inkex.errormsg(_("No embroiderable paths found in document.")) + inkex.errormsg(_("Tip: use Path -> Object to Path to convert non-paths.")) def descendants(self, node, selected=False): nodes = [] @@ -118,7 +123,7 @@ class InkstitchExtension(inkex.Effect): return [] if node.tag == SVG_GROUP_TAG and node.get(INKSCAPE_GROUPMODE) == "layer": - if layer_commands(node, "ignore_layer"): + if len(list(layer_commands(node, "ignore_layer"))): return [] if element.has_style('display') and element.get_style('display') is None: @@ -171,7 +176,6 @@ class InkstitchExtension(inkex.Effect): return classes - def get_elements(self): self.elements = [] for node in self.get_nodes(): @@ -207,7 +211,6 @@ class InkstitchExtension(inkex.Effect): return svg_filename - def parse(self): """Override inkex.Effect to add Ink/Stitch xml namespace""" |
