Clean up predicted_navigation handling
This also adds some more logging for #3718
This commit is contained in:
parent
1d25b212d5
commit
5dbda3016b
@ -665,8 +665,7 @@ class AbstractTab(QWidget):
|
|||||||
objreg.register('hintmanager', hintmanager, scope='tab',
|
objreg.register('hintmanager', hintmanager, scope='tab',
|
||||||
window=self.win_id, tab=self.tab_id)
|
window=self.win_id, tab=self.tab_id)
|
||||||
|
|
||||||
self.predicted_navigation.connect(
|
self.predicted_navigation.connect(self._on_predicted_navigation)
|
||||||
lambda url: self.title_changed.emit(url.toDisplayString()))
|
|
||||||
|
|
||||||
def _set_widget(self, widget):
|
def _set_widget(self, widget):
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
@ -715,6 +714,14 @@ class AbstractTab(QWidget):
|
|||||||
evt.posted = True
|
evt.posted = True
|
||||||
QApplication.postEvent(recipient, evt)
|
QApplication.postEvent(recipient, evt)
|
||||||
|
|
||||||
|
@pyqtSlot(QUrl)
|
||||||
|
def _on_predicted_navigation(self, url):
|
||||||
|
"""Adjust the title if we are going to visit an URL soon."""
|
||||||
|
qtutils.ensure_valid(url)
|
||||||
|
url_string = url.toDisplayString()
|
||||||
|
log.webview.debug("Predicted navigation: {}".format(url_string))
|
||||||
|
self.title_changed.emit(url_string)
|
||||||
|
|
||||||
@pyqtSlot(QUrl)
|
@pyqtSlot(QUrl)
|
||||||
def _on_url_changed(self, url):
|
def _on_url_changed(self, url):
|
||||||
"""Update title when URL has changed and no title is available."""
|
"""Update title when URL has changed and no title is available."""
|
||||||
|
@ -930,7 +930,7 @@ class WebEngineTab(browsertab.AbstractTab):
|
|||||||
@pyqtSlot(QUrl)
|
@pyqtSlot(QUrl)
|
||||||
def _on_predicted_navigation(self, url):
|
def _on_predicted_navigation(self, url):
|
||||||
"""If we know we're going to visit an URL soon, change the settings."""
|
"""If we know we're going to visit an URL soon, change the settings."""
|
||||||
qtutils.ensure_valid(url)
|
super()._on_predicted_navigation(url)
|
||||||
self.settings.update_for_url(url)
|
self.settings.update_for_url(url)
|
||||||
|
|
||||||
@pyqtSlot(usertypes.NavigationRequest)
|
@pyqtSlot(usertypes.NavigationRequest)
|
||||||
|
Loading…
Reference in New Issue
Block a user