From 5fb6fecc24c950a479c38998d7e3baa71391c500 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Fri, 22 May 2026 17:25:44 +0200 Subject: [PATCH] Scenarios: Set parent to EDIT when deleting current scenario --- src/Model/Study.py | 2 +- src/View/Scenarios/UndoCommand.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Model/Study.py b/src/Model/Study.py index e5ecdbbf..250efa8f 100644 --- a/src/Model/Study.py +++ b/src/Model/Study.py @@ -546,7 +546,7 @@ class Study(SQLModel): self.status.scenario = scenario if reduce( - lambda a, s: a or (s.parent is scenario), + lambda a, s: a or (s.parent is scenario and not s.is_deleted()), self.scenarios.lst, False ): diff --git a/src/View/Scenarios/UndoCommand.py b/src/View/Scenarios/UndoCommand.py index 22134470..ae3e0449 100644 --- a/src/View/Scenarios/UndoCommand.py +++ b/src/View/Scenarios/UndoCommand.py @@ -74,11 +74,10 @@ class DeleteScenariosCommand(QUndoCommand): self._study.reload_from_scenario(self._scenario) def redo(self): + self._scenario.set_as_deleted() if self._reload: self._study.reload_from_scenario(self._scenario.parent) - self._scenario.set_as_deleted() - class DuplicateScenariosCommand(QUndoCommand): def __init__(self, study):