Skip to content

WebEnginePermission

Base classes

Name Children Inherits
QWebEnginePermission
PySide6.QtWebEngineCore
QWebEnginePermission(self, other: PySide6.QtWebEngineCore.QWebEnginePermission, /, *, origin: PySide6.QtCore.QUrl | None \= None, permissionType: PySide6.QtWebEngineCore.QWebEnginePermission.PermissionType | None \= None, state: PySide6.QtWebEngineCore.QWebEnginePermission.State | None \= None, isValid: bool | None \= None) -> None

⋔ Inheritance diagram

graph TD
  3961561783["webenginecore.WebEnginePermission"]
  32049791["QtWebEngineCore.QWebEnginePermission"]
  37984305["Shiboken.Object"]
  2751680898["builtins.object"]
  32049791 --> 3961561783
  37984305 --> 32049791
  2751680898 --> 37984305

🛈 DocStrings

Bases: QWebEnginePermission

Represents a permission request or stored permission for a web origin.

Source code in prettyqt/webenginecore/webenginepermission.py
class WebEnginePermission(QtWebEngineCore.QWebEnginePermission):
    """Represents a permission request or stored permission for a web origin."""

    def __repr__(self):
        return get_repr(
            self,
            self.get_origin(),
            self.get_permission_type(),
            self.get_state(),
        )

    def __bool__(self):
        return self.isValid()

    def get_origin(self) -> core.Url:
        """Return the origin URL associated with this permission."""
        return core.Url(self.origin())

    def get_permission_type(self) -> PermissionTypeStr:
        """Return the permission type."""
        return PERMISSION_TYPE.inverse[self.permissionType()]

    def get_state(self) -> StateStr:
        """Return the current permission state."""
        return STATE.inverse[self.state()]

    @classmethod
    def is_persistent(
        cls, permission_type: PermissionTypeStr | mod.PermissionType
    ) -> bool:
        """Return whether the given permission type is persistent."""
        return cls.isPersistent(PERMISSION_TYPE.get_enum_value(permission_type))

get_origin() -> core.Url

Return the origin URL associated with this permission.

Source code in prettyqt/webenginecore/webenginepermission.py
def get_origin(self) -> core.Url:
    """Return the origin URL associated with this permission."""
    return core.Url(self.origin())

get_permission_type() -> PermissionTypeStr

Return the permission type.

Source code in prettyqt/webenginecore/webenginepermission.py
def get_permission_type(self) -> PermissionTypeStr:
    """Return the permission type."""
    return PERMISSION_TYPE.inverse[self.permissionType()]

get_state() -> StateStr

Return the current permission state.

Source code in prettyqt/webenginecore/webenginepermission.py
def get_state(self) -> StateStr:
    """Return the current permission state."""
    return STATE.inverse[self.state()]

is_persistent(permission_type: PermissionTypeStr | mod.PermissionType) -> bool classmethod

Return whether the given permission type is persistent.

Source code in prettyqt/webenginecore/webenginepermission.py
@classmethod
def is_persistent(
    cls, permission_type: PermissionTypeStr | mod.PermissionType
) -> bool:
    """Return whether the given permission type is persistent."""
    return cls.isPersistent(PERMISSION_TYPE.get_enum_value(permission_type))

:fa-brands-github: Show source on GitHub