mirror of https://gitlab.com/pamhyr/pamhyr2
fix delete for pollutants D90
parent
ac79fae1fb
commit
df9e1ec42d
|
|
@ -167,7 +167,7 @@ class D90AdisTSSpec(SQLSubModel):
|
|||
owner_scenario=owner_scenario
|
||||
)
|
||||
if deleted:
|
||||
new_spec.is_deleted()
|
||||
new_spec.set_as_deleted()
|
||||
|
||||
new_spec.reach = reach
|
||||
new_spec.start_rk = start_rk
|
||||
|
|
|
|||
|
|
@ -118,7 +118,12 @@ class D90TableModel(PamhyrTableModel):
|
|||
self._data = data
|
||||
|
||||
def _setup_lst(self):
|
||||
self._lst = self._data._data
|
||||
self._lst = list(
|
||||
filter(
|
||||
lambda d90: d90._deleted == False,
|
||||
self._data._data
|
||||
)
|
||||
)
|
||||
|
||||
def rowCount(self, parent):
|
||||
return len(self._lst)
|
||||
|
|
@ -203,12 +208,18 @@ class D90TableModel(PamhyrTableModel):
|
|||
def delete(self, rows, parent=QModelIndex()):
|
||||
self.beginRemoveRows(parent, rows[0], rows[-1])
|
||||
|
||||
data_rows = {
|
||||
id(d90): i for i, d90 in enumerate(self._data._data)
|
||||
}
|
||||
self._undo.push(
|
||||
DelCommand(
|
||||
self._data, self._lst, rows
|
||||
self._data,
|
||||
self._data._data,
|
||||
[data_rows[id(self._lst[row])] for row in rows]
|
||||
)
|
||||
)
|
||||
|
||||
self._setup_lst()
|
||||
self.endRemoveRows()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue