From 2e7da0f3c62388e2638283cfcc8b13c321a2b116 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 6 Sep 2017 16:40:35 +1000 Subject: [PATCH] provide more info in error screen, and link to support site --- aqt/errors.py | 48 ++++++++++++++++++++++++++++++++++++++---------- aqt/utils.py | 4 ++-- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/aqt/errors.py b/aqt/errors.py index 5985c5810..fe9a70ba7 100644 --- a/aqt/errors.py +++ b/aqt/errors.py @@ -97,28 +97,56 @@ Possible causes: It's a good idea to run Tools>Check Database to ensure your collection \ is not corrupt. """)) + stdText = _("""\ -An error occurred. It may have been caused by a harmless bug,
-or your deck may have a problem. -

To confirm it's not a problem with your deck, please run -Tools > Check Database. -

If that doesn't fix the problem, please copy the following
-into a bug report:""") +

Error

+ +

An error occurred. Please use Tools > Check Database to see if \ +that fixes the problem.

+ +

If problems persist, please report the problem on our \ +support site. Please copy and paste \ + the information below into your report.

""") + pluginText = _("""\ +

Error

+

An error occurred. Please start Anki while holding down the shift \ key, which will temporarily disable the add-ons you have installed.

-

If the problem occurs even with add-ons disabled, please report the \ -issue on our support site.

-

If the issue only occurs when add-ons are enabled, please use the \ -Tools>Add-ons menu item to disable one add-on and restart Anki, \ +Tools>Add-ons menu item to disable some add-ons and restart Anki, \ repeating until you discover the add-on that is causing the problem.

+ +

When you've discovered the add-on that is causing the problem, please \ +report the issue on the \ +add-ons section of our support site. + +

Debug info:

""") if self.mw.addonManager.dirty: txt = pluginText else: txt = stdText # show dialog + error = self._supportText() + "\n" + error + txt = txt + "
" + error + "
" showText(txt, type="html") + + def _supportText(self): + import platform + from aqt import appVersion + + if isWin: + platname = "Windows " + platform.win32_ver()[0] + elif isMac: + platname = "Mac " + platform.mac_ver()[0] + else: + platname = "Linux" + + return f"""\ +Anki {appVersion} Python {platform.python_version()} Qt {QT_VERSION_STR} PyQt {PYQT_VERSION_STR} +Platform: {platname} +Flags: frz={getattr(sys, "frozen", False)} ao={self.mw.addonManager.dirty} +""" diff --git a/aqt/utils.py b/aqt/utils.py index 85bb21f95..111f646b2 100644 --- a/aqt/utils.py +++ b/aqt/utils.py @@ -66,8 +66,8 @@ def showText(txt, parent=None, type="text", run=True, geomKey=None, \ diag.setWindowTitle(title) layout = QVBoxLayout(diag) diag.setLayout(layout) - text = QTextEdit() - text.setReadOnly(True) + text = QTextBrowser() + text.setOpenExternalLinks(True) if type == "text": text.setPlainText(txt) else: