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