🐛 fix(gui): single-step execution now runs only selected step
- Add single_step parameter to _run_steps_worker - _execute_step now passes single_step=True - _run_all_steps passes single_step=False explicitly - Single step execution no longer runs subsequent steps
This commit is contained in:
+13
-11
@@ -780,18 +780,17 @@ class MainWindow(ctk.CTk):
|
||||
self._run_btn.configure(state="disabled", text="Running...")
|
||||
self._progress.reset()
|
||||
|
||||
# Reset status for this step and all after it
|
||||
for i in range(index, len(self._steps)):
|
||||
self._step_statuses[i] = "pending"
|
||||
self._steps[i].set_status("pending")
|
||||
# Reset status for this step only
|
||||
self._step_statuses[index] = "pending"
|
||||
self._steps[index].set_status("pending")
|
||||
|
||||
self._progress.set_value(0.0)
|
||||
|
||||
# Start background worker thread
|
||||
# Start background worker thread with single_step=True
|
||||
self._worker_thread = threading.Thread(
|
||||
target=self._run_steps_worker,
|
||||
daemon=True,
|
||||
args=(index,),
|
||||
args=(index, True), # single_step=True
|
||||
)
|
||||
self._worker_thread.start()
|
||||
|
||||
@@ -823,15 +822,16 @@ class MainWindow(ctk.CTk):
|
||||
self._worker_thread = threading.Thread(
|
||||
target=self._run_steps_worker,
|
||||
daemon=True,
|
||||
args=(0,), # Start from step 0
|
||||
args=(0, False), # single_step=False
|
||||
)
|
||||
self._worker_thread.start()
|
||||
|
||||
def _run_steps_worker(self, start_index: int = 0) -> None:
|
||||
def _run_steps_worker(self, start_index: int = 0, single_step: bool = False) -> None:
|
||||
"""Worker method that runs workflow steps in the background.
|
||||
|
||||
Args:
|
||||
start_index: Index of the first step to run (0-based).
|
||||
single_step: If True, only run the step at start_index.
|
||||
"""
|
||||
step_funcs = [
|
||||
self._run_step_1_check_environment,
|
||||
@@ -840,10 +840,12 @@ class MainWindow(ctk.CTk):
|
||||
self._run_step_4_load_main_program,
|
||||
]
|
||||
|
||||
total = len(step_funcs) - start_index
|
||||
# Determine end index based on single_step flag
|
||||
end_index = start_index + 1 if single_step else len(step_funcs)
|
||||
total = end_index - start_index
|
||||
results: list[bool] = []
|
||||
|
||||
for i in range(start_index, len(step_funcs)):
|
||||
for i in range(start_index, end_index):
|
||||
step_idx = i - start_index
|
||||
self._set_step_status(i, "running")
|
||||
self._progress.set_value(step_idx / total)
|
||||
@@ -860,7 +862,7 @@ class MainWindow(ctk.CTk):
|
||||
self._progress.set_value((step_idx + 1) / total)
|
||||
|
||||
# Stop on first failure when running all steps
|
||||
if start_index == 0 and not success:
|
||||
if not single_step and not success:
|
||||
break
|
||||
|
||||
# Inter-step delay (skip after last step)
|
||||
|
||||
Reference in New Issue
Block a user