mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
add titles to various webviews to make them easy to locate
This commit is contained in:
parent
0990fbb208
commit
258a10edc7
3 changed files with 8 additions and 6 deletions
|
@ -344,6 +344,7 @@ class Editor(object):
|
||||||
|
|
||||||
def setupWeb(self):
|
def setupWeb(self):
|
||||||
self.web = EditorWebView(self.widget, self)
|
self.web = EditorWebView(self.widget, self)
|
||||||
|
self.web.title = "editor"
|
||||||
self.web.allowDrops = True
|
self.web.allowDrops = True
|
||||||
self.web.onBridgeCmd = self.onBridgeCmd
|
self.web.onBridgeCmd = self.onBridgeCmd
|
||||||
self.outerLayout.addWidget(self.web, 1)
|
self.outerLayout.addWidget(self.web, 1)
|
||||||
|
|
|
@ -501,18 +501,18 @@ title="%s" %s>%s</button>''' % (
|
||||||
self.form.setupUi(self)
|
self.form.setupUi(self)
|
||||||
# toolbar
|
# toolbar
|
||||||
tweb = aqt.webview.AnkiWebView()
|
tweb = aqt.webview.AnkiWebView()
|
||||||
tweb.setObjectName("toolbarWeb")
|
tweb.title = "top toolbar"
|
||||||
tweb.setFocusPolicy(Qt.WheelFocus)
|
tweb.setFocusPolicy(Qt.WheelFocus)
|
||||||
self.toolbar = aqt.toolbar.Toolbar(self, tweb)
|
self.toolbar = aqt.toolbar.Toolbar(self, tweb)
|
||||||
self.toolbar.draw()
|
self.toolbar.draw()
|
||||||
# main area
|
# main area
|
||||||
self.web = aqt.webview.AnkiWebView()
|
self.web = aqt.webview.AnkiWebView()
|
||||||
self.web.setObjectName("mainText")
|
self.web.title = "main webview"
|
||||||
self.web.setFocusPolicy(Qt.WheelFocus)
|
self.web.setFocusPolicy(Qt.WheelFocus)
|
||||||
self.web.setMinimumWidth(400)
|
self.web.setMinimumWidth(400)
|
||||||
# bottom area
|
# bottom area
|
||||||
sweb = self.bottomWeb = aqt.webview.AnkiWebView()
|
sweb = self.bottomWeb = aqt.webview.AnkiWebView()
|
||||||
sweb.setObjectName("bottomWeb")
|
sweb.title = "bottom toolbar"
|
||||||
sweb.setFocusPolicy(Qt.WheelFocus)
|
sweb.setFocusPolicy(Qt.WheelFocus)
|
||||||
# add in a layout
|
# add in a layout
|
||||||
self.mainLayout = QVBoxLayout()
|
self.mainLayout = QVBoxLayout()
|
||||||
|
|
|
@ -69,7 +69,7 @@ class AnkiWebView(QWebEngineView):
|
||||||
|
|
||||||
def __init__(self, canFocus=True):
|
def __init__(self, canFocus=True):
|
||||||
QWebEngineView.__init__(self)
|
QWebEngineView.__init__(self)
|
||||||
self.setObjectName("mainText")
|
self.title = "default"
|
||||||
self._page = AnkiWebPage(self._onBridgeCmd)
|
self._page = AnkiWebPage(self._onBridgeCmd)
|
||||||
|
|
||||||
self._loadFinishedCB = None
|
self._loadFinishedCB = None
|
||||||
|
@ -142,7 +142,7 @@ class AnkiWebView(QWebEngineView):
|
||||||
def stdHtml(self, body, css="", bodyClass="", js=None, head=""):
|
def stdHtml(self, body, css="", bodyClass="", js=None, head=""):
|
||||||
self.setHtml("""
|
self.setHtml("""
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html><head><style>
|
<html><head><title>%s</title><style>
|
||||||
body { zoom: %f; }
|
body { zoom: %f; }
|
||||||
%s</style>
|
%s</style>
|
||||||
<script>
|
<script>
|
||||||
|
@ -152,7 +152,8 @@ body { zoom: %f; }
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="%s">%s</body></html>""" % (
|
<body class="%s">%s</body></html>""" % (
|
||||||
self.zoomFactor(), css, js or anki.js.jquery+anki.js.browserSel,
|
self.title,
|
||||||
|
self.zoomFactor(), css, js or anki.js.jquery+anki.js.browserSel,
|
||||||
head, bodyClass, body))
|
head, bodyClass, body))
|
||||||
|
|
||||||
def setCanFocus(self, canFocus=False):
|
def setCanFocus(self, canFocus=False):
|
||||||
|
|
Loading…
Reference in a new issue