mirror of https://gitlab.com/pamhyr/pamhyr2
Pollutants: fix deletion, didnt work correctly due to relative / flat indexes
parent
b6be245764
commit
1f5ce72fb2
|
|
@ -110,14 +110,10 @@ class TableModel(PamhyrTableModel):
|
||||||
def delete(self, rows, parent=QModelIndex()):
|
def delete(self, rows, parent=QModelIndex()):
|
||||||
self.beginRemoveRows(parent, rows[0], rows[-1])
|
self.beginRemoveRows(parent, rows[0], rows[-1])
|
||||||
|
|
||||||
data_rows = {
|
|
||||||
id(pol): i for i, pol in enumerate(self._data._Pollutants._lst)
|
|
||||||
}
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
DelCommand(
|
DelCommand(
|
||||||
self._data._Pollutants,
|
self._data._Pollutants,
|
||||||
[data_rows[id(self._lst[row])] for row in rows
|
[row for row in rows if 0 <= row < len(self._lst)],
|
||||||
if 0 <= row < len(self._lst)],
|
|
||||||
self._data.ic_adists
|
self._data.ic_adists
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue