This commit is contained in:
Florian Bruhin 2018-11-30 08:55:15 +01:00
parent 5199681b41
commit e184ace8cb
4 changed files with 12 additions and 9 deletions

View File

@ -685,7 +685,7 @@ class AbstractElements:
def find_css(self, selector: str, def find_css(self, selector: str,
callback: _MultiCallback, callback: _MultiCallback,
error_callback: _ErrorCallback, *, error_cb: _ErrorCallback, *,
only_visible: bool = False) -> None: only_visible: bool = False) -> None:
"""Find all HTML elements matching a given selector async. """Find all HTML elements matching a given selector async.
@ -694,6 +694,7 @@ class AbstractElements:
Args: Args:
callback: The callback to be called when the search finished. callback: The callback to be called when the search finished.
error_cb: The callback to be called when an error occurred.
selector: The CSS selector to search for. selector: The CSS selector to search for.
only_visible: Only show elements which are visible on screen. only_visible: Only show elements which are visible on screen.
""" """

View File

@ -24,8 +24,8 @@ import functools
import re import re
import html as html_utils import html as html_utils
from PyQt5.QtCore import (pyqtSignal, pyqtSlot, Qt, QEvent, QPoint, QPointF, from PyQt5.QtCore import (pyqtSignal, pyqtSlot, Qt, QPoint, QPointF, QUrl,
QUrl, QTimer, QObject) QTimer, QObject)
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
from PyQt5.QtNetwork import QAuthenticator from PyQt5.QtNetwork import QAuthenticator
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
@ -520,6 +520,8 @@ class WebEngineScroller(browsertab.AbstractScroller):
class WebEngineHistoryPrivate(browsertab.AbstractHistoryPrivate): class WebEngineHistoryPrivate(browsertab.AbstractHistoryPrivate):
"""History-related methods which are not part of the extension API."""
def serialize(self): def serialize(self):
if not qtutils.version_check('5.9', compiled=False): if not qtutils.version_check('5.9', compiled=False):
# WORKAROUND for # WORKAROUND for

View File

@ -23,8 +23,7 @@ import re
import functools import functools
import xml.etree.ElementTree import xml.etree.ElementTree
from PyQt5.QtCore import (pyqtSlot, Qt, QEvent, QUrl, QPoint, QTimer, QSizeF, from PyQt5.QtCore import pyqtSlot, Qt, QUrl, QPoint, QTimer, QSizeF, QSize
QSize)
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
from PyQt5.QtWebKitWidgets import QWebPage, QWebFrame from PyQt5.QtWebKitWidgets import QWebPage, QWebFrame
from PyQt5.QtWebKit import QWebSettings from PyQt5.QtWebKit import QWebSettings
@ -511,6 +510,8 @@ class WebKitScroller(browsertab.AbstractScroller):
class WebKitHistoryPrivate(browsertab.AbstractHistoryPrivate): class WebKitHistoryPrivate(browsertab.AbstractHistoryPrivate):
"""History-related methods which are not part of the extension API."""
def serialize(self): def serialize(self):
return qtutils.serialize(self._history) return qtutils.serialize(self._history)
@ -600,8 +601,7 @@ class WebKitElements(browsertab.AbstractElements):
# Escape non-alphanumeric characters in the selector # Escape non-alphanumeric characters in the selector
# https://www.w3.org/TR/CSS2/syndata.html#value-def-identifier # https://www.w3.org/TR/CSS2/syndata.html#value-def-identifier
elem_id = re.sub(r'[^a-zA-Z0-9_-]', r'\\\g<0>', elem_id) elem_id = re.sub(r'[^a-zA-Z0-9_-]', r'\\\g<0>', elem_id)
self.find_css('#' + elem_id, find_id_cb, self.find_css('#' + elem_id, find_id_cb, error_cb=lambda exc: None)
error_callback=lambda exc: None)
def find_focused(self, callback): def find_focused(self, callback):
frame = self._widget.page().currentFrame() frame = self._widget.page().currentFrame()
@ -727,7 +727,7 @@ class WebKitTab(browsertab.AbstractTab):
url, emit_before_load_started=emit_before_load_started) url, emit_before_load_started=emit_before_load_started)
self._widget.load(url) self._widget.load(url)
def url(self, requested=False): def url(self, *, requested=False):
frame = self._widget.page().mainFrame() frame = self._widget.page().mainFrame()
if requested: if requested:
return frame.requestedUrl() return frame.requestedUrl()

View File

@ -923,7 +923,7 @@ class IgnoreCase(MappingType):
('always', "Search case-insensitively."), ('always', "Search case-insensitively."),
('never', "Search case-sensitively."), ('never', "Search case-sensitively."),
('smart', ("Search case-sensitively if there are capital " ('smart', ("Search case-sensitively if there are capital "
"characters.")))), "characters."))))
MAPPING = { MAPPING = {
'always': usertypes.IgnoreCase.always, 'always': usertypes.IgnoreCase.always,