diff --git a/ftl/qt/addons.ftl b/ftl/qt/addons.ftl index b592d44cc..a81f7cf02 100644 --- a/ftl/qt/addons.ftl +++ b/ftl/qt/addons.ftl @@ -4,6 +4,10 @@ addons-failed-to-load = When loading '{ $name }': { $traceback } +addons-failed-to-load2 = + The following add-ons failed to load, so they have been disabled: + + { $addons } # Shown in the add-on configuration screen (Tools>Add-ons>Config), in the title bar addons-config-window-title = Configure '{ $name }' addons-config-validation-error = There was a problem with the provided configuration: { $problem }, at path { $path }, against schema { $schema }. diff --git a/qt/aqt/addons.py b/qt/aqt/addons.py index e279869db..f9ebfcf7f 100644 --- a/qt/aqt/addons.py +++ b/qt/aqt/addons.py @@ -229,6 +229,7 @@ class AddonManager: return os.path.join(root, module) def loadAddons(self) -> None: + broken: list[str] = [] for addon in self.all_addon_meta(): if not addon.enabled: continue @@ -240,18 +241,27 @@ class AddonManager: except AbortAddonImport: pass except: - 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, - ) + self.toggleEnabled(addon.dir_name, enable=False) + name = html.escape(addon.human_name()) + page = addon.page() + if page: + broken.append(f"{name}") + else: + broken.append(name) + print(traceback.format_exc()) + + if broken: + addons = "\n\n- " + "\n- ".join(broken) + addons = f"
{addons}
" + error = tr.addons_failed_to_load2( + addons=addons, + ) + txt = f"

{tr.qt_misc_error()}

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