mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
SL: Fix SL edition command.
This commit is contained in:
1 parent
1b1bbb6d02
commit
3397754abc
2 files changed
+23
-2
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user