Inherits QObject.
|
| __init__ (self, parent=None) |
|
bool | openUrl (self, str target_url, List[str] allowed_schemes) |
|
Helper class used to open URLs from QML.
◆ _urlHasValidScheme()
bool UM.Qt.Bindings.Utilities.UrlUtil._urlHasValidScheme |
( |
| self, |
|
|
str | url, |
|
|
List[str] | input_schemes ) |
|
protected |
Checks if the scheme of the url is in the valid URL schemes and whether it has been allowed. If an invalid
scheme was attempted to be allowed, the function logs a warning. If the url has a disallowed scheme, it logs an
error.
:param url: URL string to be checked
:param input_schemes: A list of the schemes that are allowed to be opened e.g. ['http', 'https']
:return: True if the URL has a scheme that is allowed and valid, False otherwise
◆ openUrl()
bool UM.Qt.Bindings.Utilities.UrlUtil.openUrl |
( |
| self, |
|
|
str | target_url, |
|
|
List[str] | allowed_schemes ) |
Opens the target_url if it has an allowed and valid scheme. This function can be called inside QML files.
:param target_url: The URL string to be opened e.g. 'https://example.org'
:param allowed_schemes: A list of the schemes that are allowed to be opened e.g. ['http', 'https']
:return: True if the URL opens successfully, False if an invalid scheme is used
The documentation for this class was generated from the following file:
- UM/Qt/Bindings/Utilities.py