mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
set bgcol in ankiwebview
This commit is contained in:
parent
7af591cfd7
commit
a3bdd04d42
4 changed files with 5 additions and 9 deletions
|
|
@ -485,7 +485,6 @@ the manual for information on how to restore from an automatic backup."))
|
||||||
|
|
||||||
sharedCSS = """
|
sharedCSS = """
|
||||||
body {
|
body {
|
||||||
background: #f3f3f3;
|
|
||||||
margin: 2em;
|
margin: 2em;
|
||||||
}
|
}
|
||||||
h1 { margin-bottom: 0.2em; }
|
h1 { margin-bottom: 0.2em; }
|
||||||
|
|
|
||||||
|
|
@ -533,8 +533,6 @@ min-width: 60px; white-space: nowrap;
|
||||||
.spacer2 { height: 16px; }
|
.spacer2 { height: 16px; }
|
||||||
#outer {
|
#outer {
|
||||||
border-top: 1px solid #aaa;
|
border-top: 1px solid #aaa;
|
||||||
background: -webkit-gradient(linear, left top, left bottom,
|
|
||||||
from(#fff), to(#ddd));
|
|
||||||
}
|
}
|
||||||
#innertable {
|
#innertable {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,12 @@ class Toolbar:
|
||||||
def draw(self):
|
def draw(self):
|
||||||
self.web.onBridgeCmd = self._linkHandler
|
self.web.onBridgeCmd = self._linkHandler
|
||||||
self.web.onLoadFinished = self.onLoaded
|
self.web.onLoadFinished = self.onLoaded
|
||||||
bgcol = QApplication.instance().palette().window().color().name()
|
|
||||||
self.web.stdHtml(self._body % (
|
self.web.stdHtml(self._body % (
|
||||||
# may want a context menu here in the future
|
# may want a context menu here in the future
|
||||||
' '*20,
|
' '*20,
|
||||||
self._centerLinks(),
|
self._centerLinks(),
|
||||||
self._rightIcons()),
|
self._rightIcons()),
|
||||||
self._css % bgcol)
|
self._css)
|
||||||
|
|
||||||
# Available links
|
# Available links
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
@ -164,7 +163,6 @@ margin-top: 0;
|
||||||
def draw(self, buf):
|
def draw(self, buf):
|
||||||
self.web.onBridgeCmd = self._linkHandler
|
self.web.onBridgeCmd = self._linkHandler
|
||||||
self.web.onLoadFinished = self.onLoaded
|
self.web.onLoadFinished = self.onLoaded
|
||||||
bgcol = QApplication.instance().palette().window().color().name()
|
|
||||||
self.web.stdHtml(
|
self.web.stdHtml(
|
||||||
self._centerBody % buf,
|
self._centerBody % buf,
|
||||||
self._css % bgcol)
|
self._css)
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ class AnkiWebView(QWebEngineView):
|
||||||
dpi = screen.logicalDpiX()
|
dpi = screen.logicalDpiX()
|
||||||
return max(1, dpi / 96.0)
|
return max(1, dpi / 96.0)
|
||||||
|
|
||||||
def stdHtml(self, body, css="", bodyClass="", js=None, head=""):
|
def stdHtml(self, body, css="", bodyClass="", js=None, head="", bgcol=None):
|
||||||
if isWin:
|
if isWin:
|
||||||
buttonspec = "button { font-size: 12px; font-family:'Segoe UI'; }"
|
buttonspec = "button { font-size: 12px; font-family:'Segoe UI'; }"
|
||||||
fontspec = 'font-size:12px;font-family:"Segoe UI";'
|
fontspec = 'font-size:12px;font-family:"Segoe UI";'
|
||||||
|
|
@ -161,7 +161,7 @@ border-radius:5px; font-family: Helvetica }"""
|
||||||
html="""
|
html="""
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html><head><title>%s</title><style>
|
<html><head><title>%s</title><style>
|
||||||
body { zoom: %f; %s }
|
body { zoom: %f; background: %s; %s }
|
||||||
%s
|
%s
|
||||||
%s</style>
|
%s</style>
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -190,6 +190,7 @@ document.addEventListener("keydown", function(evt) {
|
||||||
<body class="%s">%s</body></html>""" % (
|
<body class="%s">%s</body></html>""" % (
|
||||||
self.title,
|
self.title,
|
||||||
self.zoomFactor(),
|
self.zoomFactor(),
|
||||||
|
bgcol or QApplication.instance().palette().window().color().name(),
|
||||||
fontspec,
|
fontspec,
|
||||||
buttonspec,
|
buttonspec,
|
||||||
css, js or anki.js.jquery+anki.js.browserSel,
|
css, js or anki.js.jquery+anki.js.browserSel,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue