1 from xml.dom
import minidom
2 from xml.etree
import ElementTree
4 from .base
import exporter
5 from ..parsers.baseporter
import ExtraOption
6 from ..parsers.svg.builder
import to_svg
7 from ..utils.file
import open_file
10 def _print_ugly_xml(dom, file):
11 return dom.write(file,
"utf-8",
True)
14 def _print_pretty_xml(dom, file):
16 xmlstr = minidom.parseString(ElementTree.tostring(dom.getroot())).toprettyxml(indent=
" ")
20 @exporter("SVG", ["svg"], [
ExtraOption("animated", action="store_true", help="Export animated svg"),
21 ], {
"pretty",
"frame"})
22 def export_svg(animation, file, frame=0, pretty=True, animated=False):
23 _print_xml = _print_pretty_xml
if pretty
else _print_ugly_xml
24 _print_xml(
to_svg(animation, frame, animated), file)
25 def export_svg(animation, file, frame=0, pretty=True, animated=False)
def to_svg(animation, time, animated=False)
def open_file(file_or_name, mode="w")