From 0568315b83cc18d2e43561a670566b0761b9521e Mon Sep 17 00:00:00 2001 From: Jeremy Shen Date: Wed, 10 Jun 2026 17:04:32 +0800 Subject: [PATCH] fix: re-read config.yaml before each workflow run _reload_config(): re-reads config.yaml and updates all UI selectors (FSBL, BIT, ELF, BIN, FW BIN) and IP/xilinx_path fields with latest values from file. Called at the top of both _execute_step() and _run_all_steps(), so changing config.yaml externally is picked up before every run. --- config.yaml | 2 +- src/gui/main_window.py | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/config.yaml b/config.yaml index f6b7754..d3b74ff 100644 --- a/config.yaml +++ b/config.yaml @@ -1,6 +1,6 @@ bootloader_bin_path: /home/ly0kos/work/Verify/FW/tftp_app/bootloader/bootloader_z100_800M.bin bootloader_bit_path: /home/ly0kos/work/Verify/FW/tftp_app/bootloader/pl_arm_wrapper_hw_platform_0/pl_arm_wrapper.bit -bootloader_elf_path: /home/ly0kos/work/Verify/FW/tftp_app/bootloader/app.elf +bootloader_elf_path: /home/ly0kos/work/Verify/FW/tftp_app/tftp_app/tftp.elf erase_all: false firmware_bin_path: /home/ly0kos/work/Verify/FW/V1.3.1.3.3_06_01_pmu_cpld_check/V1.3.1.3.3_06_01_pmu_cpld_check.bin flash_model: s25fl256s1 diff --git a/src/gui/main_window.py b/src/gui/main_window.py index 719031f..301942f 100644 --- a/src/gui/main_window.py +++ b/src/gui/main_window.py @@ -158,21 +158,46 @@ class MainWindow(ctk.CTk): if self._config_path: try: self._config = Config.from_file(self._config_path) - # If loaded from default_config.yaml, set save path to config.yaml if self._config_path.name == "default_config.yaml": user_config_path = self._get_user_config_path() self._config._config_path = user_config_path except Exception: self._config = Config.from_default() - # Set save path to config.yaml for new configs user_config_path = self._get_user_config_path() self._config._config_path = user_config_path else: self._config = Config.from_default() - # Set save path to config.yaml for new configs user_config_path = self._get_user_config_path() self._config._config_path = user_config_path + def _reload_config(self) -> None: + """Re-read config.yaml and update UI selectors with latest paths.""" + user_path = self._get_user_config_path() + if not user_path.exists(): + return + try: + fresh = Config.from_file(user_path) + self._config = fresh + # Update UI selectors + for attr, selector in [ + ("bootloader_bit_path", self._bit_selector), + ("bootloader_elf_path", self._elf_selector), + ("bootloader_bin_path", self._bootloader_bin_selector), + ("fsbl_elf_path", self._fsbl_selector), + ("firmware_bin_path", self._firmware_bin_selector), + ]: + val = getattr(fresh, attr, "") + if val: + selector.set_path(str(fresh.resolve_path(val))) + # Update IP + if self._ip_string_var: + self._ip_string_var.set(fresh.zynq_ip) + # Update xilinx path + if hasattr(fresh, 'xilinx_path') and self._xilinx_path_var: + self._xilinx_path_var.set(fresh.xilinx_path) + except Exception: + pass # Keep existing config on error + def _sync_config_from_ui(self) -> None: """Read current UI values and update the Config object. @@ -989,6 +1014,9 @@ class MainWindow(ctk.CTk): if index >= len(self._steps): return + # Always re-read config.yaml before running + self._reload_config() + self._is_running = True self._run_btn.configure(state="disabled", text="Running...") self._progress.reset() @@ -1022,6 +1050,9 @@ class MainWindow(ctk.CTk): if self._is_running: return + # Always re-read config.yaml before running + self._reload_config() + self._is_running = True self._run_btn.configure(state="disabled", text="Running...") self._progress.reset()