Refactor radar system

This commit is contained in:
Ayzen
2026-10-05 16:46:28 +03:00
parent 515049d2ed
commit 8f097dfa2e
179 changed files with 8212 additions and 6676 deletions
@@ -7,6 +7,7 @@ import json
import logging
from pathlib import Path
from python_app.file_io import atomic_write_json
logger = logging.getLogger(__name__)
@@ -37,7 +38,7 @@ class GuiSessionStateStore:
try:
payload = json.loads(self._path.read_text(encoding="utf-8"))
except (OSError, json.JSONDecodeError) as exc:
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
# The state file is GUI-local cache — a corrupted file should not
# prevent the app from starting. Reset to defaults and let the
# next write overwrite it.
@@ -55,11 +56,6 @@ class GuiSessionStateStore:
def write(self, state: GuiSessionState) -> Path:
"""Atomically write session-state JSON file."""
temp_path = self._path.with_suffix(self._path.suffix + ".tmp")
temp_path.write_text(
json.dumps({"last_profile_path": state.last_profile_path}, indent=2),
encoding="utf-8",
)
temp_path.replace(self._path)
atomic_write_json(self._path, {"last_profile_path": state.last_profile_path}, durable=True)
logger.debug("Wrote GUI session-state to %s", self._path)
return self._path