fix delete for pollutants D90

dev_dylan
Dylan Jeannin 2026-04-27 15:43:32 +02:00
parent a060dbd461
commit eb7c4895ca
2 changed files with 14 additions and 3 deletions

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

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()