forked from IPKM/nmreval
set graphs in fc reader
This commit is contained in:
parent
29518b9ea0
commit
e5563d55d5
@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pathlib
|
||||
|
||||
from nmreval.io.fcbatchreader import FCReader
|
||||
@ -31,6 +33,10 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
|
||||
|
||||
return super().eventFilter(src, evt)
|
||||
|
||||
def add_graphs(self, graphs: list[tuple[str, str]]):
|
||||
for gid, graph_name in graphs:
|
||||
self.graph_comboBox.addItem(graph_name, gid)
|
||||
|
||||
@QtCore.pyqtSlot(int, name='on_region_checkBox_stateChanged')
|
||||
def use_region(self, state: int):
|
||||
self.start_lineedit.setEnabled(state == QtCore.Qt.Checked)
|
||||
@ -43,17 +49,16 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
|
||||
infiles, _ = QtWidgets.QFileDialog.getOpenFileNames(caption='Select HDF files',
|
||||
directory=str(self.path),
|
||||
filter='HDF files (*.h5)')
|
||||
if infiles:
|
||||
self.listWidget.addItems(infiles)
|
||||
self.label.setText(str(pathlib.Path(infiles[-1]).parent))
|
||||
|
||||
else:
|
||||
infiles = QtWidgets.QFileDialog.getExistingDirectory(caption='Select input directory',
|
||||
directory=str(self.path),
|
||||
options=QtWidgets.QFileDialog.ShowDirsOnly)
|
||||
|
||||
if infiles:
|
||||
self.listWidget.addItem(infiles)
|
||||
self.label.setText(str(pathlib.Path(infiles).parent))
|
||||
if infiles:
|
||||
self.listWidget.addItems(infiles)
|
||||
self.path = pathlib.Path(infiles[-1]).parent
|
||||
self.label.setText(str(self.path))
|
||||
|
||||
@QtCore.pyqtSlot(name='on_savebutton_clicked')
|
||||
def save_path(self):
|
||||
|
@ -254,6 +254,7 @@ 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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user