summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2018-08-24 21:05:59 -0400
committerGitHub <noreply@github.com>2018-08-24 21:05:59 -0400
commit6f425f7b3e602e2356ebaba2a5d3b240729c5396 (patch)
tree7e29f10f13d63a539b4814a14fecf946ea798f92 /lib/extensions
parent1de8487849a3f8f55d126e2687d690226e657fde (diff)
parent77177f9b55f57d1373408b3dc619a53fe45d00ce (diff)
Merge pull request #293 from inkstitch/lexelby/origin-and-stop-position
origin and stop position
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/__init__.py2
-rw-r--r--lib/extensions/base.py2
-rw-r--r--lib/extensions/global_commands.py12
3 files changed, 15 insertions, 1 deletions
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