From 380fc41cf6f8fac726cb12b19fdc76a8ef29ee33 Mon Sep 17 00:00:00 2001 From: Mario Voigt Date: Fri, 20 Jan 2023 12:38:36 +0100 Subject: [PATCH] small fix in colorreplace --- .../replace_color_and_alpha/replace_color_and_alpha.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/fablabchemnitz/replace_color_and_alpha/replace_color_and_alpha.py b/extensions/fablabchemnitz/replace_color_and_alpha/replace_color_and_alpha.py index 99ed8fd..ddb5bcd 100644 --- a/extensions/fablabchemnitz/replace_color_and_alpha/replace_color_and_alpha.py +++ b/extensions/fablabchemnitz/replace_color_and_alpha/replace_color_and_alpha.py @@ -44,12 +44,13 @@ class ReplaceColorAndAlpha(inkex.EffectExtension): fr = self.options.from_color.strip('"').strip('#').lower() try: alphaFr = str(float(int(self.options.from_color.strip('"').strip('#').lower()[-2:], 16))/255.0) - except:zz + except: pass to = self.options.to_color.strip('"').strip('#').lower() try: alphaTo = str(float(int(self.options.to_color.strip('"').strip('#').lower()[-2:], 16))/255.0) - except: + except Exception as e: + inkex.utils.debug(e) pass svg = self.document.getroot() for element in svg.iter("*"): @@ -65,7 +66,6 @@ class ReplaceColorAndAlpha(inkex.EffectExtension): style = style + ";fill-opacity:" + alphaTo element.set('style',style) - if (style.lower().find('stroke:#'+fr[:6]) != -1 and len(fr) == 6) or (style.lower().find('stroke:#'+fr[:6]) != -1 and style.lower().find('stroke-opacity:'+alphaFr[:4]) != -1 and len(fr)==8): style = re.sub('stroke-opacity:.*?(;|$)', '\\1',