forked from IPKM/nmreval
undo of sets were missing from graph delete undo
This commit is contained in:
parent
0c7ca0b9ba
commit
386bc5a371
@ -302,6 +302,7 @@ class UpperManagement(QtCore.QObject):
|
|||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def delete_sets(self, rm_sets: list = None):
|
def delete_sets(self, rm_sets: list = None):
|
||||||
rm_graphs = []
|
rm_graphs = []
|
||||||
|
print(rm_sets)
|
||||||
|
|
||||||
if rm_sets is None:
|
if rm_sets is None:
|
||||||
rm_sets = self.graphs[self.current_graph].sets + [self.current_graph]
|
rm_sets = self.graphs[self.current_graph].sets + [self.current_graph]
|
||||||
@ -314,21 +315,27 @@ class UpperManagement(QtCore.QObject):
|
|||||||
if k in self.data:
|
if k in self.data:
|
||||||
parent_graph = self.data[k].graph
|
parent_graph = self.data[k].graph
|
||||||
if parent_graph not in rm_set_by_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:
|
elif k in self.graphs:
|
||||||
rm_graphs.append(k)
|
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:
|
else:
|
||||||
logger.warning(f'delete_sets: {k} is not in data or graph found')
|
logger.warning(f'delete_sets: {k} is not in data or graph found')
|
||||||
|
|
||||||
for gid, sid_list in rm_set_by_graph.items():
|
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)
|
self.undostack.push(cmd)
|
||||||
|
|
||||||
for k in rm_graphs:
|
for k in rm_graphs:
|
||||||
|
print('delete graphs')
|
||||||
cmd = DeleteGraphCommand(self.graphs, k, self.restoreGraph, self.deleteGraph)
|
cmd = DeleteGraphCommand(self.graphs, k, self.restoreGraph, self.deleteGraph)
|
||||||
self.undostack.push(cmd)
|
self.undostack.push(cmd)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user