inkstitch/lib/extensions/selection_to_pattern.py

27 wiersze
714 B
Python

2021-06-28 18:05:50 +00:00
# Authors: see git history
#
# Copyright (c) 2021 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
import inkex
from ..i18n import _
2022-01-25 15:41:30 +00:00
from ..marker import set_marker
from ..svg.tags import EMBROIDERABLE_TAGS
2021-06-28 18:05:50 +00:00
from .base import InkstitchExtension
2021-06-30 12:05:13 +00:00
class SelectionToPattern(InkstitchExtension):
2021-06-28 18:05:50 +00:00
def effect(self):
if not self.get_elements():
return
if not self.svg.selection:
2021-06-28 18:05:50 +00:00
inkex.errormsg(_("Please select at least one object to be marked as a pattern."))
return
2021-06-30 14:36:25 +00:00
for pattern in self.get_nodes():
if pattern.tag in EMBROIDERABLE_TAGS:
2022-01-25 15:41:30 +00:00
set_marker(pattern, 'start', 'pattern')