retain settings in FC reader dialog

This commit is contained in:
Dominik Demuth 2024-05-15 17:15:09 +02:00
parent 6ecc789cd5
commit cc7572fe14
2 changed files with 17 additions and 7 deletions

View File

@ -28,6 +28,12 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
self.listWidget.installEventFilter(self)
def __call__(self, path=None):
if path is None:
path = pathlib.Path().home()
self.path = path
self.listWidget.clear()
def eventFilter(self, src: QtCore.QObject, evt: QtCore.QEvent) -> bool:
# intercept key press in listwidget to allow deletion with Del
if evt.type() == QtCore.QEvent.Type.KeyPress:
@ -82,6 +88,7 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
def accept(self):
items = [self.listWidget.item(i).text() for i in range(self.listWidget.count())]
print(items)
if items:
with busy_cursor():
self.read(items)
@ -116,6 +123,7 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
ret_vals = []
ret_vals.extend(fc_eval.get_parameter(path=self.label.text(), kind='temp', parameter=save_variables))
print(ret_vals)
grp = ''
if not self.graph_checkbox.isChecked():

View File

@ -62,6 +62,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
self.fitresult_dialog = None
self.eval = None
self.editor = None
self.fc_reader = None
self.logtext = QTextHandler(self)
logger.addHandler(self.logtext)
@ -264,14 +265,15 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
@QtCore.pyqtSlot(name='on_actionOpen_FC_triggered')
def read_fc(self):
reader = QFCReader(path=self.path, parent=self)
reader.add_graphs(self.management.graphs.list())
reader.data_read.connect(self.management.add_new_data)
reader.exec()
if self.fc_reader is None:
self.fc_reader = QFCReader(path=self.path, parent=self)
self.fc_reader.data_read.connect(self.management.add_new_data)
else:
self.fc_reader(path=self.path)
self.fc_reader.add_graphs(self.management.graphs.list())
self.fc_reader.exec()
self.path = reader.path
del reader
self.path = self.fc_reader.path
@QtCore.pyqtSlot(name='on_actionPrint_triggered')
def print(self):