mirror of https://gitlab.com/pamhyr/pamhyr2
SL: Fix SL edition command.
parent
1b1bbb6d02
commit
3397754abc
|
|
@ -76,9 +76,15 @@ class TableModel(QAbstractTableModel):
|
||||||
self._sl, row, value
|
self._sl, row, value
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if self._headers[column] == "comment":
|
if self._headers[column] == "type":
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
SetCommentCommand(
|
SetTypeCommand(
|
||||||
|
self._sl, row, value
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if self._headers[column] == "height":
|
||||||
|
self._undo.push(
|
||||||
|
SetHeightCommand(
|
||||||
self._sl, row, value
|
self._sl, row, value
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,21 @@ class SetNameCommand(QUndoCommand):
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self._sediment_layers.get(self._index).name = self._new
|
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):
|
class SetHeightCommand(QUndoCommand):
|
||||||
def __init__(self, sediment_layers, index, new_value):
|
def __init__(self, sediment_layers, index, new_value):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue