mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
start webview as transparent to reduce flicker
This commit is contained in:
parent
7d86984a12
commit
59f877737e
1 changed files with 5 additions and 4 deletions
|
@ -18,6 +18,7 @@ class AnkiWebPage(QWebEnginePage):
|
||||||
QWebEnginePage.__init__(self)
|
QWebEnginePage.__init__(self)
|
||||||
self._onBridgeCmd = onBridgeCmd
|
self._onBridgeCmd = onBridgeCmd
|
||||||
self._setupBridge()
|
self._setupBridge()
|
||||||
|
self.setBackgroundColor(Qt.transparent)
|
||||||
|
|
||||||
def _setupBridge(self):
|
def _setupBridge(self):
|
||||||
class Bridge(QObject):
|
class Bridge(QObject):
|
||||||
|
@ -75,8 +76,6 @@ class AnkiWebView(QWebEngineView):
|
||||||
self._loadFinishedCB = None
|
self._loadFinishedCB = None
|
||||||
self.setPage(self._page)
|
self.setPage(self._page)
|
||||||
|
|
||||||
self.keyEventDelegate = None
|
|
||||||
|
|
||||||
self._page.profile().setHttpCacheType(QWebEngineProfile.NoCache)
|
self._page.profile().setHttpCacheType(QWebEngineProfile.NoCache)
|
||||||
self.resetHandlers()
|
self.resetHandlers()
|
||||||
self.allowDrops = False
|
self.allowDrops = False
|
||||||
|
@ -159,7 +158,7 @@ border-radius:5px; font-family: Helvetica }"""
|
||||||
fontspec = 'font-size:14px;font-family:%s;'%\
|
fontspec = 'font-size:14px;font-family:%s;'%\
|
||||||
family
|
family
|
||||||
|
|
||||||
self.setHtml("""
|
html="""
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html><head><title>%s</title><style>
|
<html><head><title>%s</title><style>
|
||||||
body { zoom: %f; %s }
|
body { zoom: %f; %s }
|
||||||
|
@ -194,7 +193,9 @@ document.addEventListener("keydown", function(evt) {
|
||||||
fontspec,
|
fontspec,
|
||||||
buttonspec,
|
buttonspec,
|
||||||
css, js or anki.js.jquery+anki.js.browserSel,
|
css, js or anki.js.jquery+anki.js.browserSel,
|
||||||
head, bodyClass, body))
|
head, bodyClass, body)
|
||||||
|
#print(html)
|
||||||
|
self.setHtml(html)
|
||||||
|
|
||||||
def eval(self, js):
|
def eval(self, js):
|
||||||
self.page().runJavaScript(js)
|
self.page().runJavaScript(js)
|
||||||
|
|
Loading…
Reference in a new issue