bugfixes (#192)
All checks were successful
Build AppImage / Explore-Gitea-Actions (push) Successful in 1m56s

closes #123

Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de>
Reviewed-on: #192
This commit is contained in:
2023-12-28 16:58:37 +00:00
parent 694d47267d
commit 24bba43b40
3 changed files with 27 additions and 6 deletions

View File

@ -279,13 +279,16 @@ class UpperManagement(QtCore.QObject):
@QtCore.pyqtSlot()
@QtCore.pyqtSlot(list, str)
def copy_sets(self, sets: list = None, src: str = None):
if sets is None:
sets = self.graphs[self.current_graph].active[:]
def copy_sets(self, sets: list = None, src: str = None, dest: str = None):
if src is None:
src = self.current_graph
if sets is None:
sets = self.graphs[src].active[:]
if dest is None:
dest = src
new_ids = []
for s in sets:
copy_of_s = self.data[s].copy(full=True)
@ -293,10 +296,23 @@ class UpperManagement(QtCore.QObject):
new_ids.append(copy_of_s.id)
self.data[copy_of_s.id] = copy_of_s
self.newData.emit(new_ids, src)
self.newData.emit(new_ids, dest)
return new_ids
def copy_graph(self, gid):
# Use state of old graph but removes actual references to old graph
src_state = self.graphs[gid].get_state()
src_state.pop('id')
src_state['children'] = []
src_state['active'] = []
new_graph = QGraphWindow.set_state(src_state)
self.graphs[new_graph.id] = new_graph
self.restoreGraph.emit(new_graph.id)
self.copy_sets(src=gid, dest=new_graph.id)
@QtCore.pyqtSlot(list)
@QtCore.pyqtSlot(str)
@QtCore.pyqtSlot()