Compare commits

..

No commits in common. "084c22836b3538d3d2861c958f72f774de606e3b" and "b450796df592334e9db4ba3743ea1b2feb64f3b2" have entirely different histories.

4 changed files with 21 additions and 5 deletions

View File

@ -548,11 +548,11 @@ class BoundaryConditionAdisTS(SQLSubModel):
self.modified()
def delete_i(self, indexes):
list(
self._data = list(
map(
lambda e: e[1].set_as_deleted(),
filter(
lambda e: e[0] in indexes,
lambda e: e[0] not in indexes,
enumerate(self.data)
)
)

View File

@ -43,7 +43,7 @@ from View.Tools.PamhyrTable import PamhyrTableModel
from View.BoundaryConditionsAdisTS.UndoCommand import (
SetNodeCommand, SetTypeCommand,
AddCommand, DelCommand
AddCommand, DelCommand, SetPolCommand
)
from View.BoundaryCondition.translate import BC_types

View File

@ -62,6 +62,22 @@ 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)
@ -90,7 +106,7 @@ class DelCommand(QUndoCommand):
self._bc = []
for row in rows:
self._bc.append((row, self._bcs._lst[row]))
self._bc.append((row, self._bcs.get(row)))
self._bc.sort()
def undo(self):

View File

@ -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: