Home ⌂Doc Index ◂Up ▴

eric6.WebBrowser.WebBrowserPage

Module implementing the helpbrowser using QWebView.

Global Attributes

None

Classes

WebBrowserPage Class implementing an enhanced web page.

Functions

None


WebBrowserPage

Class implementing an enhanced web page.

Signals

navigationRequestAccepted(url, navigation type, main frame)
emitted to signal an accepted navigation request
printPageRequested()
emitted to indicate a print request of the shown web page
safeBrowsingAbort()
emitted to indicate an abort due to a safe browsing event
safeBrowsingBad(threatType, threatMessages)
emitted to indicate a malicious web site as determined by safe browsing

Derived from

QWebEnginePage

Class Attributes

SafeJsWorld
UnsafeJsWorld

Class Methods

setUserAgent Class method to set the global user agent string.
userAgent Class method to get the global user agent setting.
userAgentForUrl Class method to determine the user agent for the given URL.

Methods

WebBrowserPage Constructor
__contentsSizeChanged Private slot to work around QWebEnginePage not scrolling to anchors when opened in a background tab.
__featurePermissionRequested Private slot handling a feature permission request.
__fullScreenRequested Private slot handling a full screen request.
__registerProtocolHandlerRequested Private slot to handle the registration of a custom protocol handler.
__setupChannelTimeout Private slot to initiate the setup of the web channel.
__setupWebChannelForUrl Private method to setup a web channel to our external object.
__urlChanged Private slot to handle changes of the URL.
acceptNavigationRequest Public method to determine, if a request may be accepted.
certificateError Public method to handle SSL certificate errors.
execJavaScript Public method to execute a JavaScript function synchroneously.
execPrintPage Public method to execute a synchronous print.
getSafeBrowsingStatus Public method to get the safe browsing status of the current page.
hitTestContent Public method to test the content at a specified position.
icon Public method to get the web site icon.
isJavaScriptEnabled Public method to test, if JavaScript is enabled.
javaScriptConsoleMessage Public method to show a console message.
mapToViewport Public method to map a position to the viewport.
printCallback
registerProtocolHandlerRequestScheme Public method to get the registered protocol handler request scheme.
registerProtocolHandlerRequestUrl Public method to get the registered protocol handler request URL.
resultCallback
runJavaScript Public method to run a script in the context of the page.
scroll Public method to scroll by the given amount of pixels.
scrollPosition Public method to get the scroll position of the web page.
scrollTo Public method to scroll to the given position.

Static Methods

None

WebBrowserPage.setUserAgent (class method)

setUserAgent(agent)

Class method to set the global user agent string.

agent
new current user agent string (string)

WebBrowserPage.userAgent (class method)

userAgent(resolveEmpty=False)

Class method to get the global user agent setting.

resolveEmpty
flag indicating to resolve an empty user agent (boolean)
Returns:
user agent string (string)

WebBrowserPage.userAgentForUrl (class method)

userAgentForUrl(url)

Class method to determine the user agent for the given URL.

url
URL to determine user agent for (QUrl)
Returns:
user agent string (string)

WebBrowserPage (Constructor)

WebBrowserPage(parent=None)

Constructor

parent
parent widget of this window (QWidget)

WebBrowserPage.__contentsSizeChanged

__contentsSizeChanged(size)

Private slot to work around QWebEnginePage not scrolling to anchors when opened in a background tab.

size (QSize)
changed contents size (unused)

WebBrowserPage.__featurePermissionRequested

__featurePermissionRequested(url, feature)

Private slot handling a feature permission request.

url (QUrl)
url requesting the feature
feature (QWebEnginePage.Feature)
requested feature

WebBrowserPage.__fullScreenRequested

__fullScreenRequested(request)

Private slot handling a full screen request.

request (QWebEngineFullScreenRequest)
reference to the full screen request

WebBrowserPage.__registerProtocolHandlerRequested

__registerProtocolHandlerRequested(request)

Private slot to handle the registration of a custom protocol handler.

request (QWebEngineRegisterProtocolHandlerRequest)
reference to the registration request

WebBrowserPage.__setupChannelTimeout

__setupChannelTimeout()

Private slot to initiate the setup of the web channel.

