# eric6.WebBrowser.Tools.WebBrowserTools

Module implementing tool functions for the web browser.

### Global Attributes

None

### Classes

None

### Functions

containsSpace | Function to check, if a string contains whitespace characters.
ensureUniqueFilename | Module function to generate an unique file name based on a pattern.
filterCharsFromFilename | Module function to filter illegal characters.
getFileNameFromUrl | Module function to generate a file name based on the given URL.
getWebEngineVersions | Module function to extract the web engine version from the default user agent string.
pixmapFromByteArray | Module function to convert a byte array to a pixmap.
pixmapToByteArray | Module function to convert a pixmap to a byte array containing the pixmap as a PNG encoded as base64.
pixmapToDataUrl | Module function to convert a pixmap to a data: URL.
readAllFileByteContents | Function to read the bytes contents of the given file.
readAllFileContents | Function to read the string contents of the given file.

## containsSpace

containsSpace(string)

Function to check, if a string contains whitespace characters.

string (str)
  string to be checked

Returns:
  flag indicating the presence of at least one whitespace character

Return Type:
  bool

Up

## ensureUniqueFilename

ensureUniqueFilename(name, appendFormat="({0})")

Module function to generate an unique file name based on a pattern.

name
  desired file name (string)
appendFormat
  format pattern to be used to make the unique name (string)

Returns:
  unique file name

Up

## filterCharsFromFilename

filterCharsFromFilename(name)

Module function to filter illegal characters.

name
  name to be sanitized (string)

Returns:
  sanitized name (string)

Up

## getFileNameFromUrl

getFileNameFromUrl(url)

Module function to generate a file name based on the given URL.

url
  URL (QUrl)

Returns:
  file name (string)

Up

## getWebEngineVersions

getWebEngineVersions()

Module function to extract the web engine version from the default user agent string.

Returns:
  tuple containing the Chrome version and the QtWebEngine version

Return Type:
  tuple of str

Up

## pixmapFromByteArray

pixmapFromByteArray(data)

Module function to convert a byte array to a pixmap.

data (bytes or QByteArray)
  data for the pixmap

Returns:
  extracted pixmap

Return Type:
  QPixmap

Up

## pixmapToByteArray

pixmapToByteArray(pixmap)

Module function to convert a pixmap to a byte array containing the pixmap as a PNG encoded as base64.

pixmap (QPixmap)
  pixmap to be converted

Returns:
  byte array containing the pixmap

Return Type:
  QByteArray

Up

## pixmapToDataUrl

pixmapToDataUrl(pixmap)

Module function to convert a pixmap to a data: URL.

pixmap (QPixmap)
  pixmap to be converted

Returns:
  data: URL

Return Type:
  QUrl

Up

## readAllFileByteContents

readAllFileByteContents(filename)

Function to read the bytes contents of the given file.

filename (str)
  name of the file

Returns:
  contents of the file

Return Type:
  str

Up

## readAllFileContents

readAllFileContents(filename)

Function to read the string contents of the given file.

filename (str)
  name of the file

Returns:
  contents of the file

Return Type:
  str

Up