Skip to content

WebEngineSettings

Base classes

Name Children Inherits
MutableMapping
collections.abc
A MutableMapping is a generic container for associating

⋔ Inheritance diagram

graph TD
  1473574736640["webenginecore.WebEngineSettings"]
  1473222543776["abc.MutableMapping"]
  1473222540848["abc.Mapping"]
  1473222211728["abc.Collection"]
  1473222226368["abc.Sized"]
  140713234304496["builtins.object"]
  1473222223440["abc.Iterable"]
  1473222220512["abc.Container"]
  1473222543776 --> 1473574736640
  1473222540848 --> 1473222543776
  1473222211728 --> 1473222540848
  1473222226368 --> 1473222211728
  140713234304496 --> 1473222226368
  1473222223440 --> 1473222211728
  140713234304496 --> 1473222223440
  1473222220512 --> 1473222211728
  140713234304496 --> 1473222220512

🛈 DocStrings

Bases: MutableMapping

Source code in prettyqt\webenginecore\webenginesettings.py
class WebEngineSettings(MutableMapping):
    def __init__(self, item: QtWebEngineCore.QWebEngineSettings):
        self.item = item

    def __repr__(self):
        return get_repr(self, dict(self))

    def __getattr__(self, val):
        return getattr(self.item, val)

    def __setitem__(self, index: WebAttributeStr, value: bool):
        self.item.setAttribute(WEB_ATTRIBUTES[index], value)

    def __getitem__(self, index: WebAttributeStr) -> bool:
        if index not in WEB_ATTRIBUTES:
            raise KeyError(index)
        return self.item.testAttribute(WEB_ATTRIBUTES[index])

    def __delitem__(self, index: WebAttributeStr):
        return self.item.resetAttribute(WEB_ATTRIBUTES[index])

    def __iter__(self):
        return iter(WEB_ATTRIBUTES.keys())

    def __len__(self):
        return len(WEB_ATTRIBUTES)

    def set_unknown_url_scheme_policy(self, policy: UnknownUrlSchemePolicyStr | pol):
        """Set the unknown url scheme policy.

        Args:
            policy: unknown url scheme policy
        """
        self.item.setUnknownUrlSchemePolicy(
            UNKNOWN_URL_SCHEME_POLICY.get_enum_value(policy)
        )

    def get_unknown_url_scheme_policy(self) -> UnknownUrlSchemePolicyStr:
        """Return current unknown url scheme policy.

        Returns:
            Unknown url scheme policy
        """
        return UNKNOWN_URL_SCHEME_POLICY.inverse[self.item.unknownUrlSchemePolicy()]

    def set_font_family(
        self,
        which: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily,
        family: str,
    ):
        """Set the actual font family to family for the specified generic family, which.

        Args:
            which: family to set
            family: generic family
        """
        self.item.setFontFamily(FONT_FAMILY.get_enum_value(which), family)

    def get_font_family(self, family: FontFamilyStr) -> str:
        """Return the actual font family for the specified generic font family.

        Args:
            family: generic font family

        Returns:
            Font family
        """
        return self.item.fontFamily(FONT_FAMILY[family])

    def set_font_size(
        self, typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize, size: int
    ):
        """Set the font size for type to size in pixels.

        Args:
            typ: font size type
            size: size in pixels
        """
        self.item.setFontSize(FONT_SIZE.get_enum_value(typ), size)

    def get_font_size(self, typ: FontSizeStr) -> int:
        """Return the default font size for type in pixels.

        Args:
            typ: font size type

        Returns:
            Font size
        """
        return self.item.fontSize(FONT_SIZE[typ])

get_font_family(family: FontFamilyStr) -> str

Return the actual font family for the specified generic font family.

Parameters:

Name Type Description Default
family FontFamilyStr

generic font family

required
Source code in prettyqt\webenginecore\webenginesettings.py
def get_font_family(self, family: FontFamilyStr) -> str:
    """Return the actual font family for the specified generic font family.

    Args:
        family: generic font family

    Returns:
        Font family
    """
    return self.item.fontFamily(FONT_FAMILY[family])

get_font_size(typ: FontSizeStr) -> int

Return the default font size for type in pixels.

Parameters:

Name Type Description Default
typ FontSizeStr

font size type

required
Source code in prettyqt\webenginecore\webenginesettings.py
def get_font_size(self, typ: FontSizeStr) -> int:
    """Return the default font size for type in pixels.

    Args:
        typ: font size type

    Returns:
        Font size
    """
    return self.item.fontSize(FONT_SIZE[typ])

get_unknown_url_scheme_policy() -> UnknownUrlSchemePolicyStr

Return current unknown url scheme policy.

Source code in prettyqt\webenginecore\webenginesettings.py
def get_unknown_url_scheme_policy(self) -> UnknownUrlSchemePolicyStr:
    """Return current unknown url scheme policy.

    Returns:
        Unknown url scheme policy
    """
    return UNKNOWN_URL_SCHEME_POLICY.inverse[self.item.unknownUrlSchemePolicy()]

set_font_family(which: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily, family: str)

Set the actual font family to family for the specified generic family, which.

Parameters:

Name Type Description Default
which FontFamilyStr | FontFamily

family to set

required
family str

generic family

required
Source code in prettyqt\webenginecore\webenginesettings.py
def set_font_family(
    self,
    which: FontFamilyStr | QtWebEngineCore.QWebEngineSettings.FontFamily,
    family: str,
):
    """Set the actual font family to family for the specified generic family, which.

    Args:
        which: family to set
        family: generic family
    """
    self.item.setFontFamily(FONT_FAMILY.get_enum_value(which), family)

set_font_size(typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize, size: int)

Set the font size for type to size in pixels.

Parameters:

Name Type Description Default
typ FontSizeStr | FontSize

font size type

required
size int

size in pixels

required
Source code in prettyqt\webenginecore\webenginesettings.py
def set_font_size(
    self, typ: FontSizeStr | QtWebEngineCore.QWebEngineSettings.FontSize, size: int
):
    """Set the font size for type to size in pixels.

    Args:
        typ: font size type
        size: size in pixels
    """
    self.item.setFontSize(FONT_SIZE.get_enum_value(typ), size)

set_unknown_url_scheme_policy(policy: UnknownUrlSchemePolicyStr | pol)

Set the unknown url scheme policy.

Parameters:

Name Type Description Default
policy UnknownUrlSchemePolicyStr | pol

unknown url scheme policy

required
Source code in prettyqt\webenginecore\webenginesettings.py
def set_unknown_url_scheme_policy(self, policy: UnknownUrlSchemePolicyStr | pol):
    """Set the unknown url scheme policy.

    Args:
        policy: unknown url scheme policy
    """
    self.item.setUnknownUrlSchemePolicy(
        UNKNOWN_URL_SCHEME_POLICY.get_enum_value(policy)
    )