diff --git a/src/View/BoundaryCondition/BCUndoCommand.py b/src/View/BoundaryCondition/BCUndoCommand.py index 3cd3774f0aaeb2024e35d13c7530bdadb53eba87..dfddf82cbd315c01875b9b41b3dea9efba8516c1 100644 --- a/src/View/BoundaryCondition/BCUndoCommand.py +++ b/src/View/BoundaryCondition/BCUndoCommand.py @@ -99,7 +99,7 @@ class SortCommand(QUndoCommand): self._lst = lst self._reverse = _reverse - self.old = self._lst.copy() + self._old = self._lst.copy() self._indexes = None def undo(self): @@ -109,7 +109,10 @@ class SortCommand(QUndoCommand): ) def redo(self): - self._lst.sort(self._reverse) + self._lst.sort( + reverse=self._reverse, + key=lambda x: x.name + ) if self._indexes is None: self._indexes = list( map( diff --git a/src/View/BoundaryCondition/BoundaryConditionWindow.py b/src/View/BoundaryCondition/BoundaryConditionWindow.py index 538b5a52fd6378d432c5acef5b414d2406d03ba9..5edac3414d054df3541f0044e0b1aa9f0d8d0b6c 100644 --- a/src/View/BoundaryCondition/BoundaryConditionWindow.py +++ b/src/View/BoundaryCondition/BoundaryConditionWindow.py @@ -202,7 +202,7 @@ class TableModel(QAbstractTableModel): def sort(self, _reverse, parent=QModelIndex()): self.layoutAboutToBeChanged.emit() - self._undo_stack.push( + self._undo.push( SortCommand( self._lst, False )