summaryrefslogtreecommitdiff
path: root/lib/commands.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2018-08-21 16:45:13 -0400
committerGitHub <noreply@github.com>2018-08-21 16:45:13 -0400
commitafb886cbe04d19c6b7d1886dfc2c6052646a2dbf (patch)
tree2d0a6fe95a26d5b934fe893f3d2b3e94b2aadcc8 /lib/commands.py
parent8116f32068a4fe55e7f30ca2a369b2443d89b560 (diff)
parent8f700007fc7d3b7866d4e4a3dac6a36bb3e1be2a (diff)
Merge pull request #286 from inkstitch/lexelby/i18n-revamp
localize INX files
Diffstat (limited to 'lib/commands.py')
-rw-r--r--lib/commands.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/commands.py b/lib/commands.py
index cadfa080..214b5f40 100644
--- a/lib/commands.py
+++ b/lib/commands.py
@@ -3,13 +3,42 @@ import cubicsuperpath
from .svg import apply_transforms
from .svg.tags import SVG_USE_TAG, SVG_SYMBOL_TAG, CONNECTION_START, CONNECTION_END, XLINK_HREF
+from .utils import cache
+from .i18n import _, N_
+COMMANDS = {
+ # L10N command attached to an object
+ "fill_start": N_("Fill stitch starting position"),
+
+ # L10N command attached to an object
+ "fill_end": N_("Fill stitch ending position"),
+
+ # L10N command attached to an object
+ "stop": N_("Stop (pause machine) after sewing this object"),
+
+ # L10N command attached to an object
+ "trim": N_("Trim thread after sewing this object"),
+
+ # L10N command attached to an object
+ "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)")
+}
+
+OBJECT_COMMANDS = [ "fill_start", "fill_end", "stop", "trim", "ignore_object" ]
+LAYER_COMMANDS = [ "ignore_layer" ]
class CommandParseError(Exception):
pass
class BaseCommand(object):
+ @property
+ @cache
+ def description(self):
+ return get_command_description(self.command)
+
def parse_symbol(self):
if self.symbol.tag != SVG_SYMBOL_TAG:
raise CommandParseError("use points to non-symbol")
@@ -87,6 +116,9 @@ class StandaloneCommand(BaseCommand):
self.parse_symbol()
+def get_command_description(command):
+ return _(COMMANDS[command])
+
def find_commands(node):
"""Find the symbols this node is connected to and return them as Commands"""