From d2cb1459987482dedcca66252721eaae3c777fb9 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 26 Sep 2021 05:21:01 +0300 Subject: [PATCH] - besides reporting the error into the log file now any application crash is reported also in a MessageBox after which the application will close --- CHANGELOG.md | 4 ++++ FlatCAM.py | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c623cd3f..cfa39dbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta ================================================= +26.09.2021 + +- besides reporting the error into the log file now any application crash is reported also in a MessageBox after which the application will close + 25.09.2021 - solved more Shapely 2.0 deprecation warnings diff --git a/FlatCAM.py b/FlatCAM.py index 99f96b38..07d62145 100644 --- a/FlatCAM.py +++ b/FlatCAM.py @@ -4,7 +4,7 @@ import traceback from datetime import datetime from PyQt6 import QtWidgets -from PyQt6.QtCore import QSettings, Qt, QTimer +from PyQt6.QtCore import QSettings, QTimer, Qt from app_Main import App from appGUI import VisPyPatches @@ -119,6 +119,26 @@ if __name__ == '__main__': except IOError: with open(log_file_path, 'w') as f: f.write(msg) + + # show the message + try: + msgbox = QtWidgets.QMessageBox() + displayed_msg = "The application encountered a critical error and it will close.\n"\ + "Please report this error to the developers.\n" \ + "**************************************************************\n\n" + displayed_msg += msg + msgbox.setInformativeText(displayed_msg) + + msgbox.setWindowTitle("Critical Error") + msgbox.setIcon(QtWidgets.QMessageBox.Icon.Critical) + + bt_yes = msgbox.addButton("Quit", QtWidgets.QMessageBox.ButtonRole.YesRole) + + msgbox.setDefaultButton(bt_yes) + # msgbox.setTextFormat(Qt.TextFormat.RichText) + msgbox.exec() + except Exception: + pass QtWidgets.QApplication.quit() # or QtWidgets.QApplication.exit(0)