def process_start(self, row, process, warn=True):
"""
Handle the startup of a B3 process.
:param row: the number of the row displaying the process state
:param process: the QProcess instance to start
:param warn: whether to warn the user of a startup failure or not
"""
if process.state() != QProcess.Running:
# refresh the config before running
process.config = process.config_path
self.paint_row(row)
if process.isFlag(CONFIG_READY):
process.stateChanged.connect(partial(self.paint_row, row=row))
process.start()
else:
if warn:
suffix = 'not found' if process.isFlag(CONFIG_FOUND) else 'not valid'
reason = 'configuration file %s: %s' % (suffix, process.config_path)
msgbox = QMessageBox()
msgbox.setIcon(QMessageBox.Warning)
msgbox.setWindowTitle('WARNING')
msgbox.setText('%s startup failure: %s' % (process.name, reason))
msgbox.setStandardButtons(QMessageBox.Ok)
msgbox.exec_()
评论列表
文章目录