fix in cases where a category doesn't already exist

This commit is contained in:
Jan Petykiewicz 2024-02-27 22:05:04 -08:00
parent 6c1bcc09d3
commit 3e0a4a9da2

4
k2t.py
View File

@ -76,6 +76,10 @@ def t2k(tfile: str, kfile: str) -> None:
with open(tfile, 'rb') as ff: with open(tfile, 'rb') as ff:
ttree = tomllib.load(ff) ttree = tomllib.load(ff)
ttree.setdefault('layers', [])
ttree.setdefault('patterns', [])
ttree.setdefault('linestyles', [])
entries = [Entry.from_toml(entry) entries = [Entry.from_toml(entry)
for entry in ttree['layers']] for entry in ttree['layers']]
patterns = [Pattern.from_toml(pat) patterns = [Pattern.from_toml(pat)