mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
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
This commit is contained in:
parent
d7b982ec9a
commit
9d6cd4cd76
1 changed files with 9 additions and 1 deletions
|
@ -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"<h1>{tr.qt_misc_error()}</h1><div style='white-space: pre-wrap'>{error}</div>"
|
||||
showText(
|
||||
txt,
|
||||
type="html",
|
||||
copyBtn=True,
|
||||
)
|
||||
|
||||
def onAddonsDialog(self) -> None:
|
||||
aqt.dialogs.open("AddonsDialog", self)
|
||||
|
|
Loading…
Reference in a new issue