stab window InitialCond AdisTS (undo / redo / add / delete / save / load), all should work correctly

disable_edition_parent_scenario
Dylan Jeannin 2026-05-11 16:14:35 +02:00
parent b1daadf9f2
commit b450796df5
2 changed files with 20 additions and 2 deletions

View File

@ -245,8 +245,10 @@ class InitialConditionTableModel(PamhyrTableModel):
def undo(self):
self._undo.undo()
self._setup_lst()
self.layoutChanged.emit()
def redo(self):
self._undo.redo()
self._setup_lst()
self.layoutChanged.emit()

View File

@ -273,11 +273,27 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
self._update()
def _undo(self):
undo_stack = self._undo_stack
if undo_stack is None or not undo_stack.canUndo():
return
if isinstance(undo_stack.command(undo_stack.index() - 1), SetCommand):
self._table.undo()
else:
self._table_spec.undo()
self._update()
def _redo(self):
undo_stack = self._undo_stack
if undo_stack is None or not undo_stack.canRedo():
return
if isinstance(undo_stack.command(undo_stack.index()), SetCommand):
self._table.redo()
else:
self._table_spec.redo()
self._update()
def add(self):