mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
debug delete functionnality in InitialConditionsAdisTS
This commit is contained in:
1 parent
1f97af9c03
commit
4550fc95d7
3 files changed
+48
-21
No files matched your search
@@ -117,7 +117,12 @@ class InitialConditionTableModel(PamhyrTableModel):
|
||||
self._data = data
|
||||
|
||||
def _setup_lst(self):
|
||||
self._lst = self._data._data
|
||||
self._lst = list(
|
||||
filter(
|
||||
lambda ica: ica._deleted == False,
|
||||
self._data._data
|
||||
)
|
||||
)
|
||||
|
||||
def rowCount(self, parent):
|
||||
return len(self._lst)
|
||||
@@ -222,12 +227,18 @@ class InitialConditionTableModel(PamhyrTableModel):
|
||||
def delete(self, rows, parent=QModelIndex()):
|
||||
self.beginRemoveRows(parent, rows[0], rows[-1])
|
||||
|
||||
data_rows = {
|
||||
id(ica): i for i, ica 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()
|
||||
|
||||
|
||||
@@ -181,7 +181,6 @@ class DelCommand(QUndoCommand):
|
||||
self._data = data
|
||||
self._ics_spec = ics_spec
|
||||
self._rows = rows
|
||||
# self._data = data
|
||||
|
||||
self._ic = []
|
||||
for row in rows:
|
||||
|
||||
Reference in new issue
Block a user