mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
don't require collection for top toolbar
This is a hack, and ideally the code would be refactored so that the entire main window is not loaded until a collection is available, but doing that will break a bunch of add-ons. Fixes https://anki.tenderapp.com/discussions/beta-testing/1276-anki-215-beta#comment_46241878
This commit is contained in:
parent
7d62b186f8
commit
b0091053bf
2 changed files with 7 additions and 1 deletions
|
@ -18,6 +18,7 @@ class Toolbar:
|
|||
"sync": self._syncLinkHandler,
|
||||
}
|
||||
self.web.setFixedHeight(30)
|
||||
self.web.requiresCol = False
|
||||
|
||||
def draw(self):
|
||||
self.web.onBridgeCmd = self._linkHandler
|
||||
|
|
|
@ -91,6 +91,7 @@ class AnkiWebView(QWebEngineView):
|
|||
|
||||
self._domDone = True
|
||||
self._pendingActions = []
|
||||
self.requiresCol = True
|
||||
self.setPage(self._page)
|
||||
|
||||
self._page.profile().setHttpCacheType(QWebEngineProfile.NoCache)
|
||||
|
@ -319,7 +320,11 @@ body {{ zoom: {}; {} }}
|
|||
# async web events may be received after the profile has been closed
|
||||
# or the underlying webview has been deleted
|
||||
from aqt import mw
|
||||
return not mw.col or sip.isdeleted(self)
|
||||
if sip.isdeleted(self):
|
||||
return True
|
||||
if not mw.col and self.requiresCol:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _onBridgeCmd(self, cmd):
|
||||
if self._shouldIgnoreWebEvent():
|
||||
|
|
Loading…
Reference in a new issue