def make_new_process(self, path):
"""
Create a new B3 process using the provided configuration file path.
NOTE: this actually handle also the repainting of the main table but
since it's not a toolbar button handler it has been implemented here instead.
:param path: the configuration file path
"""
if path:
try:
abspath = b3.getAbsolutePath(path)
config = MainConfig(load_config(abspath))
except ConfigFileNotValid:
msgbox = QMessageBox()
msgbox.setIcon(QMessageBox.Critical)
msgbox.setWindowTitle('WARNING')
msgbox.setText('You selected an invalid configuration file')
msgbox.setStandardButtons(QMessageBox.Ok)
msgbox.exec_()
else:
analysis = config.analyze()
if analysis:
msgbox = QMessageBox()
msgbox.setIcon(QMessageBox.Critical)
msgbox.setWindowTitle('ERROR')
msgbox.setText('One or more problems have been detected in your configuration file')
msgbox.setDetailedText('\n'.join(analysis))
msgbox.setStandardButtons(QMessageBox.Ok)
msgbox.exec_()
else:
if not B3.exists(config.fileName):
process = B3(config=config)
process.insert()
main_table = self.centralWidget().main_table
main_table.repaint()
评论列表
文章目录