2021-03-12 04:17:19 +00:00
|
|
|
# Authors: see git history
|
|
|
|
#
|
|
|
|
# Copyright (c) 2010 Authors
|
|
|
|
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
|
|
|
|
|
2018-05-02 01:21:07 +00:00
|
|
|
import inkex
|
2021-03-04 17:40:53 +00:00
|
|
|
from lxml import etree
|
2018-05-02 01:21:07 +00:00
|
|
|
|
2021-03-04 17:40:53 +00:00
|
|
|
etree.register_namespace("inkstitch", "http://inkstitch.org/namespace")
|
2018-12-16 01:21:41 +00:00
|
|
|
inkex.NSS['inkstitch'] = 'http://inkstitch.org/namespace'
|
|
|
|
|
2018-05-02 01:21:07 +00:00
|
|
|
SVG_PATH_TAG = inkex.addNS('path', 'svg')
|
|
|
|
SVG_POLYLINE_TAG = inkex.addNS('polyline', 'svg')
|
2020-05-16 21:01:00 +00:00
|
|
|
SVG_RECT_TAG = inkex.addNS('rect', 'svg')
|
|
|
|
SVG_ELLIPSE_TAG = inkex.addNS('ellipse', 'svg')
|
|
|
|
SVG_CIRCLE_TAG = inkex.addNS('circle', 'svg')
|
2019-08-06 02:42:48 +00:00
|
|
|
SVG_TEXT_TAG = inkex.addNS('text', 'svg')
|
|
|
|
SVG_TSPAN_TAG = inkex.addNS('tspan', 'svg')
|
2018-05-02 01:21:07 +00:00
|
|
|
SVG_DEFS_TAG = inkex.addNS('defs', 'svg')
|
|
|
|
SVG_GROUP_TAG = inkex.addNS('g', 'svg')
|
2020-06-04 15:04:47 +00:00
|
|
|
SVG_LINK_TAG = inkex.addNS('a', 'svg')
|
2018-06-21 19:41:06 +00:00
|
|
|
SVG_SYMBOL_TAG = inkex.addNS('symbol', 'svg')
|
|
|
|
SVG_USE_TAG = inkex.addNS('use', 'svg')
|
2020-05-16 21:01:00 +00:00
|
|
|
SVG_IMAGE_TAG = inkex.addNS('image', 'svg')
|
2018-05-02 01:21:07 +00:00
|
|
|
|
|
|
|
INKSCAPE_LABEL = inkex.addNS('label', 'inkscape')
|
|
|
|
INKSCAPE_GROUPMODE = inkex.addNS('groupmode', 'inkscape')
|
2018-06-21 19:41:06 +00:00
|
|
|
CONNECTION_START = inkex.addNS('connection-start', 'inkscape')
|
|
|
|
CONNECTION_END = inkex.addNS('connection-end', 'inkscape')
|
2018-07-05 01:42:53 +00:00
|
|
|
CONNECTOR_TYPE = inkex.addNS('connector-type', 'inkscape')
|
2020-04-25 12:45:27 +00:00
|
|
|
|
2018-06-21 19:41:06 +00:00
|
|
|
XLINK_HREF = inkex.addNS('href', 'xlink')
|
2020-04-25 12:45:27 +00:00
|
|
|
|
2018-11-15 01:23:06 +00:00
|
|
|
SODIPODI_NAMEDVIEW = inkex.addNS('namedview', 'sodipodi')
|
|
|
|
SODIPODI_GUIDE = inkex.addNS('guide', 'sodipodi')
|
2019-08-06 02:42:48 +00:00
|
|
|
SODIPODI_ROLE = inkex.addNS('role', 'sodipodi')
|
2020-04-25 12:45:27 +00:00
|
|
|
|
2018-12-16 01:21:41 +00:00
|
|
|
INKSTITCH_LETTERING = inkex.addNS('lettering', 'inkstitch')
|
2018-05-02 01:21:07 +00:00
|
|
|
|
2021-10-21 14:24:40 +00:00
|
|
|
EMBROIDERABLE_TAGS = (SVG_PATH_TAG, SVG_POLYLINE_TAG, SVG_RECT_TAG, SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG)
|
2020-05-16 21:01:00 +00:00
|
|
|
NOT_EMBROIDERABLE_TAGS = (SVG_IMAGE_TAG, SVG_TEXT_TAG)
|
|
|
|
SVG_OBJECT_TAGS = (SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG, SVG_RECT_TAG)
|
|
|
|
|
2020-04-25 12:45:27 +00:00
|
|
|
INKSTITCH_ATTRIBS = {}
|
|
|
|
inkstitch_attribs = [
|
2022-05-02 19:00:52 +00:00
|
|
|
'ties',
|
|
|
|
'force_lock_stitches',
|
|
|
|
# clone
|
|
|
|
'clone',
|
|
|
|
# polyline
|
|
|
|
'polyline',
|
|
|
|
# fill
|
|
|
|
'angle',
|
|
|
|
'auto_fill',
|
|
|
|
'fill_method',
|
|
|
|
'tangential_strategy',
|
|
|
|
'join_style',
|
|
|
|
'interlaced',
|
|
|
|
'avoid_self_crossing',
|
2022-05-03 03:48:46 +00:00
|
|
|
'clockwise',
|
2022-05-02 19:00:52 +00:00
|
|
|
'expand_mm',
|
|
|
|
'fill_underlay',
|
|
|
|
'fill_underlay_angle',
|
|
|
|
'fill_underlay_inset_mm',
|
|
|
|
'fill_underlay_max_stitch_length_mm',
|
|
|
|
'fill_underlay_row_spacing_mm',
|
|
|
|
'fill_underlay_skip_last',
|
|
|
|
'max_stitch_length_mm',
|
|
|
|
'min_stitch_length_mm',
|
|
|
|
'row_spacing_mm',
|
|
|
|
'end_row_spacing_mm',
|
|
|
|
'skip_last',
|
|
|
|
'staggers',
|
|
|
|
'underlay_underpath',
|
|
|
|
'underpath',
|
|
|
|
'flip',
|
|
|
|
'expand_mm',
|
|
|
|
# stroke
|
|
|
|
'manual_stitch',
|
|
|
|
'bean_stitch_repeats',
|
|
|
|
'repeats',
|
|
|
|
'running_stitch_length_mm',
|
|
|
|
# satin column
|
|
|
|
'satin_column',
|
|
|
|
'running_stitch_length_mm',
|
|
|
|
'center_walk_underlay',
|
|
|
|
'center_walk_underlay_stitch_length_mm',
|
|
|
|
'contour_underlay',
|
|
|
|
'contour_underlay_stitch_length_mm',
|
|
|
|
'contour_underlay_inset_mm',
|
|
|
|
'zigzag_underlay',
|
|
|
|
'zigzag_spacing_mm',
|
|
|
|
'zigzag_underlay_inset_mm',
|
|
|
|
'zigzag_underlay_spacing_mm',
|
|
|
|
'zigzag_underlay_max_stitch_length_mm',
|
|
|
|
'e_stitch',
|
|
|
|
'pull_compensation_mm',
|
|
|
|
'stroke_first',
|
|
|
|
# Legacy
|
|
|
|
'trim_after',
|
|
|
|
'stop_after'
|
|
|
|
]
|
2020-04-25 12:45:27 +00:00
|
|
|
for attrib in inkstitch_attribs:
|
|
|
|
INKSTITCH_ATTRIBS[attrib] = inkex.addNS(attrib, 'inkstitch')
|