diff options
| -rw-r--r-- | lib/commands.py | 84 | ||||
| -rw-r--r-- | lib/extensions/__init__.py | 2 | ||||
| -rw-r--r-- | lib/extensions/base.py | 2 | ||||
| -rw-r--r-- | lib/extensions/global_commands.py | 12 | ||||
| -rwxr-xr-x | lib/inx/extensions.py | 9 | ||||
| -rw-r--r-- | lib/output.py | 65 | ||||
| -rw-r--r-- | messages.po | 98 | ||||
| -rw-r--r-- | symbols/inkstitch.svg | 71 | ||||
| -rw-r--r-- | templates/global_commands.inx | 26 | ||||
| -rw-r--r-- | templates/layer_commands.inx | 4 | ||||
| -rw-r--r-- | templates/object_commands.inx | 6 |
11 files changed, 290 insertions, 89 deletions
diff --git a/lib/commands.py b/lib/commands.py index 7764539c..db3c8a71 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -1,33 +1,42 @@ +import sys import inkex import cubicsuperpath +import simpletransform -from .svg import apply_transforms +from .svg import apply_transforms, get_node_transform from .svg.tags import SVG_USE_TAG, SVG_SYMBOL_TAG, CONNECTION_START, CONNECTION_END, XLINK_HREF -from .utils import cache +from .utils import cache, Point from .i18n import _, N_ COMMANDS = { # L10N command attached to an object - "fill_start": N_("Fill stitch starting position"), + N_("fill_start"): N_("Fill stitch starting position"), # L10N command attached to an object - "fill_end": N_("Fill stitch ending position"), + N_("fill_end"): N_("Fill stitch ending position"), # L10N command attached to an object - "stop": N_("Stop (pause machine) after sewing this object"), + N_("stop"): N_("Stop (pause machine) after sewing this object"), # L10N command attached to an object - "trim": N_("Trim thread after sewing this object"), + N_("trim"): N_("Trim thread after sewing this object"), # L10N command attached to an object - "ignore_object": N_("Ignore this object (do not stitch)"), + N_("ignore_object"): N_("Ignore this object (do not stitch)"), - # L10N command that affects entire layer - "ignore_layer": N_("Ignore layer (do not stitch any objects in this layer)") + # L10N command that affects a layer + N_("ignore_layer"): N_("Ignore layer (do not stitch any objects in this layer)"), + + # L10N command that affects entire document + N_("origin"): N_("Origin for exported embroidery files"), + + # L10N command that affects entire document + N_("stop_position"): N_("Jump destination for Stop commands (a.k.a. \"Frame Out position\")."), } OBJECT_COMMANDS = ["fill_start", "fill_end", "stop", "trim", "ignore_object"] LAYER_COMMANDS = ["ignore_layer"] +GLOBAL_COMMANDS = ["origin", "stop_position"] class CommandParseError(Exception): @@ -117,9 +126,18 @@ class StandaloneCommand(BaseCommand): self.parse_symbol() + @property + @cache + def point(self): + pos = [float(self.node.get("x", 0)), float(self.node.get("y", 0))] + transform = get_node_transform(self.node) + simpletransform.applyTransformToPoint(transform, pos) + + return Point(*pos) + def get_command_description(command): - return _(COMMANDS[command]) + return COMMANDS[command] def find_commands(node): @@ -144,31 +162,57 @@ def find_commands(node): def layer_commands(layer, command): """Find standalone (unconnected) command symbols in this layer.""" - commands = [] + for global_command in global_commands(layer.getroottree().getroot(), command): + if layer in global_command.node.iterancestors(): + yield global_command + - for standalone_command in standalone_commands(layer.getroottree().getroot()): +def global_commands(svg, command): + """Find standalone (unconnected) command symbols anywhere in the document.""" + + for standalone_command in _standalone_commands(svg): if standalone_command.command == command: - if layer in standalone_command.node.iterancestors(): - commands.append(command) + yield standalone_command - return commands +@cache +def global_command(svg, command): + """Find a single command of the specified type. -def standalone_commands(svg): + If more than one is found, print an error and exit. + """ + + commands = list(global_commands(svg, command)) + + if len(commands) == 1: + return commands[0] + elif len(commands) > 1: + print >> sys.stderr, _("Error: there is more than one %(command)s command in the document, but there can only be one. " + "Please remove all but one.") % dict(command=command) + + # L10N This is a continuation of the previous error message, letting the user know + # what command we're talking about since we don't normally expose the actual + # command name to them. Contents of %(description)s are in a separate translation + # string. + print >> sys.stderr, _("%(command)s: %(description)s") % dict(command=command, description=_(get_command_description(command))) + + sys.exit(1) + else: + return None + + +def _standalone_commands(svg): """Find all unconnected command symbols in the SVG.""" xpath = ".//svg:use[starts-with(@xlink:href, '#inkstitch_')]" symbols = svg.xpath(xpath, namespaces=inkex.NSS) - commands = [] for symbol in symbols: try: - commands.append(StandaloneCommand(symbol)) + yield StandaloneCommand(symbol) except CommandParseError: pass - return commands - def is_command(node): return CONNECTION_START in node.attrib or CONNECTION_END in node.attrib diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py index cf0313b2..5b72ecb3 100644 --- a/lib/extensions/__init__.py +++ b/lib/extensions/__init__.py @@ -9,6 +9,7 @@ from zip import Zip from flip import Flip from object_commands import ObjectCommands from layer_commands import LayerCommands +from global_commands import GlobalCommands from convert_to_satin import ConvertToSatin __all__ = extensions = [Embroider, @@ -22,4 +23,5 @@ __all__ = extensions = [Embroider, Flip, ObjectCommands, LayerCommands, + GlobalCommands, ConvertToSatin] diff --git a/lib/extensions/base.py b/lib/extensions/base.py index 22bc82db..25de441f 100644 --- a/lib/extensions/base.py +++ b/lib/extensions/base.py @@ -123,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: diff --git a/lib/extensions/global_commands.py b/lib/extensions/global_commands.py new file mode 100644 index 00000000..9655c7af --- /dev/null +++ b/lib/extensions/global_commands.py @@ -0,0 +1,12 @@ +from .layer_commands import LayerCommands +from ..commands import GLOBAL_COMMANDS + + +# It's a bit weird subclassing this from LayerCommands, but global commands +# must still be placed in a layer. That means the two extensions +# do the same thing and the code is the same. We keep this as separate +# extensions because we want the user to understand that global commands +# affect the entire document, not just the current layer. + +class GlobalCommands(LayerCommands): + COMMANDS = GLOBAL_COMMANDS diff --git a/lib/inx/extensions.py b/lib/inx/extensions.py index 4b4b3c13..d1a0c7f3 100755 --- a/lib/inx/extensions.py +++ b/lib/inx/extensions.py @@ -3,7 +3,7 @@ import pyembroidery from .utils import build_environment, write_inx_file from .outputs import pyembroidery_output_formats from ..extensions import extensions, Input, Output -from ..commands import LAYER_COMMANDS, OBJECT_COMMANDS, COMMANDS +from ..commands import LAYER_COMMANDS, OBJECT_COMMANDS, GLOBAL_COMMANDS, COMMANDS def layer_commands(): @@ -13,6 +13,10 @@ def layer_commands(): return [(command, COMMANDS[command]) for command in LAYER_COMMANDS] +def global_commands(): + return [(command, COMMANDS[command]) for command in GLOBAL_COMMANDS] + + def object_commands(): return [(command, COMMANDS[command]) for command in OBJECT_COMMANDS] @@ -35,4 +39,5 @@ def generate_extension_inx_files(): write_inx_file(name, template.render(formats=pyembroidery_output_formats(), debug_formats=pyembroidery_debug_formats(), layer_commands=layer_commands(), - object_commands=object_commands())) + object_commands=object_commands(), + global_commands=global_commands())) diff --git a/lib/output.py b/lib/output.py index eed665ed..d5c513e2 100644 --- a/lib/output.py +++ b/lib/output.py @@ -1,10 +1,9 @@ import pyembroidery -import inkex import simpletransform -import shapely.geometry as shgeo from .utils import Point from .svg import PIXELS_PER_MM, get_doc_size, get_viewbox_transform +from .commands import global_command def get_command(stitch): @@ -26,58 +25,30 @@ def _string_to_floats(string): def get_origin(svg): - # The user can specify the embroidery origin by defining two guides - # named "embroidery origin" that intersect. + origin_command = global_command(svg, "origin") - namedview = svg.find(inkex.addNS('namedview', 'sodipodi')) - all_guides = namedview.findall(inkex.addNS('guide', 'sodipodi')) - label_attribute = inkex.addNS('label', 'inkscape') - guides = [guide for guide in all_guides - if guide.get(label_attribute, "").startswith("embroidery origin")] + if origin_command: + return origin_command.point + else: + # default: center of the canvas - # document size used below - doc_size = list(get_doc_size(svg)) + doc_size = list(get_doc_size(svg)) - # convert the size from viewbox-relative to real-world pixels - viewbox_transform = get_viewbox_transform(svg) - simpletransform.applyTransformToPoint(simpletransform.invertTransform(viewbox_transform), doc_size) + # convert the size from viewbox-relative to real-world pixels + viewbox_transform = get_viewbox_transform(svg) + simpletransform.applyTransformToPoint(simpletransform.invertTransform(viewbox_transform), doc_size) - default = [doc_size[0] / 2.0, doc_size[1] / 2.0] - simpletransform.applyTransformToPoint(viewbox_transform, default) - default = Point(*default) + default = [doc_size[0] / 2.0, doc_size[1] / 2.0] + simpletransform.applyTransformToPoint(viewbox_transform, default) + default = Point(*default) - if len(guides) < 2: return default - # Find out where the guides intersect. Only pay attention to the first two. - guides = guides[:2] - - lines = [] - for guide in guides: - # inkscape's Y axis is reversed from SVG's, and the guide is in inkscape coordinates - position = Point(*_string_to_floats(guide.get('position'))) - position.y = doc_size[1] - position.y - - # This one baffles me. I think inkscape might have gotten the order of - # their vector wrong? - parts = _string_to_floats(guide.get('orientation')) - direction = Point(parts[1], parts[0]) - - # We have a theoretically infinite line defined by a point on the line - # and a vector direction. Shapely can only deal in concrete line - # segments, so we'll pick points really far in either direction on the - # line and call it good enough. - lines.append(shgeo.LineString((position + 100000 * direction, position - 100000 * direction))) - intersection = lines[0].intersection(lines[1]) - - if isinstance(intersection, shgeo.Point): - origin = [intersection.x, intersection.y] - simpletransform.applyTransformToPoint(viewbox_transform, origin) - return Point(*origin) - else: - # Either the two guides are the same line, or they're parallel. - return default +def jump_to_stop_point(pattern, svg): + stop_position = global_command(svg, "stop_position") + if stop_position: + pattern.add_stitch_absolute(pyembroidery.JUMP, stop_position.point.x, stop_position.point.y) def write_embroidery_file(file_path, stitch_plan, svg): @@ -89,6 +60,8 @@ def write_embroidery_file(file_path, stitch_plan, svg): pattern.add_thread(color_block.color.pyembroidery_thread) for stitch in color_block: + if stitch.stop: + jump_to_stop_point(pattern, svg) command = get_command(stitch) pattern.add_stitch_absolute(command, stitch.x, stitch.y) diff --git a/messages.po b/messages.po index 5443542a..9105da77 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-08-24 20:45-0400\n" +"POT-Creation-Date: 2018-08-24 20:56-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -18,35 +18,94 @@ msgstr "" "Generated-By: Babel 2.5.3\n" #. command attached to an object -#: lib/commands.py:11 +#: lib/commands.py:13 +msgid "fill_start" +msgstr "" + +#: lib/commands.py:13 msgid "Fill stitch starting position" msgstr "" #. command attached to an object -#: lib/commands.py:14 +#: lib/commands.py:16 +msgid "fill_end" +msgstr "" + +#: lib/commands.py:16 msgid "Fill stitch ending position" msgstr "" #. command attached to an object -#: lib/commands.py:17 +#: lib/commands.py:19 +msgid "stop" +msgstr "" + +#: lib/commands.py:19 msgid "Stop (pause machine) after sewing this object" msgstr "" #. command attached to an object -#: lib/commands.py:20 +#: lib/commands.py:22 +msgid "trim" +msgstr "" + +#: lib/commands.py:22 msgid "Trim thread after sewing this object" msgstr "" #. command attached to an object -#: lib/commands.py:23 +#: lib/commands.py:25 +msgid "ignore_object" +msgstr "" + +#: lib/commands.py:25 msgid "Ignore this object (do not stitch)" msgstr "" -#. command that affects entire layer -#: lib/commands.py:26 +#. command that affects a layer +#: lib/commands.py:28 +msgid "ignore_layer" +msgstr "" + +#: lib/commands.py:28 msgid "Ignore layer (do not stitch any objects in this layer)" msgstr "" +#. command that affects entire document +#: lib/commands.py:31 +msgid "origin" +msgstr "" + +#: lib/commands.py:31 +msgid "Origin for exported embroidery files" +msgstr "" + +#. command that affects entire document +#: lib/commands.py:34 +msgid "stop_position" +msgstr "" + +#: lib/commands.py:34 +msgid "Jump destination for Stop commands (a.k.a. \"Frame Out position\")." +msgstr "" + +#: lib/commands.py:190 +#, python-format +msgid "" +"Error: there is more than one %(command)s command in the document, but " +"there can only be one. Please remove all but one." +msgstr "" + +#. This is a continuation of the previous error message, letting the user know +#. what command we're talking about since we don't normally expose the actual +#. command name to them. Contents of %(description)s are in a separate +#. translation +#. string. +#: lib/commands.py:197 +#, python-format +msgid "%(command)s: %(description)s" +msgstr "" + #: lib/elements/auto_fill.py:11 msgid "Auto-Fill" msgstr "" @@ -1117,9 +1176,10 @@ msgstr "" #. to your language's word for its language, e.g. "EspaƱol" for the spanish #. translation. #: templates/convert_to_satin.inx:12 templates/embroider.inx:24 -#: templates/flip.inx:12 templates/install.inx:12 -#: templates/layer_commands.inx:16 templates/object_commands.inx:15 -#: templates/params.inx:12 templates/print.inx:12 templates/simulate.inx:12 +#: templates/flip.inx:12 templates/global_commands.inx:16 +#: templates/install.inx:12 templates/layer_commands.inx:16 +#: templates/object_commands.inx:15 templates/params.inx:12 +#: templates/print.inx:12 templates/simulate.inx:12 msgid "English" msgstr "" @@ -1165,6 +1225,20 @@ msgstr "" msgid "Flip Satin Columns" msgstr "" +#: templates/global_commands.inx:3 +msgid "Add Commands" +msgstr "" + +#: templates/global_commands.inx:7 +msgid "These commands affect the entire embroidery design." +msgstr "" + +#. Inkscape submenu under Extensions -> Ink/Stitch +#: templates/global_commands.inx:18 templates/layer_commands.inx:17 +#: templates/object_commands.inx:16 +msgid "Commands" +msgstr "" + #: templates/input.inx:11 #, python-format msgid "convert %(file_extension)s file to Ink/Stitch manual-stitch paths" @@ -1183,7 +1257,7 @@ msgid "Commands will be added to the currently-selected layer." msgstr "" #: templates/object_commands.inx:3 -msgid "Attach Commands" +msgid "Attach Commands to Selected Objects" msgstr "" #: templates/output.inx:11 diff --git a/symbols/inkstitch.svg b/symbols/inkstitch.svg index e951449d..6095caf0 100644 --- a/symbols/inkstitch.svg +++ b/symbols/inkstitch.svg @@ -25,9 +25,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="4" - inkscape:cx="141.99463" - inkscape:cy="281.10022" + inkscape:zoom="2.828427" + inkscape:cx="159.63333" + inkscape:cy="278.06489" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -149,8 +149,8 @@ </symbol> <symbol id="inkstitch_ignore_layer"> - <title - id="title25366">Ignore entire layer when generating stitch plan</title> + <title + id="title9694">Ignore entire layer when generating stitch plan</title> <path id="inkstitch_path25368-7" d="M 9.2465269,-4.9265995e-6 C 9.246525,5.1067241 5.1067028,9.2465451 -2.615882e-5,9.2465451 -5.1067554,9.2465451 -9.2465782,5.1067241 -9.2465801,-4.9265995e-6 -9.24658,-2.4523429 -8.2723922,-4.8042399 -6.538327,-6.5383059 c 1.7340653,-1.734065 4.0859624,-2.708252 6.53830084118,-2.708252 5.10673015882,0 9.24655285882,4.139823 9.24655305882,9.2465529734005 0,0 0,0 0,0" @@ -198,6 +198,51 @@ width="100%" height="100%" /> </symbol> + <symbol + style="display:inline" + id="inkstitch_stop_position"> + <title + id="inkstitch_title9427-6">Jump destination for Stop commands (a.k.a. "Frame Out position").</title> + <path + inkscape:connector-curvature="0" + style="opacity:1;vector-effect:none;fill:#fafafa;fill-opacity:1;fill-rule:evenodd;stroke:#003399;stroke-width:1.06500006;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:3.19500017, 3.19500017;stroke-dashoffset:0;stroke-opacity:1" + d="m 9.220113,0.07922893 c -1.9e-6,5.10672897 -4.1398241,9.24654997 -9.24655297,9.24654997 -5.10672933,0 -9.24655213,-4.139821 -9.24655403,-9.24654997 1e-7,-2.45233803 0.9741879,-4.80423503 2.7082531,-6.53830103 1.7340653,-1.734065 4.0859624,-2.708252 6.53830093,-2.708252 5.10673007,0 9.24655277,4.139823 9.24655297,9.24655303 0,0 0,0 0,0" + id="inkstitch_circle13166-7" /> + <path + inkscape:connector-curvature="0" + id="inkstitch_rect5371-2-5" + d="m 4.570439,1.4295589 c 0,0 0,2.32837 0,2.32837 0,0 -9.140878,0 -9.140878,0 0,0 0,-2.32837 0,-2.32837 0,0 9.140878,0 9.140878,0" + style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.27154255;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:4.81866985, 4.81866985;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" /> + <path + inkscape:connector-curvature="0" + id="inkstitch_rect5371-2-5-3" + d="m 4.570439,0.00792594 c 0,0 -9.140878,0 -9.140878,0 0,0 4.570439028610238,-4.51587004 4.570439028610238,-4.51587004 0,0 4.570438971389763,4.51587004 4.570438971389763,4.51587004" + style="display:inline;opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.27154255;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:4.81866985, 4.81866985;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" /> + </symbol> + <symbol + id="inkstitch_origin" + style="display:inline"> + <title + id="inkstitch_title9427-67">Origin for exported embroidery files</title> + <path + style="opacity:1;vector-effect:none;fill:#fafafa;fill-opacity:1;fill-rule:evenodd;stroke:#003399;stroke-width:1.06500006;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:3.19500017, 3.19500017;stroke-dashoffset:0;stroke-opacity:1" + d="m 9.220113,0.07922893 c -1.9e-6,5.10672897 -4.1398241,9.24654997 -9.24655297,9.24654997 -5.10672933,0 -9.24655213,-4.139821 -9.24655403,-9.24654997 1e-7,-2.45233803 0.9741879,-4.80423503 2.7082531,-6.53830103 1.7340653,-1.734065 4.0859624,-2.708252 6.53830093,-2.708252 5.10673007,0 9.24655277,4.139823 9.24655297,9.24655303 0,0 0,0 0,0" + id="inkstitch_circle13166-5" + inkscape:connector-curvature="0" /> + <g + id="g27211"> + <path + id="inkstitch_rect5371-2-3" + d="m -3.8183594,-6.3222656 c 0,0 -1.9511718,3.375 -1.9511718,3.375 0,0 0.9746093,0 0.9746093,0 0,0 0,2.33984372 0,2.33984372 0,0 -0.703125,0 -0.703125,0 0,0 0,0.6484375 0,0.6484375 0,0 0.703125,0 0.703125,0 0,0 0,1.60156248 0,1.60156248 0,0 -0.703125,0 -0.703125,0 0,0 0,0.6484375 0,0.6484375 0,0 0.703125,0 0.703125,0 0,0 0,2.9003906 0,2.9003906 0,0 3.7675781,0 3.7675781,0 0,0 0,0.7265626 0,0.7265626 0,0 0.65039068,0 0.65039068,0 0,0 0,-0.7265626 0,-0.7265626 0,0 1.59960932,0 1.59960932,0 0,0 0,0.7265626 0,0.7265626 0,0 0.6503907,0 0.6503907,0 0,0 0,-0.7265626 0,-0.7265626 0,0 1.8242187,0 1.8242187,0 0,0 0,0.9746094 0,0.9746094 0,0 3.3730469,-1.9492187 3.3730469,-1.9492187 0,0 -3.3730469,-1.9492188 -3.3730469,-1.9492188 0,0 0,0.9746094 0,0.9746094 0,0 -1.8242187,0 -1.8242187,0 0,0 0,-0.7265625 0,-0.7265625 0,0 -0.6503907,0 -0.6503907,0 0,0 0,0.7265625 0,0.7265625 0,0 -1.59960932,0 -1.59960932,0 0,0 0,-0.7265625 0,-0.7265625 0,0 -0.65039068,0 -0.65039068,0 0,0 0,0.7265625 0,0.7265625 0,0 -1.8164062,0 -1.8164062,0 0,0 0,-0.9511719 0,-0.9511719 0,0 0.75,0 0.75,0 0,0 0,-0.6484375 0,-0.6484375 0,0 -0.75,0 -0.75,0 0,0 0,-1.60156248 0,-1.60156248 0,0 0.75,0 0.75,0 0,0 0,-0.6484375 0,-0.6484375 0,0 -0.75,0 -0.75,0 0,0 0,-2.33984372 0,-2.33984372 0,0 0.9746094,0 0.9746094,0 0,0 -1.9492188,-3.375 -1.9492188,-3.375" + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.95000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + inkscape:connector-curvature="0" /> + </g> + <path + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.23560667px;line-height:100%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;display:inline;opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.18200287;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" + d="m 0.57260898,-3.1777344 c -0.071734,-1.477e-4 -0.1459261,0.023966 -0.203125,0.070312 -0.001979,0.00126 -0.003933,0.00257 -0.00586,0.00391 -0.1089887,0.095935 -0.2036022,0.1946157 -0.2851562,0.2988281 -0.080937,0.103424 -0.1496356,0.2111305 -0.203125,0.3242187 -0.053925,0.1140093 -0.092467,0.2338978 -0.1171875,0.3554688 -0.024626,0.1211014 -0.037109,0.2469313 -0.037109,0.3769531 0,0 0,0.00391 0,0.00391 -1e-7,0.1308008 0.012438,0.2575792 0.037109,0.3789062 0.024772,0.1208588 0.063476,0.2399564 0.1171875,0.3535156 0.053489,0.1130885 0.1221879,0.2207947 0.203125,0.3242188 0.079746,0.1019017 0.1731573,0.2012789 0.28125,0.296875 0.057512,0.054401 0.1230095,0.072299 0.1816406,0.076172 0.058631,0.00387 0.1145272,-0.00646 0.171875,-0.037109 0.057348,-0.030654 0.123751,-0.098677 0.1328125,-0.1914063 0.00897,-0.091756 -0.035792,-0.1679217 -0.087891,-0.2226562 0,0 -0.00195,-0.00196 -0.00195,-0.00196 -0.042833,-0.045359 -0.0821932,-0.091351 -0.1171901,-0.1367188 -0.0646652,-0.085061 -0.1178725,-0.1718145 -0.1582031,-0.2597656 -0.0404721,-0.08826 -0.0692154,-0.1791742 -0.0898438,-0.2753906 0,0 0,-0.00195 0,-0.00195 -0.019368,-0.095905 -0.029297,-0.1972936 -0.029297,-0.3046876 0,-0.1073939 0.00993,-0.2087828 0.029297,-0.3046874 0,0 0,-0.00195 0,-0.00195 0.020577,-0.095962 0.049404,-0.1859964 0.089844,-0.2734375 0.040331,-0.087951 0.093538,-0.1747036 0.1582031,-0.2597656 0.034608,-0.045272 0.072382,-0.090974 0.1132813,-0.1347656 0.1100322,-0.1004922 0.106643,-0.2892446 0.00977,-0.3847657 -0.048439,-0.04776 -0.1177191,-0.072118 -0.1894532,-0.072266 0,0 -4.1e-6,-6.4e-6 -4.1e-6,-6.4e-6 m 5.98828132,0 c -0.071651,7.8e-5 -0.1408014,0.023039 -0.1894531,0.070312 -0.097304,0.094548 -0.1026997,0.2857883 0.00781,0.3867188 0.042446,0.045212 0.082141,0.091474 0.1152343,0.1347656 0.063728,0.083829 0.1151348,0.1701035 0.15625,0.2597656 0.041495,0.089724 0.071628,0.1807109 0.091797,0.2753907 0.019368,0.095905 0.029297,0.1972939 0.029297,0.3046874 0,0.1080768 -0.00969,0.210199 -0.029297,0.3066407 -0.020235,0.094281 -0.050544,0.1854295 -0.091797,0.2753906 -0.041114,0.089661 -0.092522,0.1759365 -0.15625,0.2597656 -0.035531,0.046061 -0.07555,0.092638 -0.1191406,0.1386719 -0.052099,0.054735 -0.096857,0.1309001 -0.087891,0.2226562 0.00906,0.092729 0.075465,0.1607525 0.1328125,0.1914063 0.057348,0.030654 0.1132438,0.040982 0.171875,0.037109 0.058631,-0.00387 0.1241291,-0.021771 0.1816406,-0.076172 0.1080928,-0.095596 0.2015041,-0.1949734 0.2812503,-0.296875 0.08094,-0.1034241 0.149635,-0.2111302 0.203125,-0.3242188 0.05371,-0.1135599 0.09242,-0.2326573 0.117187,-0.3535156 0.02467,-0.1213269 0.03711,-0.2481053 0.03711,-0.3789062 0,0 0,-0.00391 0,-0.00391 0,-0.1300217 -0.01248,-0.2558514 -0.03711,-0.3769531 -0.02472,-0.1215662 -0.06326,-0.2414547 -0.117184,-0.3554641 -0.05349,-0.1130875 -0.122188,-0.2207943 -0.203125,-0.3242187 -0.081554,-0.1042124 -0.176168,-0.2028933 -0.2851566,-0.2988281 -0.00193,-0.00134 -0.00388,-0.00265 -0.00586,-0.00391 -0.05737,-0.046485 -0.1314738,-0.07039 -0.203125,-0.070312 0,0 6e-7,3.2e-6 6e-7,3.2e-6 m -4.7011719,0.3515625 c -0.1283255,0 -0.2496161,0.018417 -0.3613281,0.052734 -0.1205672,0.03623 -0.231977,0.1029821 -0.3222656,0.1953125 -0.092899,0.095 -0.158771,0.2147859 -0.20507822,0.3535156 -3.58e-6,6.5e-4 -3.58e-6,0.0013 0,0.00195 -0.047143,0.1440141 -0.068359,0.3107544 -0.068359,0.5058593 0,0.187956 0.021404,0.3526519 0.068359,0.4960938 -3.58e-6,6.5e-4 -3.58e-6,0.0013 0,0.00195 0.046821,0.138265 0.11525652,0.2561727 0.20312502,0.3496094 6.449e-4,6.5506e-4 0.00129,0.001305 0.00195,0.00195 0.086822,0.090925 0.1925294,0.1619069 0.3144532,0.203125 0.113825,0.038479 0.2343925,0.056641 0.359375,0.056641 0.1240896,-10e-8 0.2463111,-0.01819 0.3613281,-0.056641 0.1227637,-0.04104 0.2290582,-0.1116491 0.3164063,-0.203125 0.090879,-0.094856 0.160379,-0.2144584 0.2070312,-0.3515625 0,0 0,-0.00195 0,-0.00195 0.04963,-0.1446454 0.070315,-0.3097522 0.070315,-0.4960938 0,-0.1944243 -0.019335,-0.3619907 -0.068359,-0.5078125 C 2.6898173,-2.3649775 2.6213826,-2.484308 2.5296403,-2.578125 2.4412783,-2.668486 2.3312446,-2.7348378 2.2112809,-2.7714844 c -0.1098451,-0.034511 -0.2276775,-0.054687 -0.3515625,-0.054687 0,0 0,0 0,0 m 3.40625,0 c -0.1283255,0 -0.2509177,0.018217 -0.3632812,0.052734 -0.1211815,0.036426 -0.2311771,0.1041614 -0.3203125,0.1953125 -0.0929,0.095001 -0.1587709,0.2147864 -0.2050781,0.3535156 -3.6e-6,6.5e-4 -3.6e-6,0.0013 0,0.00195 -0.047144,0.144015 -0.068359,0.3107548 -0.068359,0.5058593 0,0.1879556 0.021403,0.352651 0.068359,0.4960938 -3.6e-6,6.5e-4 -3.6e-6,0.0013 0,0.00195 0.04626,0.13661 0.1121532,0.2549502 0.2011718,0.3496094 6.449e-4,6.5506e-4 0.00129,0.001305 0.00195,0.00195 0.087964,0.092121 0.195188,0.1621455 0.3164062,0.203125 0.1138248,0.038479 0.2343924,0.056641 0.359375,0.056641 0.1240899,0 0.2450506,-0.018421 0.359375,-0.056641 0.1227636,-0.04104 0.2290582,-0.1116493 0.3164062,-0.203125 0.090879,-0.094856 0.160379,-0.2144583 0.2070313,-0.3515625 0,0 0,-0.00195 0,-0.00195 0.04909,-0.1430335 0.072266,-0.3084325 0.072266,-0.4960938 0,-0.1956861 -0.021841,-0.3636373 -0.070312,-0.5078125 C 6.0946613,-2.3633389 6.02879,-2.4831245 5.9358903,-2.578125 5.8475279,-2.6684863 5.7374948,-2.7348378 5.6175309,-2.7714844 c -0.1098451,-0.034511 -0.2276775,-0.054687 -0.3515625,-0.054687 0,0 0,0 0,0 m -3.40625,0.5429688 c 0.055432,0 0.1009954,0.00891 0.1367188,0.023437 6.5e-4,3.6e-6 0.0013,3.6e-6 0.00195,0 0.02557,0.00985 0.045222,0.025496 0.070312,0.060547 6.5e-4,3.6e-6 0.0013,3.6e-6 0.00195,0 0.022095,0.030406 0.047135,0.083247 0.064453,0.1621094 -3.6e-6,6.5e-4 -3.6e-6,0.0013 0,0.00195 0.016958,0.076535 0.025391,0.1828146 0.025391,0.3183593 0,0.1285689 -0.010757,0.2344819 -0.029297,0.3105469 -0.0184,0.079083 -0.042145,0.132477 -0.066406,0.1660156 -6.5e-4,-3.6e-6 -0.0013,-3.6e-6 -0.00195,0 -0.02365,0.033039 -0.047699,0.051825 -0.076172,0.064453 -0.036523,0.01511 -0.077371,0.023437 -0.1328125,0.023437 -0.058078,0 -0.1013487,-0.0088 -0.1367188,-0.023437 -0.02914,-0.012911 -0.055461,-0.032877 -0.080078,-0.066406 -0.022766,-0.033187 -0.04635,-0.085255 -0.064453,-0.1621094 0,0 0,-0.00195 0,-0.00195 -0.016808,-0.07661 -0.025391,-0.1812575 -0.025391,-0.3105469 0,-0.1346383 0.00848,-0.2420437 0.025391,-0.3183593 3.6e-6,-6.5e-4 3.6e-6,-0.0013 0,-0.00195 0.017622,-0.080248 0.04212,-0.1316854 0.0625,-0.1601562 0.023285,-0.031716 0.046461,-0.05007 0.078125,-0.0625 0.038881,-0.015263 0.085765,-0.023437 0.1464844,-0.023437 0,0 3.1e-6,-3.4e-6 3.1e-6,-3.4e-6 m 3.40625,0 c 0.055432,0 0.097781,0.0084 0.1347656,0.023437 6.5e-4,3.6e-6 0.0013,3.6e-6 0.00195,0 0.02677,0.010311 0.048719,0.027653 0.072266,0.060547 6.5e-4,3.6e-6 0.0013,3.6e-6 0.00195,0 0.022095,0.030406 0.047135,0.083247 0.064453,0.1621094 -3.6e-6,6.5e-4 -3.6e-6,0.0013 0,0.00195 0.016958,0.076535 0.025391,0.1828146 0.025391,0.3183593 1e-6,0.1285671 -0.010756,0.2344806 -0.029297,0.3105469 -0.0184,0.079083 -0.042145,0.132477 -0.066406,0.1660156 -6.5e-4,-3.6e-6 -0.0013,-3.6e-6 -0.00195,0 -0.02365,0.033039 -0.047699,0.051825 -0.076172,0.064453 -0.036523,0.01511 -0.077371,0.023437 -0.1328126,0.023437 -0.058078,0 -0.1045526,-0.00932 -0.1386718,-0.023437 -0.027839,-0.012332 -0.052016,-0.030845 -0.078125,-0.066406 -0.024212,-0.035177 -0.048775,-0.087353 -0.066406,-0.1621094 0,0 0,-0.00195 0,-0.00195 -0.016808,-0.07661 -0.025391,-0.1812576 -0.025391,-0.3105469 0,-0.1346383 0.00848,-0.2420434 0.025391,-0.3183593 3.6e-6,-6.5e-4 3.6e-6,-0.0013 0,-0.00195 0.017138,-0.078042 0.042536,-0.1295963 0.064453,-0.1601562 0.024828,-0.033817 0.045701,-0.050539 0.076172,-0.0625 0.037688,-0.014795 0.087718,-0.023437 0.1484375,-0.023437 0,0 2.3e-6,-3.4e-6 2.3e-6,-3.4e-6 m -1.5664062,1.0058593 c -0.097876,-0.029355 -0.2049377,-0.028281 -0.3144532,0.00781 -0.1691652,0.055752 -0.26201,0.2041752 -0.2441406,0.3730468 0.00893,0.084436 0.065507,0.1795074 0.1523438,0.2265625 0.00174,9.428e-4 0.00411,-9.08e-4 0.00586,0 -0.03157,0.046422 -0.066871,0.097993 -0.056641,0.1542969 0.013731,0.075568 0.061485,0.1250427 0.109375,0.1542969 0.095781,0.058508 0.2242885,0.048199 0.3203125,-0.025391 0.024113,-0.01848 0.051789,-0.03993 0.080078,-0.070312 0,0 0.00195,-0.00195 0.00195,-0.00195 0.028338,-0.029789 0.049476,-0.061384 0.066406,-0.089844 0,0 0.00195,-0.00195 0.00195,-0.00195 0.04171,-0.070204 0.043422,-0.1104433 0.052734,-0.1542969 0.020331,-0.067932 0.046748,-0.1800329 0.033203,-0.3085938 10e-4,-0.071525 -0.027523,-0.1432706 -0.068359,-0.1835937 -0.044315,-0.043758 -0.091687,-0.0654 -0.140625,-0.080078 0,0 6.5e-6,-3.7e-6 6.5e-6,-3.7e-6" + id="path16421-8" + inkscape:connector-curvature="0" /> + </symbol> </defs> <metadata id="metadata8380"> @@ -276,5 +321,21 @@ width="100%" height="100%" transform="translate(226.77166,75.590554)" /> + <use + transform="translate(264.59335,75.511321)" + height="100%" + width="100%" + y="0" + x="0" + id="use9692" + xlink:href="#inkstitch_frame_out" /> + <use + xlink:href="#inkstitch_origin" + id="use27375" + x="0" + y="0" + width="100%" + height="100%" + transform="translate(302.38862,75.511321)" /> </g> </svg> diff --git a/templates/global_commands.inx b/templates/global_commands.inx new file mode 100644 index 00000000..eda2721d --- /dev/null +++ b/templates/global_commands.inx @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> + <name>{% trans %}Add Commands{% endtrans %}</name> + <id>org.inkstitch.global_commands.{{ locale }}</id> + <dependency type="executable" location="extensions">inkstitch.py</dependency> + <dependency type="executable" location="extensions">inkex.py</dependency> + <param name="description" type="description">{% trans %}These commands affect the entire embroidery design.{% endtrans %}</param> + {% for command, description in global_commands %} + <param name="{{ command }}" type="boolean" _gui-text="{{ _(description) }}">false</param> + {% endfor %} + <param name="extension" type="string" gui-hidden="true">global_commands</param> + <effect> + <object-type>all</object-type> + <effects-menu> + <submenu name="Ink/Stitch"> + <submenu name="{% trans %}English{% endtrans %}"> + {# L10N Inkscape submenu under Extensions -> Ink/Stitch #} + <submenu name="{% trans %}Commands{% endtrans %}" /> + </submenu> + </submenu> + </effects-menu> + </effect> + <script> + <command reldir="extensions" interpreter="python">inkstitch.py</command> + </script> +</inkscape-extension> diff --git a/templates/layer_commands.inx b/templates/layer_commands.inx index a6c0283c..f1a8f987 100644 --- a/templates/layer_commands.inx +++ b/templates/layer_commands.inx @@ -13,7 +13,9 @@ <object-type>all</object-type> <effects-menu> <submenu name="Ink/Stitch"> - <submenu name="{% trans %}English{% endtrans %}" /> + <submenu name="{% trans %}English{% endtrans %}"> + <submenu name="{% trans %}Commands{% endtrans %}" /> + </submenu> </submenu> </effects-menu> </effect> diff --git a/templates/object_commands.inx b/templates/object_commands.inx index 6de2a3fc..68535db2 100644 --- a/templates/object_commands.inx +++ b/templates/object_commands.inx @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <name>{% trans %}Attach Commands{% endtrans %}</name> + <name>{% trans %}Attach Commands to Selected Objects{% endtrans %}</name> <id>org.inkstitch.commands.{{ locale }}</id> <dependency type="executable" location="extensions">inkstitch.py</dependency> <dependency type="executable" location="extensions">inkex.py</dependency> @@ -12,7 +12,9 @@ <object-type>all</object-type> <effects-menu> <submenu name="Ink/Stitch"> - <submenu name="{% trans %}English{% endtrans %}" /> + <submenu name="{% trans %}English{% endtrans %}"> + <submenu name="{% trans %}Commands{% endtrans %}" /> + </submenu> </submenu> </effects-menu> </effect> |
