rebase corrections

pull/1548/head
Kaalleen 2022-05-04 20:04:39 +02:00
rodzic 48d0a0250e
commit e65aaebbca
4 zmienionych plików z 20 dodań i 12 usunięć

Wyświetl plik

@ -5,13 +5,7 @@
from math import atan, degrees from math import atan, degrees
<<<<<<< HEAD
from ..commands import is_command, is_command_symbol
=======
import inkex
from ..commands import is_command_symbol from ..commands import is_command_symbol
>>>>>>> c69b6f5a (* autofill to fillstitch)
from ..i18n import _ from ..i18n import _
from ..svg.path import get_node_transform from ..svg.path import get_node_transform
from ..svg.svg import find_elements from ..svg.svg import find_elements

Wyświetl plik

@ -8,10 +8,12 @@ import os
import re import re
from collections.abc import MutableMapping from collections.abc import MutableMapping
import inkex
from lxml import etree from lxml import etree
from lxml.etree import Comment
from stringcase import snakecase from stringcase import snakecase
import inkex
from ..commands import is_command, layer_commands from ..commands import is_command, layer_commands
from ..elements import EmbroideryElement, nodes_to_elements from ..elements import EmbroideryElement, nodes_to_elements
from ..elements.clone import is_clone from ..elements.clone import is_clone
@ -19,7 +21,8 @@ from ..i18n import _
from ..marker import has_marker from ..marker import has_marker
from ..svg import generate_unique_id from ..svg import generate_unique_id
from ..svg.tags import (CONNECTOR_TYPE, EMBROIDERABLE_TAGS, INKSCAPE_GROUPMODE, from ..svg.tags import (CONNECTOR_TYPE, EMBROIDERABLE_TAGS, INKSCAPE_GROUPMODE,
NOT_EMBROIDERABLE_TAGS, SVG_DEFS_TAG, SVG_GROUP_TAG) NOT_EMBROIDERABLE_TAGS, SVG_CLIPPATH_TAG, SVG_DEFS_TAG,
SVG_GROUP_TAG, SVG_MASK_TAG)
SVG_METADATA_TAG = inkex.addNS("metadata", "svg") SVG_METADATA_TAG = inkex.addNS("metadata", "svg")
@ -129,6 +132,10 @@ class InkstitchExtension(inkex.Effect):
def descendants(self, node, selected=False, troubleshoot=False): # noqa: C901 def descendants(self, node, selected=False, troubleshoot=False): # noqa: C901
nodes = [] nodes = []
if node.tag == Comment:
return []
element = EmbroideryElement(node) element = EmbroideryElement(node)
if element.has_command('ignore_object'): if element.has_command('ignore_object'):
@ -141,7 +148,9 @@ class InkstitchExtension(inkex.Effect):
if (node.tag in EMBROIDERABLE_TAGS or node.tag == SVG_GROUP_TAG) and element.get_style('display', 'inline') is None: if (node.tag in EMBROIDERABLE_TAGS or node.tag == SVG_GROUP_TAG) and element.get_style('display', 'inline') is None:
return [] return []
if node.tag == SVG_DEFS_TAG: # defs, masks and clippaths can contain embroiderable elements
# but should never be rendered directly.
if node.tag in [SVG_DEFS_TAG, SVG_MASK_TAG, SVG_CLIPPATH_TAG]:
return [] return []
# command connectors with a fill color set, will glitch into the elements list # command connectors with a fill color set, will glitch into the elements list

Wyświetl plik

@ -11,7 +11,6 @@ from ..stitch_plan import Stitch
from ..svg import PIXELS_PER_MM from ..svg import PIXELS_PER_MM
from ..utils import Point as InkstitchPoint from ..utils import Point as InkstitchPoint
from ..utils import cache from ..utils import cache
from ..stitch_plan import Stitch
def legacy_fill(shape, angle, row_spacing, end_row_spacing, max_stitch_length, flip, staggers, skip_last): def legacy_fill(shape, angle, row_spacing, end_row_spacing, max_stitch_length, flip, staggers, skip_last):

Wyświetl plik

