mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Add an exception that allows add-ons to abort early
This commit is contained in:
parent
b1f4ea562a
commit
fa6a0a1283
1 changed files with 6 additions and 0 deletions
|
@ -46,6 +46,10 @@ from aqt.utils import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AbortAddonImport(Exception):
|
||||||
|
"""Add-ons may raise this exception to abort their import"""
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class InstallOk:
|
class InstallOk:
|
||||||
name: str
|
name: str
|
||||||
|
@ -211,6 +215,8 @@ class AddonManager:
|
||||||
self.dirty = True
|
self.dirty = True
|
||||||
try:
|
try:
|
||||||
__import__(addon.dir_name)
|
__import__(addon.dir_name)
|
||||||
|
except AbortAddonImport:
|
||||||
|
pass
|
||||||
except:
|
except:
|
||||||
showWarning(
|
showWarning(
|
||||||
tr(
|
tr(
|
||||||
|
|
Loading…
Reference in a new issue