move iteration of deleting sets inside undo

This commit is contained in:
Dominik Demuth
2023-04-15 14:55:14 +02:00
parent c94231f9d9
commit e41c42d573
2 changed files with 54 additions and 19 deletions

View File

@ -287,15 +287,26 @@ class UpperManagement(QtCore.QObject):
self.undostack.beginMacro('Delete')
rm_set_by_graph = {}
for k in rm_sets[::-1]:
if k in self.data:
cmd = DeleteCommand(self.data, k, self.newData, self.deleteData)
self.undostack.push(cmd)
parent_graph = self.data[k].graph
if parent_graph not in rm_set_by_graph:
rm_set_by_graph[parent_graph] = []
rm_set_by_graph[parent_graph].append(k)
elif k in self.graphs:
rm_graphs.append(k)
else:
logger.warning(f'delete_sets: {k} is not in data or graph found')
for gid, sid_list in rm_set_by_graph.items():
cmd = DeleteCommand(self.data, sid_list, self.graphs, gid, self.newData, self.deleteData)
self.undostack.push(cmd)
for k in rm_graphs:
cmd = DeleteGraphCommand(self.graphs, k, self.restoreGraph, self.deleteGraph)
self.undostack.push(cmd)