diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-12 07:14:36 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-13 05:58:28 +0200 |
commit | 6326b8ea84614e036751cf0126b26c38e09baef1 (patch) | |
tree | dfd360e0f48c7da7c64ce56d4193a1e728d3c20b /src/ee/tools | |
parent | a00dcfc7f6d12442fca8c5b7d43f12b707f0c877 (diff) | |
download | ee-python-6326b8ea84614e036751cf0126b26c38e09baef1.tar.gz ee-python-6326b8ea84614e036751cf0126b26c38e09baef1.tar.bz2 ee-python-6326b8ea84614e036751cf0126b26c38e09baef1.tar.xz ee-python-6326b8ea84614e036751cf0126b26c38e09baef1.zip |
drawio: A little drawio experiment.
Diffstat (limited to 'src/ee/tools')
-rw-r--r-- | src/ee/tools/drawio-to-parts.py | 20 | ||||
-rw-r--r-- | src/ee/tools/drawio_decompress.py | 29 |
2 files changed, 49 insertions, 0 deletions
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() |