diff --git a/qt/aqt/errors.py b/qt/aqt/errors.py index 5b1655fd3..b40dd18ff 100644 --- a/qt/aqt/errors.py +++ b/qt/aqt/errors.py @@ -6,10 +6,12 @@ import re import sys import traceback +from markdown import markdown + from anki.lang import _ from aqt import mw from aqt.qt import * -from aqt.utils import showText, showWarning, supportText +from aqt.utils import FString, showText, showWarning, supportText, tr if not os.environ.get("DEBUG"): @@ -80,8 +82,6 @@ your system's temporary folder may be incorrect.""" "Your firewall or antivirus program is preventing Anki from creating a connection to itself. Please add an exception for Anki." ) ) - if "Pyaudio not" in error: - return showWarning(_("Please install PyAudio")) if "install mplayer" in error: return showWarning( _( @@ -106,62 +106,14 @@ your system's temporary folder may be incorrect.""" ) ) if "disk I/O error" in error: - return showWarning( - _( - """\ -An error occurred while accessing the database. + showWarning(markdown(tr(FString.ERRORS_ACCESSING_DB))) + return -Possible causes: - -- Antivirus, firewall, backup, or synchronization software may be \ - interfering with Anki. Try disabling such software and see if the \ - problem goes away. -- Your disk may be full. -- The Documents/Anki folder may be on a network drive. -- Files in the Documents/Anki folder may not be writeable. -- Your hard disk may have errors. - -It's a good idea to run Tools>Check Database to ensure your collection \ -is not corrupt. -""" - ) - ) - - stdText = _( - """\ -
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 = _( - """\ -An error occurred. Please start Anki while holding down the shift \ -key, which will temporarily disable the add-ons you have installed.
- -If the issue only occurs when add-ons are enabled, please use the \ -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 + txt = markdown(tr(FString.ERRORS_ADDONS_ACTIVE_POPUP)) error = supportText() + self._addonText(error) + "\n" + error else: - txt = stdText + txt = markdown(tr(FString.ERRORS_STANDARD_POPUP)) error = supportText() + "\n" + error # show dialog diff --git a/qt/ftl/errors.ftl b/qt/ftl/errors.ftl new file mode 100644 index 000000000..86316d3d0 --- /dev/null +++ b/qt/ftl/errors.ftl @@ -0,0 +1,39 @@ +-errors-support-site = [support site](https://help.ankiweb.net) +errors-standard-popup = + # 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 { -errors-support-site }. + Please copy and paste the information below into your report. +-errors-addon-support-site = [add-on support site](https://help.ankiweb.net/discussions/add-ons/) +errors-addons-active-popup = + # 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 issue only occurs when add-ons are enabled, please use the + 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 { -errors-addon-support-site }. + + Debug info: +errors-accessing-db = + An error occurred while accessing the database. + + Possible causes: + + - Antivirus, firewall, backup, or synchronization software may be + interfering with Anki. Try disabling such software and see if the + problem goes away. + - Your disk may be full. + - The Documents/Anki folder may be on a network drive. + - Files in the Documents/Anki folder may not be writeable. + - Your hard disk may have errors. + + It's a good idea to run Tools>Check Database to ensure your collection is not corrupt. +