fix stop simulation into editor

This commit is contained in:
VALLONGOL 2025-10-13 14:02:07 +02:00
parent 3f1fddd87d
commit e62b584981
3 changed files with 7 additions and 1 deletions

View File

@ -114,7 +114,7 @@
"target_azimuth_deg": 45.0
}
],
"use_spline": true
"use_spline": false
},
{
"target_id": 1,

View File

@ -200,6 +200,8 @@ class Target:
if total_duration <= 0 or self._sim_time_s >= total_duration:
# Simulation finished, stay at the last point
self._spline_index = len(self._spline_path) - 1
self.active = False
self.current_velocity_fps = 0.0
else:
# Find the current index in the spline path based on time
progress = self._sim_time_s / total_duration

View File

@ -338,6 +338,10 @@ class MainView(tk.Tk):
while not self.gui_update_queue.empty():
updated_targets: List[Target] = self.gui_update_queue.get_nowait()
self._update_all_views(updated_targets)
# Stop simulation and update buttons if all targets are inactive
if self.is_simulation_running.get():
if all(not t.active for t in self.scenario.get_all_targets()):
self._on_stop_simulation()
finally:
if self.is_simulation_running.get():
self.after(GUI_QUEUE_POLL_INTERVAL_MS, self._process_gui_queue)