From 8d25615ce5cdb84e4ff1a9bf0dafce7b2e85c917 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Tue, 2 Nov 2021 18:32:45 +0100 Subject: troubleshoot viewbox (#1404) --- lib/extensions/troubleshoot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/extensions/troubleshoot.py') diff --git a/lib/extensions/troubleshoot.py b/lib/extensions/troubleshoot.py index bf7faf76..c4b386d9 100644 --- a/lib/extensions/troubleshoot.py +++ b/lib/extensions/troubleshoot.py @@ -130,7 +130,11 @@ class Troubleshoot(InkstitchExtension): def add_descriptions(self, problem_types): svg = self.document.getroot() - text_x = str(float(svg.get('viewBox', '0 0 800 0').split(' ')[2]) + 5.0) + + # We could use svg.viewport_width, but then we would need to do unit conversions, + # so let's stay with parsing the viewbox by ourselves + # viewbox values are either separated through white space or commas + text_x = str(float(svg.get('viewBox', '0 0 800 0').replace(",", " ").split()[2]) + 5.0) text_container = inkex.TextElement(attrib={ "x": text_x, -- cgit v1.2.3