def main(): app = QApplication(sys.argv) if getattr(sys, 'frozen', False): iconPath = os.path.join(sys._MEIPASS, 'Icon.ico') else: iconPath = os.path.abspath( os.path.join(os.path.dirname('__file__'), '../icons/Icon.ico')) if os.path.exists(iconPath): app.setWindowIcon(QIcon(iconPath)) form = PyPolarmap(app) # setup the error handler global e_dialog e_dialog = QErrorMessage(form) e_dialog.setWindowModality(QtCore.Qt.WindowModal) font = QFont() font.setFamily("Consolas") font.setPointSize(8) e_dialog.setFont(font) form.show() app.exec_()
os.path.join(os.path.dirname('__file__'), '../icons/Icon.ico')) if os.path.exists(icon_path): app.setWindowIcon(QIcon(icon_path)) return app, Preferences(QSettings("3ll3d00d", "qvibe-analyser")) if __name__ == '__main__': app, prefs = make_app() form = QVibe(app, prefs) # setup the error handler e_dialog = QErrorMessage(form) e_dialog.setWindowModality(QtCore.Qt.WindowModal) font = QFont() font.setFamily("Consolas") font.setPointSize(8) e_dialog.setFont(font) # add the exception handler so we can see the errors in a QErrorMessage sys._excepthook = sys.excepthook def dump_exception_to_log(exctype, value, tb): import traceback print(exctype, value, tb) global e_dialog if e_dialog is not None: formatted = traceback.format_exception(etype=exctype, value=value, tb=tb) e_dialog.setWindowTitle('Unexpected Error') url = 'https://github.com/3ll3d00d/qvibe-analyser/issues/new' msg = f"Unexpected Error detected, go to {url} to log the issue<p>{'<br>'.join(formatted)}" e_dialog.showMessage(msg)