Visitar URL original
minor follow-up adjustments for config GUI validation by deruyter92 · Pull Request #3399 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add MainWindow.invalidate_config_cache()
a lightweight hook to force the next cfg access to re-read and validate from disk. Can be called from outside the GUI as well (e.g. after video analysis or training network, in case they manipulate te config)
  • Loading branch information
deruyter92 committed Jul 17, 2026
commit 5bb4255f7e3a2c6dec30268de217e9b7bdbe9114
11 changes: 8 additions & 3 deletions deeplabcut/gui/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def config_path(self) -> Path | None:
@config_path.setter
def config_path(self, value: Path | None) -> None:
self._config_path = value
self._cfg = None
self.invalidate_config_cache()
if self._config_monitor is not None:
self._config_monitor.set_path(str(value) if value is not None else None)

Expand Down Expand Up @@ -922,6 +922,11 @@ def reload_project_config(self) -> bool:
return False
return self._update_project_state(self.config_path, loaded=True)

def invalidate_config_cache(self) -> None:
"""Drop the cached project configuration so the next ``self.cfg``
access performs a fresh read-and-validate from disk."""
self._cfg = None

def _ask_for_help(self):
dlg = QMessageBox(self)
dlg.setWindowTitle("Ask for help")
Expand Down Expand Up @@ -1119,7 +1124,7 @@ def _build_project_ui_from_current_config(self) -> bool:

while True:
self._discard_partial_project_tabs()
self._cfg = None
self.invalidate_config_cache()

try:
# Read and validate; tabs reuse the cached snapshot via self.cfg.
Expand Down Expand Up @@ -1197,7 +1202,7 @@ def load_config(
self.config_path = absolute_path(config)

while True:
self._cfg = None
self.invalidate_config_cache()

try:
cfg = self._read_current_config_for_ui()
Expand Down