Merge branch 'refs/heads/256-fc-persistence' into dev

# Conflicts:
#	src/gui_qt/main/mainwindow.py
This commit is contained in:
Dominik Demuth 2024-06-24 17:55:13 +02:00
commit ab586ac39a
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) 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: def eventFilter(self, src: QtCore.QObject, evt: QtCore.QEvent) -> bool:
# intercept key press in listwidget to allow deletion with Del # intercept key press in listwidget to allow deletion with Del
if evt.type() == QtCore.QEvent.Type.KeyPress: if evt.type() == QtCore.QEvent.Type.KeyPress:
@ -82,6 +88,7 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
def accept(self): def accept(self):
items = [self.listWidget.item(i).text() for i in range(self.listWidget.count())] items = [self.listWidget.item(i).text() for i in range(self.listWidget.count())]
print(items)
if items: if items:
with busy_cursor(): with busy_cursor():
self.read(items) self.read(items)
@ -116,6 +123,7 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
ret_vals = [] ret_vals = []
ret_vals.extend(fc_eval.get_parameter(path=self.label.text(), kind='temp', parameter=save_variables)) ret_vals.extend(fc_eval.get_parameter(path=self.label.text(), kind='temp', parameter=save_variables))
print(ret_vals)
grp = '' grp = ''
if not self.graph_checkbox.isChecked(): if not self.graph_checkbox.isChecked():

View File

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