Pollutants: fix deletion, didnt work correctly due to relative / flat indexes

new_design_pol
Dylan Jeannin 2026-09-02 18:00:35 +02:00
parent b6be245764
commit 1f5ce72fb2
1 changed files with 1 additions and 5 deletions

View File

@ -110,14 +110,10 @@ class TableModel(PamhyrTableModel):
def delete(self, rows, parent=QModelIndex()):
self.beginRemoveRows(parent, rows[0], rows[-1])
data_rows = {
id(pol): i for i, pol in enumerate(self._data._Pollutants._lst)
}
self._undo.push(
DelCommand(
self._data._Pollutants,
[data_rows[id(self._lst[row])] for row in rows
if 0 <= row < len(self._lst)],
[row for row in rows if 0 <= row < len(self._lst)],
self._data.ic_adists
)
)