fix delete for pollutants D90

This commit is contained in:
Dylan Jeannin committed 2026-04-27 15:43:32 +02:00
1 parent a060dbd461
commit eb7c4895ca
2 files changed
+14 -3

No files matched your search

+1 -1
View File
@@ -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
+13 -2
View File
@@ -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()