# HG changeset patch # User Thinker K.F. Li # Date 1236185682 -28800 # Node ID 5737548e922fa5ac65876f48bb104fdca823bb35 # Parent e4abe8e149dee3fd64840056009eb351a116cd50 Fix bug that svg2code.py handle fill & stroke opacity in a wrong way. diff -r e4abe8e149de -r 5737548e922f tools/svg2code.py --- a/tools/svg2code.py Sun Feb 22 14:22:56 2009 +0800 +++ b/tools/svg2code.py Thu Mar 05 00:54:42 2009 +0800 @@ -130,11 +130,14 @@ except: style_str = node.getAttribute('style') prop_map = get_style_map(style_str) - - try: + pass + + if node.hasAttribute('fill-opacity'): + opacity = float(node.getAttribute('fill-opacity')) + elif node.hasAttribute('opacity'): opacity = float(node.getAttribute('opacity')) - except: - opacity = 1.0 + else: + opacity = 1 pass try: @@ -160,9 +163,11 @@ raise ValueError, '\'%s\' is an invalid value for fill.' % (fill) pass - try: + if node.hasAttribute('stroke-opacity'): stroke_opacity = float(node.getAttribute('stroke-opacity')) - except: + elif node.hasAttribute('opacity'): + stroke_opacity = float(node.getAttribute('opacity')) + else: stroke_opacity = 1.0 pass