Browse Source

Adjust helper.py to better parse illustrator-generated svg files (#1465)

Fixes #1464
tags/v1.1.2
Drew Heles Andrew Belt 5 years ago
parent
commit
f7b050c04c
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      helper.py

+ 3
- 1
helper.py View File

@@ -259,6 +259,8 @@ def panel_to_components(tree):
# Get components layer # Get components layer
root = tree.getroot() root = tree.getroot()
groups = root.findall(".//svg:g[@inkscape:label='components']", ns) groups = root.findall(".//svg:g[@inkscape:label='components']", ns)
if len(groups) < 1:
groups = root.findall(".//svg:g[@id='components']", ns)
if len(groups) < 1: if len(groups) < 1:
raise UserException("Could not find \"components\" layer on panel") raise UserException("Could not find \"components\" layer on panel")


@@ -286,7 +288,7 @@ def panel_to_components(tree):
# Get color # Get color
style = el.get('style') style = el.get('style')
color_match = re.search(r'fill:\S*#(.{6});', style) color_match = re.search(r'fill:\S*#(.{6});', style)
color = color_match.group(1)
color = color_match.group(1).lower()
c['color'] = color c['color'] = color


# Get position # Get position


Loading…
Cancel
Save