summaryrefslogtreecommitdiff
path: root/lib/extensions/palette_split_text.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2022-04-24 08:27:42 +0200
committerGitHub <noreply@github.com>2022-04-24 08:27:42 +0200
commitf9d57f6ea51ea8da186c41b70950b7d87fa2c20b (patch)
tree7c2664fc201933b64cc224adb28ff717e6f08c61 /lib/extensions/palette_split_text.py
parent4058712139b56a2419e01db700581b3c9554a88a (diff)
Fix lettering scale, etc. (#1620)
* fix lettering scale * adapt to updated inkex: transform operator, selections * fix #1597 * no traceback error message on broken satin columns * highlight troubleshoot "steps to solve" through additional headline * set a minimum value for running stitch repeats * rename "import" thread list to "apply" thread list
Diffstat (limited to 'lib/extensions/palette_split_text.py')
-rw-r--r--lib/extensions/palette_split_text.py37
1 files changed, 18 insertions, 19 deletions
diff --git a/lib/extensions/palette_split_text.py b/lib/extensions/palette_split_text.py
index 6c024ced..3257d694 100644
--- a/lib/extensions/palette_split_text.py
+++ b/lib/extensions/palette_split_text.py
@@ -22,22 +22,21 @@ class PaletteSplitText(InkstitchExtension):
line_height = self.options.line_height
- for text in self.svg.selected:
- if type(text) == inkex.elements.TextElement:
- parent = text.getparent()
- content = text.get_text()
- lines = content.split('\n')
- lines.reverse()
- style = text.get('style')
- x = text.get('x')
- y = text.get('y')
- y = float(y) + (len(lines) - 1) * line_height
- for line in lines:
- element = inkex.TextElement()
- element.text = line
- element.set('style', style)
- element.set('x', x)
- element.set('y', str(y))
- y = float(y) - line_height
- parent.insert(0, element)
- parent.remove(text)
+ for text in self.svg.selection.get(inkex.elements.TextElement):
+ parent = text.getparent()
+ content = text.get_text()
+ lines = content.split('\n')
+ lines.reverse()
+ style = text.get('style')
+ x = text.get('x')
+ y = text.get('y')
+ y = float(y) + (len(lines) - 1) * line_height
+ for line in lines:
+ element = inkex.TextElement()
+ element.text = line
+ element.set('style', style)
+ element.set('x', x)
+ element.set('y', str(y))
+ y = float(y) - line_height
+ parent.insert(0, element)
+ parent.remove(text)