summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/extensions/stitch_plan_preview.py14
-rw-r--r--lib/svg/tags.py1
-rw-r--r--templates/stitch_plan_preview.xml2
3 files changed, 13 insertions, 4 deletions
diff --git a/lib/extensions/stitch_plan_preview.py b/lib/extensions/stitch_plan_preview.py
index 571d5040..2468fc84 100644
--- a/lib/extensions/stitch_plan_preview.py
+++ b/lib/extensions/stitch_plan_preview.py
@@ -3,14 +3,14 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-from lxml import etree
-
from inkex import Boolean, Style
+from lxml import etree
from ..stitch_plan import stitch_groups_to_stitch_plan
from ..svg import render_stitch_plan
-from ..svg.tags import (INKSCAPE_GROUPMODE, INKSTITCH_ATTRIBS, SVG_DEFS_TAG,
- SVG_GROUP_TAG, SVG_PATH_TAG)
+from ..svg.tags import (INKSCAPE_GROUPMODE, INKSTITCH_ATTRIBS,
+ SODIPODI_INSENSITIVE, SVG_DEFS_TAG, SVG_GROUP_TAG,
+ SVG_PATH_TAG)
from .base import InkstitchExtension
from .stitch_plan_preview_undo import reset_stitch_plan
@@ -21,6 +21,7 @@ class StitchPlanPreview(InkstitchExtension):
self.arg_parser.add_argument("-s", "--move-to-side", type=Boolean, default=True, dest="move_to_side")
self.arg_parser.add_argument("-v", "--layer-visibility", type=int, default=0, dest="layer_visibility")
self.arg_parser.add_argument("-n", "--needle-points", type=Boolean, default=False, dest="needle_points")
+ self.arg_parser.add_argument("-i", "--insensitive", type=Boolean, default=False, dest="insensitive")
def effect(self):
# delete old stitch plan
@@ -58,6 +59,11 @@ class StitchPlanPreview(InkstitchExtension):
float(style.get('opacity', 1)) > 0.4 and not style.get('display', 'inline') == 'none'):
g.style['opacity'] = 0.4
+ if self.options.insensitive is True:
+ layer.set(SODIPODI_INSENSITIVE, True)
+ else:
+ layer.set(SODIPODI_INSENSITIVE, False)
+
# translate stitch plan to the right side of the canvas
if self.options.move_to_side:
layer.set('transform', 'translate(%s)' % svg.get('viewBox', '0 0 800 0').split(' ')[2])
diff --git a/lib/svg/tags.py b/lib/svg/tags.py
index 0227274c..64f6c2f3 100644
--- a/lib/svg/tags.py
+++ b/lib/svg/tags.py
@@ -40,6 +40,7 @@ XLINK_HREF = inkex.addNS('href', 'xlink')
SODIPODI_NAMEDVIEW = inkex.addNS('namedview', 'sodipodi')
SODIPODI_GUIDE = inkex.addNS('guide', 'sodipodi')
SODIPODI_ROLE = inkex.addNS('role', 'sodipodi')
+SODIPODI_INSENSITIVE = inkex.addNS('insensitive', 'sodipodi')
INKSTITCH_LETTERING = inkex.addNS('lettering', 'inkstitch')
diff --git a/templates/stitch_plan_preview.xml b/templates/stitch_plan_preview.xml
index c78089ee..e7a49522 100644
--- a/templates/stitch_plan_preview.xml
+++ b/templates/stitch_plan_preview.xml
@@ -18,6 +18,8 @@
<option value="2">Lower opacity</option>
</param>
<param name="needle-points" type="boolean" gui-text="Needle points">false</param>
+ <param name="insensitive" type="boolean" gui-text="Lock"
+ gui-description="Make stitch plan insensitive to mouse interactions">false</param>
<spacer />
<script>
{{ command_tag | safe }}