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.
This commit is contained in:
+34
-3
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user