mirror of
https://github.com/ankitects/anki.git
synced 2025-12-11 13:56:55 -05:00
Make sure to pass pending imports on to installAddon
also: refactor add-on check
This commit is contained in:
parent
f8df688648
commit
54253e2108
1 changed files with 8 additions and 2 deletions
|
|
@ -334,6 +334,9 @@ close the profile or restart Anki."""
|
||||||
|
|
||||||
# import pending?
|
# import pending?
|
||||||
if self.pendingImport:
|
if self.pendingImport:
|
||||||
|
if self._isAddon(self.pendingImport):
|
||||||
|
self.installAddon(self.pendingImport)
|
||||||
|
else:
|
||||||
self.handleImport(self.pendingImport)
|
self.handleImport(self.pendingImport)
|
||||||
self.pendingImport = None
|
self.pendingImport = None
|
||||||
runHook("profileLoaded")
|
runHook("profileLoaded")
|
||||||
|
|
@ -1482,7 +1485,7 @@ will be lost. Continue?"""
|
||||||
self.app.appMsg.connect(self.onAppMsg)
|
self.app.appMsg.connect(self.onAppMsg)
|
||||||
|
|
||||||
def onAppMsg(self, buf: str) -> Optional[QTimer]:
|
def onAppMsg(self, buf: str) -> Optional[QTimer]:
|
||||||
is_addon = buf.endswith(".ankiaddon")
|
is_addon = self._isAddon(buf)
|
||||||
|
|
||||||
if self.state == "startup":
|
if self.state == "startup":
|
||||||
# try again in a second
|
# try again in a second
|
||||||
|
|
@ -1531,6 +1534,9 @@ Please ensure a profile is open and Anki is not busy, then try again."""
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _isAddon(self, buf: str) -> bool:
|
||||||
|
return buf.endswith(self.addonManager.ext)
|
||||||
|
|
||||||
# GC
|
# GC
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# ensure gc runs in main thread
|
# ensure gc runs in main thread
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue