def run_sensor_cal_type(self, sensor, caltype, cal_info): completed = False logging.info('Running {} calibration for sensor {} on q330 (hostname: {})'.format(caltype.upper(), sensor, cal_info['ip'])) # create qcal thread qcal_thread = QCalThread(os.path.join(self.app_root_dir, pcgl.get_bin_root()), cal_info['cmd_line'][caltype], cal_info['output_dir']) ping_thread = PingThread(cal_info['ip']) dlg = QtWidgets.QDialog(self.app_win) dlg = ProgressDlg(self.app_win) progdlg = Ui_ProgressDlg() progdlg.setupUi(dlg) dlg.setWindowTitle('PyCal - Data Acquisition') if caltype == CALTYPE_RBLF: cal_descr = 'Calibration Signal: LOW Frequency Random Binary\n\n' + cal_info['cal_descr'] elif caltype == CALTYPE_RBHF: cal_descr = 'Calibration Signal: HIGH Frequency Random Binary\n\n' + cal_info['cal_descr'] else: msg = 'Invalid CALIBRATION TYPE:' + caltype logging.error(msg) QtWidgets.QMessageBox().critical(self.app_win, 'PyCal ERROR', msg, QtWidgets.QMessageBox().Close, QtWidgets.QMessageBox().Close) return False, None progdlgHlpr = ProgressDlgHelper(dlg, cal_descr, cal_info['cal_time'][caltype], progdlg, qcal_thread, ping_thread) progdlgHlpr.start() if (dlg.exec() == QtWidgets.QDialog.Accepted) and (progdlgHlpr.retcode == 0): completed = True msg = 'Calibration completed successfully. Miniseed file saved: {}'.format(progdlgHlpr.calmsfn) logging.info(msg) # res = QtWidgets.QMessageBox().information(self.app_win, 'PyCal', # 'Calibration Completed!\n\n' + progdlgHlpr.msg, # QtWidgets.QMessageBox().Close, # QtWidgets.QMessageBox().Close) else: completed = False msg1 = 'Calibration failed with exit code: {}'.format(progdlgHlpr.retcode) msg2 = 'Calibration failed with message: {}'.format(progdlgHlpr.msg) logging.error(msg1) logging.error(msg2) res = QtWidgets.QMessageBox().critical(self.app_win, 'PyCal', msg2, QtWidgets.QMessageBox().Close, QtWidgets.QMessageBox().Close) return completed, progdlgHlpr.calmsfn
def exec(self): self.qVerifyThread = QVerifyThread(self.cfg.data[WrapperCfg.WRAPPER_KEY_IP], self.cfg.data[WrapperCfg.WRAPPER_KEY_DATAPORT], pcgl.get_bin_root(), pcgl.get_config_root()) self.qVerifyThread.qVerifyQueryResult.connect(self.qVerify_query_result_slot) self.qVerifyThread.start() self.dlgUI.connMsgsEdit.setStyleSheet("QLabel{color:rgb(200, 120, 20);}") self.dlgUI.connMsgsEdit.setPlainText('Connecting to Q330 at {}...'.format(self.cfg.data[WrapperCfg.WRAPPER_KEY_IP])) QTimer.singleShot(30000, self.timeout) return self.qtDlg.exec()