# -*- coding: utf-8 -*- from copy import deepcopy from tools import trace, timer from PyQt5.QtWidgets import ( QMessageBox, QUndoCommand, QUndoStack, ) from Model.SolverParameters.SolverParametersList import SolverParametersList class SetCommand(QUndoCommand): def __init__(self, data, index, column, new_value): QUndoCommand.__init__(self) self._data = data self._index = index self._column = column self._old = self._data.get(self._index)[column] self._new = new_value def undo(self): self._data.get(self._index)[self._column] = self._old def redo(self): self._data.get(self._index)[self._column] = self._new