mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04: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 = """
|
||||
body {
|
||||
background: #f3f3f3;
|
||||
margin: 2em;
|
||||
}
|
||||
h1 { margin-bottom: 0.2em; }
|
||||
|
|
|
@ -533,8 +533,6 @@ min-width: 60px; white-space: nowrap;
|
|||
.spacer2 { height: 16px; }
|
||||
#outer {
|
||||
border-top: 1px solid #aaa;
|
||||
background: -webkit-gradient(linear, left top, left bottom,
|
||||
from(#fff), to(#ddd));
|
||||
}
|
||||
#innertable {
|
||||
padding: 3px;
|
||||
|
|
|
@ -29,13 +29,12 @@ class Toolbar:
|
|||
def draw(self):
|
||||
self.web.onBridgeCmd = self._linkHandler
|
||||
self.web.onLoadFinished = self.onLoaded
|
||||
bgcol = QApplication.instance().palette().window().color().name()
|
||||
self.web.stdHtml(self._body % (
|
||||
# may want a context menu here in the future
|
||||
' '*20,
|
||||
self._centerLinks(),
|
||||
self._rightIcons()),
|
||||
self._css % bgcol)
|
||||
self._css)
|
||||
|
||||
# Available links
|
||||
######################################################################
|
||||
|
@ -164,7 +163,6 @@ margin-top: 0;
|
|||
def draw(self, buf):
|
||||
self.web.onBridgeCmd = self._linkHandler
|
||||
self.web.onLoadFinished = self.onLoaded
|
||||
bgcol = QApplication.instance().palette().window().color().name()
|
||||
self.web.stdHtml(
|
||||
self._centerBody % buf,
|
||||
self._css % bgcol)
|
||||
self._css)
|
||||
|
|
|
@ -141,7 +141,7 @@ class AnkiWebView(QWebEngineView):
|
|||
dpi = screen.logicalDpiX()
|
||||
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:
|
||||
buttonspec = "button { 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="""
|
||||
<!doctype html>
|
||||
<html><head><title>%s</title><style>
|
||||
body { zoom: %f; %s }
|
||||
body { zoom: %f; background: %s; %s }
|
||||
%s
|
||||
%s</style>
|
||||
<script>
|
||||
|
@ -190,6 +190,7 @@ document.addEventListener("keydown", function(evt) {
|
|||
<body class="%s">%s</body></html>""" % (
|
||||
self.title,
|
||||
self.zoomFactor(),
|
||||
bgcol or QApplication.instance().palette().window().color().name(),
|
||||
fontspec,
|
||||
buttonspec,
|
||||
css, js or anki.js.jquery+anki.js.browserSel,
|
||||
|
|
Loading…
Reference in a new issue