diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-02-22 22:07:15 -0500 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-03-08 19:57:11 -0500 |
| commit | 4ba3cd708561870a731d9634d9cdd5c18579cac7 (patch) | |
| tree | cd901daa9bd9f1901f3dbbca57940a981215267d /lib/extensions/base.py | |
| parent | 3611e2340997b917cc89e7d405b3c7d9bc86aab5 (diff) | |
refactor add_commands() out into commands module
Diffstat (limited to 'lib/extensions/base.py')
| -rw-r--r-- | lib/extensions/base.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/extensions/base.py b/lib/extensions/base.py index 98673541..8d45f790 100644 --- a/lib/extensions/base.py +++ b/lib/extensions/base.py @@ -9,6 +9,7 @@ from stringcase import snakecase from ..commands import layer_commands from ..elements import EmbroideryElement, nodes_to_elements from ..i18n import _ +from ..svg import generate_unique_id from ..svg.tags import SVG_GROUP_TAG, INKSCAPE_GROUPMODE, SVG_DEFS_TAG, EMBROIDERABLE_TAGS @@ -194,15 +195,7 @@ class InkstitchExtension(inkex.Effect): def uniqueId(self, prefix, make_new_id=True): """Override inkex.Effect.uniqueId with a nicer naming scheme.""" - i = 1 - while True: - new_id = "%s%d" % (prefix, i) - if new_id not in self.doc_ids: - break - i += 1 - self.doc_ids[new_id] = 1 - - return new_id + return generate_unique_id(self.document, prefix) def parse(self): """Override inkex.Effect.parse to add Ink/Stitch xml namespace""" |
