kopia lustrzana https://github.com/inkstitch/inkstitch
Add lock stitch plan option (#2020)
rodzic
a5c085f390
commit
dbded7c9b1
|
@ -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])
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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 }}
|
||||
|
|
Ładowanie…
Reference in New Issue