WebBrowserPage.__setupWebChannelForUrl

__setupWebChannelForUrl(url)

Private method to setup a web channel to our external object.

url (QUrl)
URL for which to setup the web channel

WebBrowserPage.__urlChanged

__urlChanged(url)

Private slot to handle changes of the URL.

url (QUrl)
new URL

WebBrowserPage.acceptNavigationRequest

acceptNavigationRequest(url, type_, isMainFrame)

Public method to determine, if a request may be accepted.

url (QUrl)
URL to navigate to
type_ (QWebEnginePage.NavigationType)
type of the navigation request
isMainFrame (bool)
flag indicating, that the request originated from the main frame
Returns:
flag indicating acceptance
Return Type:
bool

WebBrowserPage.certificateError

certificateError(error)

Public method to handle SSL certificate errors.

error (QWebEngineCertificateError)
object containing the certificate error information
Returns:
flag indicating to ignore this error
Return Type:
bool

WebBrowserPage.execJavaScript

execJavaScript(script, worldId=QWebEngineScript.MainWorld, timeout=500)

Public method to execute a JavaScript function synchroneously.

script (str)
JavaScript script source to be executed
worldId (int)
ID to run the script under
timeout (int)
max. time the script is given to execute
Returns:
result of the script
Return Type:
depending upon script result

WebBrowserPage.execPrintPage

execPrintPage(printer, timeout=1000)

Public method to execute a synchronous print.

printer (QPrinter)
reference to the printer object
timeout (int)
timeout value in milliseconds
Returns:
flag indicating a successful print job
Return Type:
bool

WebBrowserPage.getSafeBrowsingStatus

getSafeBrowsingStatus()

Public method to get the safe browsing status of the current page.

Returns:
flag indicating a safe site
Return Type:
bool

WebBrowserPage.hitTestContent

hitTestContent(pos)

Public method to test the content at a specified position.

pos (QPoint)
position to execute the test at
Returns:
test result object
Return Type:
WebHitTestResult

WebBrowserPage.icon

icon()

Public method to get the web site icon.

Returns:
web site icon
Return Type:
QIcon

WebBrowserPage.isJavaScriptEnabled

isJavaScriptEnabled()

Public method to test, if JavaScript is enabled.

Returns:
flag indicating the state of the JavaScript support
Return Type:
bool

WebBrowserPage.javaScriptConsoleMessage

javaScriptConsoleMessage(level, message, lineNumber, sourceId)

Public method to show a console message.

level (QWebEnginePage.JavaScriptConsoleMessageLevel)
severity
message (str)
message to be shown
lineNumber (int)
line number of an error
sourceId (str)
source URL causing the error

WebBrowserPage.mapToViewport

mapToViewport(pos)

Public method to map a position to the viewport.

pos (QPoint)
position to be mapped
Returns:
viewport position
Return Type:
QPoint

WebBrowserPage.printCallback

printCallback(resDict=resultDict)

WebBrowserPage.registerProtocolHandlerRequestScheme

registerProtocolHandlerRequestScheme()

Public method to get the registered protocol handler request scheme.

Returns:
registered protocol handler request scheme
Return Type:
str

WebBrowserPage.registerProtocolHandlerRequestUrl

registerProtocolHandlerRequestUrl()

Public method to get the registered protocol handler request URL.

Returns:
registered protocol handler request URL
Return Type:
QUrl

WebBrowserPage.resultCallback

resultCallback(resDict=resultDict)

WebBrowserPage.runJavaScript

runJavaScript(script, worldId=-1, callback=None)

Public method to run a script in the context of the page.

script (str)
JavaScript script source to be executed
worldId (int)
ID to run the script under
callback (function)
callback function to be executed when the script has ended

WebBrowserPage.scroll

scroll(x, y)

Public method to scroll by the given amount of pixels.

x (int)
horizontal scroll value
y (int)
vertical scroll value

WebBrowserPage.scrollPosition

scrollPosition()

Public method to get the scroll position of the web page.

Returns:
scroll position
Return Type:
QPointF

WebBrowserPage.scrollTo

scrollTo(pos)

Public method to scroll to the given position.

pos (QPointF)
position to scroll to
Up



Home ⌂Doc Index ◂Up ▴