pick position remembers selected destination graph; closes #62

This commit is contained in:
Dominik Demuth 2023-05-14 18:16:23 +02:00
parent 45d319834b
commit 753cd06dd1
2 changed files with 15 additions and 1 deletions

View File

@ -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):

View File

@ -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]