From 9d6cd4cd76a8341aeccc8fb708b923e05d0c0567 Mon Sep 17 00:00:00 2001 From: Abdo Date: Thu, 6 Oct 2022 11:15:56 +0300 Subject: [PATCH] Use showText to show add-on import errors (#2103) * Use showText to show add-on import errors Long error messages can be completely unreadable as QMessageBox doesn't show a scrollbar and the text can't be selected and copied by default (on Windows at least). * HTML-escape error --- qt/aqt/addons.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qt/aqt/addons.py b/qt/aqt/addons.py index 871f3a4ee..c5bdcbe47 100644 --- a/qt/aqt/addons.py +++ b/qt/aqt/addons.py @@ -3,6 +3,7 @@ from __future__ import annotations +import html import io import json import os @@ -45,6 +46,7 @@ from aqt.utils import ( send_to_trash, show_info, showInfo, + showText, showWarning, tooltip, tr, @@ -246,12 +248,18 @@ class AddonManager: except AbortAddonImport: pass except: - showWarning( + error = html.escape( tr.addons_failed_to_load( name=addon.human_name(), traceback=traceback.format_exc(), ) ) + txt = f"

{tr.qt_misc_error()}

{error}
" + showText( + txt, + type="html", + copyBtn=True, + ) def onAddonsDialog(self) -> None: aqt.dialogs.open("AddonsDialog", self)