From 142b3a71d83fecc62a55699275591f892455a424 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Mon, 15 Mar 2021 18:06:22 +0100 Subject: [PATCH] read legacy base64 encoded lettering params (#1088) --- lib/extensions/lettering.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/extensions/lettering.py b/lib/extensions/lettering.py index ee0dd9a0b..cddf1b118 100644 --- a/lib/extensions/lettering.py +++ b/lib/extensions/lettering.py @@ -1,6 +1,7 @@ import json import os import sys +from base64 import b64decode import appdirs import inkex @@ -86,12 +87,17 @@ class LetteringFrame(wx.Frame): "scale": 100 }) - try: - if INKSTITCH_LETTERING in self.group.attrib: + if INKSTITCH_LETTERING in self.group.attrib: + try: self.settings.update(json.loads(self.group.get(INKSTITCH_LETTERING))) - return - except (TypeError, ValueError): - pass + except json.decoder.JSONDecodeError: + # legacy base64 encoded (changed in v2.0) + try: + self.settings.update(json.loads(b64decode(self.group.get(INKSTITCH_LETTERING)))) + except (TypeError, ValueError): + pass + except (TypeError, ValueError): + pass def apply_settings(self): """Make the settings in self.settings visible in the UI."""