mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 06:32:53 +01:00
chore: update tests
This commit is contained in:
1 parent
77505db621
commit
f849cbc183
5 files changed
+90
-12
No files matched your search
+18
-12
@@ -17,22 +17,28 @@ def has_new_config(config: Path) -> bool:
|
||||
return config.exists()
|
||||
|
||||
|
||||
def convert_cols_file(res: Path) -> dict[str, int] | None:
|
||||
j = read_json(res)
|
||||
cols = j["cols"]
|
||||
# NOTE: implies prior conversion
|
||||
if "View" in cols:
|
||||
return None
|
||||
# NOTE: user may not have changed these widths in API 6
|
||||
try:
|
||||
cols["View"] = cols.pop("Perspective")
|
||||
cols["Max"] = cols.pop("Maximum")
|
||||
except Exception:
|
||||
pass
|
||||
return j
|
||||
|
||||
|
||||
def migrate_cols_file(res: Path) -> None:
|
||||
# NOTE: filename "dzg.columns.json" is API 7 spec
|
||||
old_res = Path.home() / LEGACY_COLS_PATH
|
||||
if old_res.is_file():
|
||||
j = read_json(old_res)
|
||||
cols = j["cols"]
|
||||
# NOTE: implies prior conversion
|
||||
if "View" in cols:
|
||||
return
|
||||
# NOTE: user may not have changed these widths in API 6
|
||||
try:
|
||||
cols["View"] = cols.pop("Perspective")
|
||||
cols["Max"] = cols.pop("Maximum")
|
||||
except Exception:
|
||||
pass
|
||||
write_json(j, res)
|
||||
j = convert_cols_file(old_res)
|
||||
if j is not None:
|
||||
write_json(j, res)
|
||||
|
||||
|
||||
def copy_state_files(state_path: Path) -> None:
|
||||
|
||||
Reference in new issue
Block a user