Mercurial > hg > dmlib
changeset 771:8314b484893f
Add some comments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 10 May 2013 11:43:06 +0300 |
parents | a8bd679934c7 |
children | 09a63eb47e0f |
files | tools/svg2qd.py |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/svg2qd.py Fri May 10 11:29:35 2013 +0300 +++ b/tools/svg2qd.py Fri May 10 11:43:06 2013 +0300 @@ -1,4 +1,9 @@ #!/usr/bin/python +# +# Inkscape SVG to "qd" format converter +# Programmed and designed by Matti 'ccr' Hamalainen +# (C) Copyright 2012-2013 Tecnic Software productions (TNSP) +# import sys import re import xml.etree.ElementTree as ET @@ -78,6 +83,9 @@ print "{}E\n".format(" "*level) +### +### Iterate XML document tree elements +### def iterateDocument(elems, level) : for elem in elems: if elem.tag == "{http://www.w3.org/2000/svg}g" : @@ -93,10 +101,15 @@ printPath(elem, level) -# Ns. paaohjelma +### +### The "main program" +### if len(sys.argv) != 2 : print "Usage: "+sys.argv[0]+" <input.svg>" sys.exit(1) +# Parse input XML to a tree tree = ET.parse(sys.argv[1]) + +# Iterate through the document iterateDocument(tree.getroot(), 0)