From b16494ef6d7389c907e8413ebd5284d0e3fd3189 Mon Sep 17 00:00:00 2001 From: francois Date: Thu, 30 Apr 2026 23:51:36 +0200 Subject: [PATCH] Preserve test tree check and fold state across reload Reload (re-loading the same .tum file) was rebuilding the GUI tree from scratch, resetting every checkbox and unfolding everything. Snapshot the user's selection and fold state via the existing getCheckList/restoreCheckList and getFoldList/restoreFoldList methods (already used for session persistence through prefs), so a same-file reload keeps both as well. A change in the total item count (file edited between loads) skips the restore. Co-Authored-By: Claude Opus 4.7 --- src/testium/main_win/test_file_manager.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/testium/main_win/test_file_manager.py b/src/testium/main_win/test_file_manager.py index fbe4d9e..616a7e2 100644 --- a/src/testium/main_win/test_file_manager.py +++ b/src/testium/main_win/test_file_manager.py @@ -48,8 +48,16 @@ class TestFileManager: def reload(self, file_name: str): w = self._win w.disconnect_signals() + # Snapshot user-selected checkboxes and fold state so they survive a + # reload of the same file (same logic as session-restore through prefs). + previous_check_list = w.treeTests.getCheckList() + previous_fold_list = w.treeTests.getFoldList() + previous_count = w.treeTests.getItemCount() self.clear_process() - self.load(file_name) + if self.load(file_name) and w.test_service is not None: + if w.treeTests.getItemCount() == previous_count: + w.treeTests.restoreCheckList(previous_check_list, w.test_service) + w.treeTests.restoreFoldList(previous_fold_list) w.reconnect_signals() def _make_progress(self, w):