def __init__(self, parent=None): super(ParametersGUI, self).__init__(parent) self.ui = Ui_DockWidget_Parameters() self.ui.setupUi(self)
class ParametersGUI(QDockWidget): """ classdocs """ """ constructor """ def __init__(self, parent=None): super(ParametersGUI, self).__init__(parent) self.ui = Ui_DockWidget_Parameters() self.ui.setupUi(self) """ connect to events emitted by the data_selector """ def setup(self, analysis): self.ana = analysis self.ana.parametersRaisedSignal.connect(self.fill_params) self.ui.comboBox_EjectName.currentIndexChanged.connect( self.toggle_ejection) def fill_params(self, filename, pipeline): log.debug("event from %s", self.sender()) short = str(filename).split(sep="\\") self.ui.lineEdit_File.setText(short[-1]) self.filename = filename if pipeline.raw.scriptable: self.enable_parameters_box() self.ui.groupBox_Comment.setVisible(False) s = pipeline.scr self.excitBuffer, self.excitation = s.get_excit() self.ejectBuffer, self.ejection = s.get_eject() self.detectBuffer, self.detection = s.get_detect() # clear old values self.update_excitation() self.update_ejections() self.update_detection() else: # clear previous comment self.disable_parameters_box() self.ui.textEdit_Comment.clear() self.ui.groupBox_Comment.setVisible(True) xmltree = XMLPirenea(self.filename + ".xml") comment = xmltree.get_comment() self.ui.textEdit_Comment.append(comment) def toggle_ejection(self): log.debug("event from %s", self.sender()) self.ui.lineEdit_EjectType.clear() self.ui.lineEdit_EjectDuration.clear() self.ui.comboBox_EjectIntensity.clear() self.ui.comboBox_EjectStart.clear() self.ui.comboBox_EjectEnd.clear() index = self.ui.comboBox_EjectName.currentIndex() # test if items exist if self.ejection and index >= 0: intensity = [] start = [] end = [] if len(self.ejectBuffer[index]) > 1: wave = self.ejectBuffer[index][2] duration = "{:.1f}".format(float(self.ejectBuffer[index][3])) intensity.append( "{:.1f}".format(float(self.ejectBuffer[index][4]))) start.append( "{:.1f}".format(float(self.ejectBuffer[index][5]))) if len(self.ejectBuffer[index]) > 6: end.append("{:.1f}".format(float(self.ejectBuffer[index][6]))) if len(self.ejectBuffer[index]) > 7: intensity.append( "{:.1f}".format(float(self.ejectBuffer[index][7]))) start.append( "{:.1f}".format(float(self.ejectBuffer[index][8]))) end.append("{:.1f}".format(float(self.ejectBuffer[index][9]))) if duration: self.ui.lineEdit_EjectDuration.setText(duration) self.ui.lineEdit_EjectType.setText(wave) self.ui.comboBox_EjectIntensity.addItems(intensity) self.ui.comboBox_EjectStart.addItems(start) self.ui.comboBox_EjectEnd.addItems(end) def enable_parameters_box(self): self.ui.groupBox_Detect.setVisible(True) self.ui.groupBox_Eject.setVisible(True) self.ui.groupBox_Excit.setVisible(True) def disable_parameters_box(self): self.ui.groupBox_Detect.setVisible(False) self.ui.groupBox_Eject.setVisible(False) self.ui.groupBox_Excit.setVisible(False) def update_excitation(self): self.ui.lineEdit_ExcitType.clear() self.ui.lineEdit_ExcitDuration.clear() self.ui.lineEdit_ExcitIntensity.clear() self.ui.lineEdit_ExcitStart.clear() self.ui.lineEdit_ExcitEnd.clear() if self.excitation: if len(self.excitBuffer[0]) >= 7: wave = self.excitBuffer[0][2] self.ui.lineEdit_ExcitType.setText(wave) self.ui.lineEdit_ExcitDuration.setText( "{:.1f}".format(float(self.excitBuffer[0][3]))) self.ui.lineEdit_ExcitIntensity.setText( "{:.1f}".format(float(self.excitBuffer[0][4]))) self.ui.lineEdit_ExcitStart.setText( "{:.1f}".format(float(self.excitBuffer[0][5]))) self.ui.lineEdit_ExcitEnd.setText( "{:.1f}".format(float(self.excitBuffer[0][6]))) else: self.ui.lineEdit_ExcitType.setText(self.excitation) def update_ejections(self): self.ui.comboBox_EjectName.clear() if self.ejection: self.ui.comboBox_EjectName.addItems(self.ejection) def update_detection(self): self.ui.comboBox_DetectName.clear() if self.detection: self.ui.comboBox_DetectName.addItem(self.detection)
class ParametersGUI(QDockWidget): """ classdocs """ """ constructor """ def __init__(self, parent=None): super(ParametersGUI, self).__init__(parent) self.ui = Ui_DockWidget_Parameters() self.ui.setupUi(self) """ connect to events emitted by the data_selector """ def setup(self, analysis): self.ana = analysis self.ana.parametersRaisedSignal.connect(self.fill_params) self.ui.comboBox_EjectName.currentIndexChanged.connect( self.toggle_ejection) def fill_params(self, filename, pipeline): log.debug("event from %s", self.sender()) short = str(filename).split(sep="\\") self.ui.lineEdit_File.setText(short[-1]) if pipeline.raw.scriptable: self.enable_parameters_box() s = pipeline.scr self.excitBuffer, self.excitation = s.get_excit() self.ejectBuffer, self.ejection = s.get_eject() self.detectBuffer, self.detection = s.get_detect() # clear old values self.update_excitation() self.update_ejections() self.update_detection() else: self.disable_parameters_box() def toggle_ejection(self): log.debug("event from %s", self.sender()) self.ui.lineEdit_EjectType.clear() self.ui.lineEdit_EjectDuration.clear() self.ui.comboBox_EjectIntensity.clear() self.ui.comboBox_EjectStart.clear() self.ui.comboBox_EjectEnd.clear() index = self.ui.comboBox_EjectName.currentIndex() # test if items exist if self.ejection and index >= 0: intensity = [] start = [] end = [] if len(self.ejectBuffer[index]) > 1: wave = self.ejectBuffer[index][2] duration = "{:.1f}".format(float(self.ejectBuffer[index][3])) intensity.append( "{:.1f}".format(float(self.ejectBuffer[index][4]))) start.append( "{:.1f}".format(float(self.ejectBuffer[index][5]))) if len(self.ejectBuffer[index]) > 6: end.append("{:.1f}".format(float(self.ejectBuffer[index][6]))) if len(self.ejectBuffer[index]) > 7: intensity.append( "{:.1f}".format(float(self.ejectBuffer[index][7]))) start.append( "{:.1f}".format(float(self.ejectBuffer[index][8]))) end.append("{:.1f}".format(float(self.ejectBuffer[index][9]))) if duration: self.ui.lineEdit_EjectDuration.setText(duration) self.ui.lineEdit_EjectType.setText(wave) self.ui.comboBox_EjectIntensity.addItems(intensity) self.ui.comboBox_EjectStart.addItems(start) self.ui.comboBox_EjectEnd.addItems(end) def enable_parameters_box(self): self.ui.groupBox_Detect.setVisible(True) self.ui.groupBox_Eject.setVisible(True) self.ui.groupBox_Excit.setVisible(True) def disable_parameters_box(self): self.ui.groupBox_Detect.setVisible(False) self.ui.groupBox_Eject.setVisible(False) self.ui.groupBox_Excit.setVisible(False) def update_excitation(self): self.ui.lineEdit_ExcitType.clear() self.ui.lineEdit_ExcitDuration.clear() self.ui.lineEdit_ExcitIntensity.clear() self.ui.lineEdit_ExcitStart.clear() self.ui.lineEdit_ExcitEnd.clear() if self.excitation: if len(self.excitBuffer[0]) >= 7: wave = self.excitBuffer[0][2] self.ui.lineEdit_ExcitType.setText(wave) self.ui.lineEdit_ExcitDuration.setText( "{:.1f}".format(float(self.excitBuffer[0][3]))) self.ui.lineEdit_ExcitIntensity.setText( "{:.1f}".format(float(self.excitBuffer[0][4]))) self.ui.lineEdit_ExcitStart.setText( "{:.1f}".format(float(self.excitBuffer[0][5]))) self.ui.lineEdit_ExcitEnd.setText( "{:.1f}".format(float(self.excitBuffer[0][6]))) else: self.ui.lineEdit_ExcitType.setText(self.excitation) def update_ejections(self): self.ui.comboBox_EjectName.clear() if self.ejection: self.ui.comboBox_EjectName.addItems(self.ejection) def update_detection(self): self.ui.comboBox_DetectName.clear() if self.detection: self.ui.comboBox_DetectName.addItem(self.detection)
class ParametersGUI(QDockWidget): """ classdocs """ """ constructor """ analysisRaisedSignal = pyqtSignal(str, object) def __init__(self, parent=None): super(ParametersGUI, self).__init__(parent) self.ui = Ui_DockWidget_Parameters() self.ui.setupUi(self) """ connect to events emitted by the data_selector """ def setup(self, analysis): self.ana = analysis self.ana.parametersRaisedSignal.connect(self.fill_params) self.ui.doubleSpinBox_Tof1.valueChanged.connect(self.calib_event) self.ui.doubleSpinBox_Tof2.valueChanged.connect(self.calib_event) self.ui.doubleSpinBox_Tof3.valueChanged.connect(self.calib_event) self.ui.doubleSpinBox_Mass1.valueChanged.connect(self.calib_event) self.ui.doubleSpinBox_Mass2.valueChanged.connect(self.calib_event) self.ui.doubleSpinBox_Mass3.valueChanged.connect(self.calib_event) self.ui.pushButton_ChangeCalib.clicked.connect(self.change_calib) self.ui.pushButton_ApplyCalib.clicked.connect(self.apply_calib) self.ui.pushButton_SaveCalibData.clicked.connect(self.write_calib_data) self.ui.pushButton_SaveMmassData.clicked.connect(self.write_mmass_data) def fill_params(self, pip): log.debug("event from %s", self.sender()) self.pip = pip self.ui.lineEdit_File.setText(self.pip.shortname) self.update_header() if self.pip.data.isCalibAvailable: self.ui.groupBox_Calibration.setEnabled(False) self.ui.pushButton_ChangeCalib.setEnabled(True) self.ui.pushButton_ApplyCalib.setEnabled(False) self.ui.pushButton_SaveCalibData.setEnabled(False) else: self.ui.groupBox_Calibration.setEnabled(True) self.ui.pushButton_ChangeCalib.setEnabled(False) self.ui.pushButton_ApplyCalib.setEnabled(True) self.ui.pushButton_SaveCalibData.setEnabled(False) def update_header(self): # self.ui.plainTextEdit_Header.clear() self.ui.plainTextEdit_Header.setPlainText(self.pip.data.headtext) def calib_event(self): log.debug("event from %s", self.sender()) self.time_list = [] self.mass_list = [] tof1 = float(self.ui.doubleSpinBox_Tof1.value()) tof2 = float(self.ui.doubleSpinBox_Tof2.value()) tof3 = float(self.ui.doubleSpinBox_Tof3.value()) mass1 = float(self.ui.doubleSpinBox_Mass1.value()) mass2 = float(self.ui.doubleSpinBox_Mass2.value()) mass3 = float(self.ui.doubleSpinBox_Mass3.value()) self.time_list = [0.0, tof1, tof2, tof3] self.mass_list = [0.001, mass1, mass2, mass3] def apply_calib(self): log.debug("event from %s", self.sender()) self.calib_event() self.pip.calib(self.time_list, self.mass_list) self.ana.time_list = self.time_list self.ana.mass_list = self.mass_list if self.pip.isCalibFound: self.ui.pushButton_SaveCalibData.setEnabled(True) self.ui.pushButton_SaveMmassData.setEnabled(True) def change_calib(self): log.debug("event from %s", self.sender()) self.ui.groupBox_Calibration.setEnabled(True) self.ui.pushButton_ChangeCalib.setEnabled(False) self.ui.pushButton_ApplyCalib.setEnabled(True) self.ui.pushButton_SaveCalibData.setEnabled(False) self.pip.data.isCalibAvailable = False def write_calib_data(self): log.debug("event from %s", self.sender()) self.pip.write_calib_data() def write_mmass_data(self): log.debug("event from %s", self.sender()) self.pip.write_mmass_data()