3
# ./svg_levels.py >svg_levels.lua
7
from lxml.cssselect import CSSSelector
9
print '-- autogenerated by svg_levels.py\n\nsvg_objects = {'
11
ns = {'svg': 'http://www.w3.org/2000/svg',
12
'ink': 'http://www.inkscape.org/namespaces/inkscape'}
14
for svg in glob.glob('data/*.svg'):
16
basefile = os.path.basename(svg).split('.')[0]
17
print '%s = {' % basefile
19
sel = CSSSelector('svg|rect[ink|label="displace"]', ns)
21
x, y = float(e.get('x')), float(e.get('y'))
22
w, h = float(e.get('width')), float(e.get('height'))
27
width = %f, height = %f
31
sel = CSSSelector('svg|rect[ink|label="transition"]', ns)
33
x, y = float(e.get('x')), float(e.get('y'))
34
w, h = float(e.get('width')), float(e.get('height'))
37
descSel = CSSSelector('svg|desc', ns)
44
width = %f, height = %f,