Commit 3397754a authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

SL: Fix SL edition command.

Showing with 23 additions and 2 deletions
+23 -2
......@@ -76,9 +76,15 @@ class TableModel(QAbstractTableModel):
self._sl, row, value
)
)
if self._headers[column] == "comment":
if self._headers[column] == "type":
self._undo.push(
SetCommentCommand(
SetTypeCommand(
self._sl, row, value
)
)
if self._headers[column] == "height":
self._undo.push(
SetHeightCommand(
self._sl, row, value
)
)
......
......@@ -25,6 +25,21 @@ class SetNameCommand(QUndoCommand):
def redo(self):
self._sediment_layers.get(self._index).name = self._new
class SetTypeCommand(QUndoCommand):
def __init__(self, sediment_layers, index, new_value):
QUndoCommand.__init__(self)
self._sediment_layers = sediment_layers
self._index = index
self._old = self._sediment_layers.get(self._index).type
self._new = new_value
def undo(self):
self._sediment_layers.get(self._index).type = self._old
def redo(self):
self._sediment_layers.get(self._index).type = self._new
class SetHeightCommand(QUndoCommand):
def __init__(self, sediment_layers, index, new_value):
QUndoCommand.__init__(self)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment