Adjust for _WebEngineScripts move
This commit is contained in:
parent
7141f9a2be
commit
394d91a11b
@ -812,15 +812,6 @@ class AbstractTab(QWidget):
|
|||||||
self.title_changed.emit(url.toDisplayString())
|
self.title_changed.emit(url.toDisplayString())
|
||||||
self.url_changed.emit(url)
|
self.url_changed.emit(url)
|
||||||
|
|
||||||
url = self.url(requested=True)
|
|
||||||
|
|
||||||
# Ignore blank QUrls to avoid crashes.
|
|
||||||
if not url.isValid():
|
|
||||||
log.webview.debug("Not updating per-domain stylesheets due to the QUrl being blank")
|
|
||||||
return
|
|
||||||
|
|
||||||
self._update_stylesheet(url)
|
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def _on_load_started(self):
|
def _on_load_started(self):
|
||||||
self._progress = 0
|
self._progress = 0
|
||||||
|
@ -790,14 +790,32 @@ class _WebEngineScripts(QObject):
|
|||||||
|
|
||||||
def connect_signals(self):
|
def connect_signals(self):
|
||||||
config.instance.changed.connect(self._on_config_changed)
|
config.instance.changed.connect(self._on_config_changed)
|
||||||
|
self._tab.url_changed.connect(self._update_stylesheet)
|
||||||
|
self._tab.load_finished.connect(self._on_load_finished)
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def _on_config_changed(self, option):
|
def _on_config_changed(self, option):
|
||||||
if option in ['scrolling.bar', 'content.user_stylesheets']:
|
if option in ['scrolling.bar', 'content.user_stylesheets']:
|
||||||
self._init_stylesheet()
|
self._init_stylesheet()
|
||||||
url = self.url(requested=True)
|
url = self._tab.url(requested=True)
|
||||||
self._update_stylesheet(url=url)
|
self._update_stylesheet(url=url)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def _on_url_changed(self):
|
||||||
|
requested_url = self._tab.url(requested=True)
|
||||||
|
|
||||||
|
# Ignore blank QUrls to avoid crashes.
|
||||||
|
if not requested_url.isValid():
|
||||||
|
log.webview.debug("Not updating per-domain stylesheets due to the QUrl being blank")
|
||||||
|
return
|
||||||
|
|
||||||
|
self._update_stylesheet(requested_url)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def _on_load_finished(self):
|
||||||
|
url = self._tab.url(requested=True)
|
||||||
|
self._update_stylesheet(url)
|
||||||
|
|
||||||
def _update_stylesheet(self, url=None):
|
def _update_stylesheet(self, url=None):
|
||||||
"""Update the custom stylesheet in existing tabs."""
|
"""Update the custom stylesheet in existing tabs."""
|
||||||
css = shared.get_user_stylesheet(url=url)
|
css = shared.get_user_stylesheet(url=url)
|
||||||
@ -1226,9 +1244,6 @@ class WebEngineTab(browsertab.AbstractTab):
|
|||||||
# the old icon is still displayed.
|
# the old icon is still displayed.
|
||||||
self.icon_changed.emit(QIcon())
|
self.icon_changed.emit(QIcon())
|
||||||
|
|
||||||
url = self.url(requested=True)
|
|
||||||
self._update_stylesheet(url)
|
|
||||||
|
|
||||||
@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.
|
||||||
|
Loading…
Reference in New Issue
Block a user