From 386bc5a371727e3229c7edf85a635581a394a683 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Wed, 29 Nov 2023 18:03:54 +0100 Subject: [PATCH] undo of sets were missing from graph delete undo --- src/gui_qt/main/management.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui_qt/main/management.py b/src/gui_qt/main/management.py index 58128bc..45fc02f 100644 --- a/src/gui_qt/main/management.py +++ b/src/gui_qt/main/management.py @@ -302,6 +302,7 @@ class UpperManagement(QtCore.QObject): @QtCore.pyqtSlot() def delete_sets(self, rm_sets: list = None): rm_graphs = [] + print(rm_sets) if rm_sets is None: rm_sets = self.graphs[self.current_graph].sets + [self.current_graph] @@ -314,21 +315,27 @@ class UpperManagement(QtCore.QObject): if k in self.data: 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] = set() - rm_set_by_graph[parent_graph].append(k) + rm_set_by_graph[parent_graph].add(k) elif k in self.graphs: rm_graphs.append(k) + if k not in rm_set_by_graph: + rm_set_by_graph[k] = set() + for ss in self.graphs[k].sets: + rm_set_by_graph[k].add(ss) 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) + print('delete set') + cmd = DeleteCommand(self.data, list(sid_list), self.graphs, gid, self.newData, self.deleteData) self.undostack.push(cmd) for k in rm_graphs: + print('delete graphs') cmd = DeleteGraphCommand(self.graphs, k, self.restoreGraph, self.deleteGraph) self.undostack.push(cmd)