summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2021-11-02 18:32:45 +0100
committerGitHub <noreply@github.com>2021-11-02 18:32:45 +0100
commit8d25615ce5cdb84e4ff1a9bf0dafce7b2e85c917 (patch)
tree7ab8930c0e943d67e46e9e18b87d06ce0471b95f /lib
parent23e3f8d5d41f63b5471c9098bfe00c2aa805055f (diff)
troubleshoot viewbox (#1404)
Diffstat (limited to 'lib')
-rw-r--r--lib/extensions/troubleshoot.py6
1 files changed, 5 insertions, 1 deletions
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,