diff --git a/src/View/BoundaryCondition/Edit/Table.py b/src/View/BoundaryCondition/Edit/Table.py index 75e68131..6f5c7e1e 100644 --- a/src/View/BoundaryCondition/Edit/Table.py +++ b/src/View/BoundaryCondition/Edit/Table.py @@ -44,7 +44,6 @@ from Model.BoundaryCondition.BoundaryConditionTypes import ( from View.BoundaryCondition.Edit.UndoCommand import ( SetDataCommand, AddCommand, DelCommand, SortCommand, MoveCommand, PasteCommand, - DuplicateCommand, ) _translate = QCoreApplication.translate diff --git a/src/View/BoundaryCondition/Edit/UndoCommand.py b/src/View/BoundaryCondition/Edit/UndoCommand.py index 14c2b982..8aa07641 100644 --- a/src/View/BoundaryCondition/Edit/UndoCommand.py +++ b/src/View/BoundaryCondition/Edit/UndoCommand.py @@ -174,25 +174,10 @@ class PasteCommand(QUndoCommand): self._bcs.reverse() def undo(self): - self._data.delete(self._bcs) + self._data.delete_i( + range(self._row, self._row + len(self._bcs)) + ) def redo(self): for bc in self._bcs: self._data.insert(self._row, bc) - - -class DuplicateCommand(QUndoCommand): - def __init__(self, data, rows, bc): - QUndoCommand.__init__(self) - - self._data = data - self._rows = rows - self._bc = deepcopy(bc) - self._bc.reverse() - - def undo(self): - self._data.delete(self._bc) - - def redo(self): - for bc in self._bcs: - self._data.insert(self._rows[0], bc) diff --git a/src/View/BoundaryCondition/Table.py b/src/View/BoundaryCondition/Table.py index 0115b9e9..024dc288 100644 --- a/src/View/BoundaryCondition/Table.py +++ b/src/View/BoundaryCondition/Table.py @@ -44,7 +44,7 @@ from View.Tools.PamhyrTable import PamhyrTableModel from View.BoundaryCondition.UndoCommand import ( SetNameCommand, SetNodeCommand, SetTypeCommand, AddCommand, DelCommand, SortCommand, - MoveCommand, PasteCommand, DuplicateCommand, + MoveCommand, PasteCommand, ) from View.BoundaryCondition.translate import BC_types diff --git a/src/View/BoundaryCondition/UndoCommand.py b/src/View/BoundaryCondition/UndoCommand.py index 356d854b..64bfebbe 100644 --- a/src/View/BoundaryCondition/UndoCommand.py +++ b/src/View/BoundaryCondition/UndoCommand.py @@ -187,26 +187,11 @@ class PasteCommand(QUndoCommand): self._bc.reverse() def undo(self): - self._bcs.delete(self._tab, self._bc) + self._bcs.delete_i( + self._tab, + range(self._row, self._row + len(self._bc)) + ) def redo(self): for bc in self._bc: self._bcs.insert(self._tab, self._row, bc) - - -class DuplicateCommand(QUndoCommand): - def __init__(self, bcs, tab, rows, bc): - QUndoCommand.__init__(self) - - self._bcs = bcs - self._tab = tab - self._rows = rows - self._bc = deepcopy(bc) - self._bc.reverse() - - def undo(self): - self._bcs.delete(self._tab, self._bc) - - def redo(self): - for bc in self._bcs: - self._bcs.insert(self._tab, self._rows[0], bc) diff --git a/src/View/BoundaryCondition/Window.py b/src/View/BoundaryCondition/Window.py index 4489a509..a007b7a0 100644 --- a/src/View/BoundaryCondition/Window.py +++ b/src/View/BoundaryCondition/Window.py @@ -47,7 +47,7 @@ from Model.BoundaryCondition.BoundaryConditionTypes import ( from View.BoundaryCondition.UndoCommand import ( SetNameCommand, SetNodeCommand, SetTypeCommand, AddCommand, DelCommand, SortCommand, - MoveCommand, PasteCommand, DuplicateCommand, + MoveCommand, PasteCommand, ) from View.BoundaryCondition.Table import (