inkstitch/lib/elements/text.py

34 wiersze
920 B
Python
Czysty Zwykły widok Historia

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.
2020-05-16 21:01:00 +00:00
from ..i18n import _
from .element import EmbroideryElement
from .validation import ObjectTypeWarning
from ..svg.path import get_node_transform
2020-05-16 21:01:00 +00:00
class TextTypeWarning(ObjectTypeWarning):
name = _("Text")
description = _("Ink/Stitch cannot work with objects like text.")
steps_to_solve = [
_('* Text: Create your own letters or try the lettering tool:'),
_('- Extensions > Ink/Stitch > Lettering')
]
class TextObject(EmbroideryElement):
def pointer(self):
transform = get_node_transform(self.node.getparent())
point = self.node.bounding_box(transform).center
2020-05-16 21:01:00 +00:00
return point
def validation_warnings(self):
yield TextTypeWarning(self.pointer())
2020-05-16 21:01:00 +00:00
def to_patches(self, last_patch):
return []