mirror of https://gitlab.com/pamhyr/pamhyr2
Scenarios: Set parent to EDIT when deleting current scenario
parent
a78be47e2b
commit
5fb6fecc24
|
|
@ -546,7 +546,7 @@ class Study(SQLModel):
|
||||||
self.status.scenario = scenario
|
self.status.scenario = scenario
|
||||||
|
|
||||||
if reduce(
|
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,
|
self.scenarios.lst,
|
||||||
False
|
False
|
||||||
):
|
):
|
||||||
|
|
|
||||||
|
|
@ -74,11 +74,10 @@ class DeleteScenariosCommand(QUndoCommand):
|
||||||
self._study.reload_from_scenario(self._scenario)
|
self._study.reload_from_scenario(self._scenario)
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
|
self._scenario.set_as_deleted()
|
||||||
if self._reload:
|
if self._reload:
|
||||||
self._study.reload_from_scenario(self._scenario.parent)
|
self._study.reload_from_scenario(self._scenario.parent)
|
||||||
|
|
||||||
self._scenario.set_as_deleted()
|
|
||||||
|
|
||||||
|
|
||||||
class DuplicateScenariosCommand(QUndoCommand):
|
class DuplicateScenariosCommand(QUndoCommand):
|
||||||
def __init__(self, study):
|
def __init__(self, study):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue