fix delete for pollutants D90

This commit is contained in:
Dylan Jeannin committed 2026-04-28 11:06:57 +02:00
1 parent ac79fae1fb
commit df9e1ec42d
2 files changed
+14 -3

No files matched your search

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