From d18144416cb8c20193766886139868ef64478104 Mon Sep 17 00:00:00 2001 From: alvinpenner Date: Sun, 24 May 2009 22:06:36 +0000 Subject: [PATCH] more robust parsing of color info --- share/extensions/dxf_outlines.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py index 6ff0c1a24..3888bc7e3 100755 --- a/share/extensions/dxf_outlines.py +++ b/share/extensions/dxf_outlines.py @@ -150,14 +150,13 @@ class MyEffect(inkex.Effect): h = inkex.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0]) path = '//svg:path' for node in self.document.getroot().xpath(path, namespaces=inkex.NSS): + rgb = (0,0,0) style = node.get('style') - start = style.find("stroke:") - if style[start+11] == ';': - rgb = simplestyle.parseColor(style[(start+7):(start+11)]) - elif style[start+14] == ';': - rgb = simplestyle.parseColor(style[(start+7):(start+14)]) - else: - rgb = (0,0,0) + if style: + style = simplestyle.parseStyle(style) + if style.has_key('stroke'): + if style['stroke'] and style['stroke'] != 'none': + rgb = simplestyle.parseColor(style['stroke']) hsl = coloreffect.ColorEffect.rgb_to_hsl(coloreffect.ColorEffect(),rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0) self.color = 7 # default is black if hsl[2]: -- 2.39.5