From 753cd06dd1c391b6f83fe30fc21788a6c3d07002 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Sun, 14 May 2023 18:16:23 +0200 Subject: [PATCH] pick position remembers selected destination graph; closes #62 --- src/gui_qt/data/point_select.py | 8 +++++++- src/gui_qt/main/mainwindow.py | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gui_qt/data/point_select.py b/src/gui_qt/data/point_select.py index f821ccd..9abfc4f 100644 --- a/src/gui_qt/data/point_select.py +++ b/src/gui_qt/data/point_select.py @@ -187,9 +187,15 @@ class PointSelectWidget(QtWidgets.QWidget, Ui_Form): self.peaktable.blockSignals(False) def set_graphs(self, graphs: list): + last_graph = self.graph_combobox.currentData() self.graph_combobox.clear() - for g in graphs: + idx = 0 + for i, g in enumerate(graphs): self.graph_combobox.addItem(g[1], userData=g[0]) + if g[0] == last_graph: + idx = i + + self.graph_combobox.setCurrentIndex(idx) @QtCore.pyqtSlot(int, name='on_graph_checkbox_stateChanged') def changed_state(self, checked): diff --git a/src/gui_qt/main/mainwindow.py b/src/gui_qt/main/mainwindow.py index 0bb4938..8f0ce3f 100644 --- a/src/gui_qt/main/mainwindow.py +++ b/src/gui_qt/main/mainwindow.py @@ -239,6 +239,8 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow): self.actionConcatenate_sets.triggered.connect(lambda : self.management.cat()) + self.management.graphs.valueChanged.connect(self.update_graph_list) + @QtCore.pyqtSlot(name='on_action_open_triggered') def open(self): filedialog = OpenFileDialog(directory=self.path, caption='Open files', @@ -412,6 +414,12 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow): if self.area.subWindowList(): self.area.activateNextSubWindow() + @QtCore.pyqtSlot() + def update_graph_list(self): + graph_list = self.management.graphs.list() + self.t1tauwidget.set_graphs(graph_list) + self.ptsselectwidget.set_graphs(graph_list) + @QtCore.pyqtSlot(str) def set_graph(self, key: str): w = self.management.graphs[key]