mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
3 Commits
b450796df5
...
084c22836b
| Author | SHA1 | Date |
|---|---|---|
|
|
084c22836b | |
|
|
726b81bf12 | |
|
|
7c3de520d9 |
|
|
@ -548,11 +548,11 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
|||
self.modified()
|
||||
|
||||
def delete_i(self, indexes):
|
||||
self._data = list(
|
||||
list(
|
||||
map(
|
||||
lambda e: e[1].set_as_deleted(),
|
||||
filter(
|
||||
lambda e: e[0] not in indexes,
|
||||
lambda e: e[0] in indexes,
|
||||
enumerate(self.data)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ from View.Tools.PamhyrTable import PamhyrTableModel
|
|||
|
||||
from View.BoundaryConditionsAdisTS.UndoCommand import (
|
||||
SetNodeCommand, SetTypeCommand,
|
||||
AddCommand, DelCommand, SetPolCommand
|
||||
AddCommand, DelCommand
|
||||
)
|
||||
from View.BoundaryCondition.translate import BC_types
|
||||
|
||||
|
|
|
|||
|
|
@ -62,22 +62,6 @@ class SetTypeCommand(QUndoCommand):
|
|||
self._bcs.get(self._index).type = self._new
|
||||
|
||||
|
||||
class SetPolCommand(QUndoCommand):
|
||||
def __init__(self, bcs, index, pollutant):
|
||||
QUndoCommand.__init__(self)
|
||||
|
||||
self._bcs = bcs
|
||||
self._index = index
|
||||
self._old = self._bcs.get(self._index).pollutant
|
||||
self._new = pollutant
|
||||
|
||||
def undo(self):
|
||||
self._bcs.get(self._index).pollutant = self._old
|
||||
|
||||
def redo(self):
|
||||
self._bcs.get(self._index).pollutant = self._new
|
||||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
def __init__(self, pollutant, bcs, index):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -106,7 +90,7 @@ class DelCommand(QUndoCommand):
|
|||
|
||||
self._bc = []
|
||||
for row in rows:
|
||||
self._bc.append((row, self._bcs.get(row)))
|
||||
self._bc.append((row, self._bcs._lst[row]))
|
||||
self._bc.sort()
|
||||
|
||||
def undo(self):
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class AddCommand(QUndoCommand):
|
|||
self._new = None
|
||||
|
||||
def undo(self):
|
||||
self._lcs.delete_i(self._index)
|
||||
self._lcs.delete_i([self._index])
|
||||
|
||||
def redo(self):
|
||||
if self._new is None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue