diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index 4b741a463..cd31deb6c 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -1392,7 +1392,7 @@ by clicking on one on the left.""" d = CardInfoDialog(self) l = QVBoxLayout() l.setContentsMargins(0, 0, 0, 0) - w = AnkiWebView() + w = AnkiWebView(title="browser card info") l.addWidget(w) w.stdHtml(info + "

" + reps) bb = QDialogButtonBox(QDialogButtonBox.Close) @@ -1561,7 +1561,7 @@ where id in %s""" self._previewWindow.silentlyClose = True vbox = QVBoxLayout() vbox.setContentsMargins(0, 0, 0, 0) - self._previewWeb = AnkiWebView() + self._previewWeb = AnkiWebView(title="previewer") vbox.addWidget(self._previewWeb) bbox = QDialogButtonBox() @@ -2158,6 +2158,7 @@ update cards set usn=?, mod=?, did=? where id in """ frm.fields.addItems(fields) self._dupesButton = None # links + frm.webView.title = "find duplicates" frm.webView.set_bridge_command( self.dupeLinkClicked, FindDupesDialog(dialog=d, browser=self) ) diff --git a/qt/aqt/clayout.py b/qt/aqt/clayout.py index 80f0436e8..51e595fe0 100644 --- a/qt/aqt/clayout.py +++ b/qt/aqt/clayout.py @@ -203,9 +203,9 @@ class CardLayout(QDialog): def setupWebviews(self): pform = self.pform - pform.frontWeb = AnkiWebView() + pform.frontWeb = AnkiWebView(title="card layout front") pform.frontPrevBox.addWidget(pform.frontWeb) - pform.backWeb = AnkiWebView() + pform.backWeb = AnkiWebView(title="card layout back") pform.backPrevBox.addWidget(pform.backWeb) jsinc = [ "jquery.js", diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 0a77d4ca1..8ca4c2bf8 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -95,7 +95,6 @@ class Editor: def setupWeb(self) -> None: self.web = EditorWebView(self.widget, self) - self.web.title = "editor" self.web.allowDrops = True self.web.set_bridge_command(self.onBridgeCmd, self) self.outerLayout.addWidget(self.web, 1) @@ -937,7 +936,7 @@ to a cloze type first, via Edit>Change Note Type.""" class EditorWebView(AnkiWebView): def __init__(self, parent, editor): - AnkiWebView.__init__(self) + AnkiWebView.__init__(self, title="editor") self.editor = editor self.strip = self.editor.mw.pm.profile["stripHTML"] self.setAcceptDrops(True) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 1cc8be70b..d33ba1845 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -717,19 +717,16 @@ title="%s" %s>%s""" % ( self.form = aqt.forms.main.Ui_MainWindow() self.form.setupUi(self) # toolbar - tweb = self.toolbarWeb = aqt.webview.AnkiWebView() - tweb.title = "top toolbar" + tweb = self.toolbarWeb = aqt.webview.AnkiWebView(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.title = "main webview" + self.web = aqt.webview.AnkiWebView(title="main webview") self.web.setFocusPolicy(Qt.WheelFocus) self.web.setMinimumWidth(400) # bottom area - sweb = self.bottomWeb = aqt.webview.AnkiWebView() - sweb.title = "bottom toolbar" + sweb = self.bottomWeb = aqt.webview.AnkiWebView(title="bottom toolbar") sweb.setFocusPolicy(Qt.WheelFocus) # add in a layout self.mainLayout = QVBoxLayout() diff --git a/qt/aqt/stats.py b/qt/aqt/stats.py index 8a6a2adf6..a1c493e3f 100644 --- a/qt/aqt/stats.py +++ b/qt/aqt/stats.py @@ -95,6 +95,7 @@ class DeckStats(QDialog): stats = self.mw.col.stats() stats.wholeCollection = self.wholeCollection self.report = stats.report(type=self.period) + self.form.web.title = "deck stats" self.form.web.stdHtml( "" + self.report + "", js=["jquery.js", "plot.js"] ) diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index 8a2df4107..e88ffc309 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -101,9 +101,11 @@ class AnkiWebPage(QWebEnginePage): # type: ignore class AnkiWebView(QWebEngineView): # type: ignore - def __init__(self, parent: Optional[QWidget] = None) -> None: + def __init__( + self, parent: Optional[QWidget] = None, title: str = "default" + ) -> None: QWebEngineView.__init__(self, parent=parent) # type: ignore - self.title = "default" + self.title = title self._page = AnkiWebPage(self._onBridgeCmd) self._page.setBackgroundColor(self._getWindowColor()) # reduce flicker