small stuff

This commit is contained in:
Dominik Demuth 2024-01-10 11:24:07 +01:00
parent 73bdc71a83
commit ec9001fb93

View File

@ -28,8 +28,8 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
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.KeyPress:
if evt.key() == QtCore.Qt.Key_Delete:
if evt.type() == QtCore.QEvent.Type.KeyPress:
if evt.key() == QtCore.Qt.Key.Key_Delete:
self.listWidget.takeItem(self.listWidget.currentRow())
return True
@ -41,21 +41,25 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
@QtCore.pyqtSlot(int, name='on_region_checkBox_stateChanged')
def use_region(self, state: int):
self.start_lineedit.setEnabled(state == QtCore.Qt.Checked)
self.stop_lineedit.setEnabled(state == QtCore.Qt.Checked)
self.start_lineedit.setEnabled(state == QtCore.Qt.CheckState.Checked)
self.stop_lineedit.setEnabled(state == QtCore.Qt.CheckState.Checked)
@QtCore.pyqtSlot(name='on_file_pushbutton_clicked')
@QtCore.pyqtSlot(name='on_dir_pushbutton_clicked')
def get_input(self):
if self.sender() == self.file_pushbutton:
infiles, _ = QtWidgets.QFileDialog.getOpenFileNames(caption='Select HDF files',
directory=str(self.path),
filter='HDF files (*.h5)')
infiles, _ = QtWidgets.QFileDialog.getOpenFileNames(
caption='Select HDF files',
directory=str(self.path),
filter='HDF files (*.h5)',
)
else:
infiles = QtWidgets.QFileDialog.getExistingDirectory(caption='Select input directory',
directory=str(self.path),
options=QtWidgets.QFileDialog.ShowDirsOnly)
infiles = QtWidgets.QFileDialog.getExistingDirectory(
caption='Select input directory',
directory=str(self.path),
options=QtWidgets.QFileDialog.ShowDirsOnly,
)
infiles = [infiles] if infiles else infiles
if infiles:
@ -65,9 +69,12 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
@QtCore.pyqtSlot(name='on_savebutton_clicked')
def save_path(self):
outfile = QtWidgets.QFileDialog.getExistingDirectory(self, caption='Select directory',
directory=self.label.text(),
options=QtWidgets.QFileDialog.ShowDirsOnly)
outfile = QtWidgets.QFileDialog.getExistingDirectory(
self,
caption='Select directory',
directory=self.label.text(),
options=QtWidgets.QFileDialog.ShowDirsOnly,
)
if outfile:
self.label.setText(outfile)
@ -110,6 +117,6 @@ class QFCReader(QtWidgets.QDialog, Ui_FCEval_dialog):
grp = ''
if not self.graph_checkbox.isChecked():
grp = self.graph_comboBox.currentData(QtCore.Qt.UserRole)
grp = self.graph_comboBox.currentData(QtCore.Qt.ItemDataRole.UserRole)
self.data_read.emit(ret_vals, grp)