- besides reporting the error into the log file now any application crash is reported also in a MessageBox after which the application will close

This commit is contained in:
Marius Stanciu
2021-09-26 05:21:01 +03:00
committed by Marius
parent 08d3a580ac
commit d2cb145998
2 changed files with 25 additions and 1 deletions

View File

@@ -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

View File

@@ -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)