From 6326b8ea84614e036751cf0126b26c38e09baef1 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 12 Apr 2019 07:14:36 +0200 Subject: drawio: A little drawio experiment. --- src/ee/tools/drawio-to-parts.py | 20 ++++++++++++++++++++ src/ee/tools/drawio_decompress.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/ee/tools/drawio-to-parts.py create mode 100644 src/ee/tools/drawio_decompress.py (limited to 'src/ee/tools') diff --git a/src/ee/tools/drawio-to-parts.py b/src/ee/tools/drawio-to-parts.py new file mode 100644 index 0000000..562e341 --- /dev/null +++ b/src/ee/tools/drawio-to-parts.py @@ -0,0 +1,20 @@ +import argparse +from pathlib import Path + +import ee.drawio + +parser = argparse.ArgumentParser() + +parser.add_argument("--in", + dest="in_path", + required=True, + metavar="XML") + +parser.add_argument("--out", + required=True, + metavar="PART DB") + +args = parser.parse_args() + +# ee.drawio.to_parts(Path(args.in_path), Path(args.out)) +ee.drawio.to_dot(Path(args.in_path), Path(args.out)) diff --git a/src/ee/tools/drawio_decompress.py b/src/ee/tools/drawio_decompress.py new file mode 100644 index 0000000..27e51af --- /dev/null +++ b/src/ee/tools/drawio_decompress.py @@ -0,0 +1,29 @@ +import argparse +import sys + +from ee.drawio import decompress + +parser = argparse.ArgumentParser() + +parser.add_argument("--in", + dest="in_path", + metavar="DRAWIO") + +parser.add_argument("--out", + metavar="XML") + +args = parser.parse_args() + +in_stream = out_stream = None + +try: + in_stream = open(args.in_path, "rb") if args.in_path else sys.stdin + out_stream = open(args.out, "wr") if args.out else sys.stdout + + decompress(in_stream, out_stream) +except: + if in_stream: + in_stream.close() + + if out_stream: + out_stream.close() -- cgit v1.2.3