@ -3,14 +3,16 @@
# Copyright (c) 2010 Authors # Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. # Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
import inkex
from lxml import etree from lxml import etree
import inkex
etree.register_namespace("inkstitch", "http://inkstitch.org/namespace") etree.register_namespace("inkstitch", "http://inkstitch.org/namespace")
inkex.NSS['inkstitch'] = 'http://inkstitch.org/namespace' inkex.NSS['inkstitch'] = 'http://inkstitch.org/namespace'
SVG_PATH_TAG = inkex.addNS('path', 'svg') SVG_PATH_TAG = inkex.addNS('path', 'svg')
SVG_POLYLINE_TAG = inkex.addNS('polyline', 'svg') SVG_POLYLINE_TAG = inkex.addNS('polyline', 'svg')
SVG_POLYGON_TAG = inkex.addNS('polygon', 'svg')
SVG_RECT_TAG = inkex.addNS('rect', 'svg') SVG_RECT_TAG = inkex.addNS('rect', 'svg')
SVG_ELLIPSE_TAG = inkex.addNS('ellipse', 'svg') SVG_ELLIPSE_TAG = inkex.addNS('ellipse', 'svg')
SVG_CIRCLE_TAG = inkex.addNS('circle', 'svg') SVG_CIRCLE_TAG = inkex.addNS('circle', 'svg')
@ -22,12 +24,15 @@ SVG_LINK_TAG = inkex.addNS('a', 'svg')
SVG_SYMBOL_TAG = inkex.addNS('symbol', 'svg') SVG_SYMBOL_TAG = inkex.addNS('symbol', 'svg')
SVG_USE_TAG = inkex.addNS('use', 'svg') SVG_USE_TAG = inkex.addNS('use', 'svg')
SVG_IMAGE_TAG = inkex.addNS('image', 'svg') SVG_IMAGE_TAG = inkex.addNS('image', 'svg')
SVG_CLIPPATH_TAG = inkex.addNS('clipPath', 'svg')
SVG_MASK_TAG = inkex.addNS('mask', 'svg')
INKSCAPE_LABEL = inkex.addNS('label', 'inkscape') INKSCAPE_LABEL = inkex.addNS('label', 'inkscape')
INKSCAPE_GROUPMODE = inkex.addNS('groupmode', 'inkscape') INKSCAPE_GROUPMODE = inkex.addNS('groupmode', 'inkscape')
CONNECTION_START = inkex.addNS('connection-start', 'inkscape') CONNECTION_START = inkex.addNS('connection-start', 'inkscape')
CONNECTION_END = inkex.addNS('connection-end', 'inkscape') CONNECTION_END = inkex.addNS('connection-end', 'inkscape')
CONNECTOR_TYPE = inkex.addNS('connector-type', 'inkscape') CONNECTOR_TYPE = inkex.addNS('connector-type', 'inkscape')
INKSCAPE_DOCUMENT_UNITS = inkex.addNS('document-units', 'inkscape')
XLINK_HREF = inkex.addNS('href', 'xlink') XLINK_HREF = inkex.addNS('href', 'xlink')
@ -37,7 +42,8 @@ SODIPODI_ROLE = inkex.addNS('role', 'sodipodi')
INKSTITCH_LETTERING = inkex.addNS('lettering', 'inkstitch') INKSTITCH_LETTERING = inkex.addNS('lettering', 'inkstitch')
EMBROIDERABLE_TAGS = (SVG_PATH_TAG, SVG_POLYLINE_TAG, SVG_RECT_TAG, SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG) EMBROIDERABLE_TAGS = (SVG_PATH_TAG, SVG_POLYLINE_TAG, SVG_POLYGON_TAG,
SVG_RECT_TAG, SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG)
NOT_EMBROIDERABLE_TAGS = (SVG_IMAGE_TAG, SVG_TEXT_TAG) NOT_EMBROIDERABLE_TAGS = (SVG_IMAGE_TAG, SVG_TEXT_TAG)
SVG_OBJECT_TAGS = (SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG, SVG_RECT_TAG) SVG_OBJECT_TAGS = (SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG, SVG_RECT_TAG)