summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-07-14 15:40:16 +0200
committerGitHub <noreply@github.com>2024-07-14 15:40:16 +0200
commit6a39662fd15a36a656ad1cf5779c865890d789b3 (patch)
tree5346c66175204660d74100630d58e83d751eeb70
parent2ad75356ddeeaa6d87c10289479e90d50f4a378b (diff)
Command translations (#3075)
* command translations * windows: do not unescape
-rw-r--r--lib/commands.py6
-rw-r--r--lib/extensions/input.py7
-rw-r--r--lib/svg/rendering.py4
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/commands.py b/lib/commands.py
index 8c43aed3..86abe52a 100644
--- a/lib/commands.py
+++ b/lib/commands.py
@@ -296,9 +296,10 @@ def ensure_symbol(svg, command):
def add_group(document, node, command):
parent = node.getparent()
+ description = _(get_command_description(command))
group = inkex.Group(attrib={
"id": generate_unique_id(document, "command_group"),
- INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command),
+ INKSCAPE_LABEL: _("Ink/Stitch Command") + f": {description}",
"transform": get_correction_transform(node)
})
parent.insert(parent.index(node) + 1, group)
@@ -431,9 +432,10 @@ def add_layer_commands(layer, commands):
for i, command in enumerate(commands):
ensure_symbol(svg, command)
+ description = _(get_command_description(command))
layer.append(inkex.Use(attrib={
"id": generate_unique_id(svg, "use"),
- INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command),
+ INKSCAPE_LABEL: _("Ink/Stitch Command") + f": {description}",
XLINK_HREF: "#inkstitch_%s" % command,
"height": "100%",
"width": "100%",
diff --git a/lib/extensions/input.py b/lib/extensions/input.py
index 3bcbb5a2..7e525438 100644
--- a/lib/extensions/input.py
+++ b/lib/extensions/input.py
@@ -4,6 +4,7 @@
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
from html import unescape
+from sys import platform
from inkex import errormsg
from lxml import etree
@@ -21,4 +22,8 @@ class Input(object):
errormsg(msg)
exit(0)
stitch_plan = generate_stitch_plan(embroidery_file)
- print(unescape(etree.tostring(stitch_plan).decode('utf-8')))
+ out = etree.tostring(stitch_plan).decode('utf-8')
+ if platform == "win32":
+ print(out)
+ else:
+ print(unescape(out))
diff --git a/lib/svg/rendering.py b/lib/svg/rendering.py
index 4f0ec154..735e00e7 100644
--- a/lib/svg/rendering.py
+++ b/lib/svg/rendering.py
@@ -234,8 +234,8 @@ def render_stitch_plan(svg, stitch_plan, realistic=False, visual_commands=True,
for i, color_block in enumerate(stitch_plan):
group = inkex.Group(attrib={
- 'id': '__color_block_%d__' % i,
- INKSCAPE_LABEL: "color block %d" % (i + 1)
+ 'id': f'__color_block_{i}__',
+ INKSCAPE_LABEL: f"color block {(i + 1)}"
})
layer.append(group)
if realistic: