Skip to content

Commit a131922

Browse files
committed
refactor tool scripts
1 parent 29b643d commit a131922

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

tools/buildheadertables.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
#!/usr/bin/env python
2-
# coding:utf-8
3-
# Author: mozman -- <[email protected]>
41
# Purpose: build header var tables
5-
# Created: 12.03.2011
6-
# Copyright (C) 2011, Manfred Moitzi
2+
# Copyright (C) 2011-2022, Manfred Moitzi
73
# License: MIT License
84
from collections import OrderedDict
9-
from pathlib import Path
5+
import ezdxf
106
from ezdxf.lldxf.loader import load_dxf_structure
117

128
TABLEPRELUDE = """# auto-generated by buildheadertables.py - do not edit
@@ -28,7 +24,7 @@
2824
"DXF2013",
2925
"DXF2018",
3026
]
31-
TEMPLATES = Path(r"D:\Source\dxftest\templates")
27+
TEMPLATES = ezdxf.options.test_files_path / "templates"
3228

3329

3430
def write_table(filename, vars):

tools/debug_proxy_graphic.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
from pathlib import Path
1+
# Copyright (c) 2022, Manfred Moitzi
2+
# License: MIT License
3+
import pathlib
24
import logging
35
import ezdxf
46
from ezdxf.proxygraphic import ProxyGraphicDebugger
57

68
ezdxf.options.load_proxy_graphics = True
79

8-
OUTBOX = Path("~/Desktop/Outbox").expanduser()
9-
logging.basicConfig(filename=OUTBOX / "ezdxf-log.txt", level="DEBUG")
10+
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
11+
if not CWD.exists():
12+
CWD = pathlib.Path(".")
13+
14+
logging.basicConfig(filename=CWD / "ezdxf-log.txt", level="DEBUG")
1015
logger = logging.getLogger("ezdxf")
1116

12-
EXAMPLE = Path(ezdxf.EZDXF_TEST_FILES) / "mleader" / "mbway-mleader.dxf"
17+
EXAMPLE = ezdxf.options.test_files_path / "mleader" / "mbway-mleader.dxf"
1318

1419
doc = ezdxf.readfile(EXAMPLE)
1520
mleader = doc.entitydb["403"]
16-
with open(OUTBOX / "proxy-debug.txt", mode="wt") as stream:
21+
with open(CWD / "proxy-debug.txt", mode="wt") as stream:
1722
proxy = ProxyGraphicDebugger(
1823
mleader.proxy_graphic, doc, debug_stream=stream
1924
)

tools/make_arrows_images.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Copyright (c) 2019-2022, Manfred Moitzi
22
# License: MIT License
3-
from pathlib import Path
3+
import pathlib
44
import ezdxf
55
from ezdxf import colors
66
from ezdxf.addons.drawing.matplotlib import qsave
77

8-
DIR = Path("~/Desktop/Outbox").expanduser()
9-
if not DIR.exists():
10-
DIR = Path(".")
8+
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
9+
if not CWD.exists():
10+
CWD = pathlib.Path(".")
1111

1212

1313
def main():
@@ -41,7 +41,7 @@ def add_connection_point(p):
4141
add_connection_point(cp1)
4242
qsave(
4343
msp,
44-
str(DIR / f"{ezdxf.ARROWS.block_name(name)}.png"),
44+
str(CWD / f"{ezdxf.ARROWS.block_name(name)}.png"),
4545
bg="#FFFFFF",
4646
dpi=100,
4747
size_inches=(3, 1),

tools/search_entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018-2020 Manfred Moitzi
1+
# Copyright (c) 2018-2022 Manfred Moitzi
22
# License: MIT License
33

44
import ezdxf
@@ -40,4 +40,4 @@ def process_dir(folder: Path):
4040
print("*" * 40 + "\n")
4141

4242

43-
process_dir(Path(ezdxf.EZDXF_TEST_FILES))
43+
process_dir(ezdxf.options.test_files_path)

0 commit comments

Comments
 (0)