add titles to various webviews to make them easy to locate

This commit is contained in:
Damien Elmes 2016-07-07 17:23:13 +10:00
parent 0990fbb208
commit 258a10edc7
3 changed files with 8 additions and 6 deletions

View file

@ -344,6 +344,7 @@ class Editor(object):
def setupWeb(self):
self.web = EditorWebView(self.widget, self)
self.web.title = "editor"
self.web.allowDrops = True
self.web.onBridgeCmd = self.onBridgeCmd
self.outerLayout.addWidget(self.web, 1)

View file

@ -501,18 +501,18 @@ title="%s" %s>%s</button>''' % (
self.form.setupUi(self)
# toolbar
tweb = aqt.webview.AnkiWebView()
tweb.setObjectName("toolbarWeb")
tweb.title = "top toolbar"
tweb.setFocusPolicy(Qt.WheelFocus)
self.toolbar = aqt.toolbar.Toolbar(self, tweb)
self.toolbar.draw()
# main area
self.web = aqt.webview.AnkiWebView()
self.web.setObjectName("mainText")
self.web.title = "main webview"
self.web.setFocusPolicy(Qt.WheelFocus)
self.web.setMinimumWidth(400)
# bottom area
sweb = self.bottomWeb = aqt.webview.AnkiWebView()
sweb.setObjectName("bottomWeb")
sweb.title = "bottom toolbar"
sweb.setFocusPolicy(Qt.WheelFocus)
# add in a layout
self.mainLayout = QVBoxLayout()

View file

@ -69,7 +69,7 @@ class AnkiWebView(QWebEngineView):
def __init__(self, canFocus=True):
QWebEngineView.__init__(self)
self.setObjectName("mainText")
self.title = "default"
self._page = AnkiWebPage(self._onBridgeCmd)
self._loadFinishedCB = None
@ -142,7 +142,7 @@ class AnkiWebView(QWebEngineView):
def stdHtml(self, body, css="", bodyClass="", js=None, head=""):
self.setHtml("""
<!doctype html>
<html><head><style>
<html><head><title>%s</title><style>
body { zoom: %f; }
%s</style>
<script>
@ -152,6 +152,7 @@ body { zoom: %f; }
</head>
<body class="%s">%s</body></html>""" % (
self.title,
self.zoomFactor(), css, js or anki.js.jquery+anki.js.browserSel,
head, bodyClass, body))