:right-sidebar: True ParamSpec =================================================================== .. currentmodule:: gi.repository.GObject .. class:: ParamSpec(*args, **kwargs) :no-contents-entry: Subclasses: :class:`~gi.repository.GObject.ParamSpecBoolean`, :class:`~gi.repository.GObject.ParamSpecBoxed`, :class:`~gi.repository.GObject.ParamSpecChar`, :class:`~gi.repository.GObject.ParamSpecDouble`, :class:`~gi.repository.GObject.ParamSpecEnum`, :class:`~gi.repository.GObject.ParamSpecFlags`, :class:`~gi.repository.GObject.ParamSpecFloat`, :class:`~gi.repository.GObject.ParamSpecGType`, :class:`~gi.repository.GObject.ParamSpecInt`, :class:`~gi.repository.GObject.ParamSpecInt64`, :class:`~gi.repository.GObject.ParamSpecLong`, :class:`~gi.repository.GObject.ParamSpecObject`, :class:`~gi.repository.GObject.ParamSpecOverride`, :class:`~gi.repository.GObject.ParamSpecParam`, :class:`~gi.repository.GObject.ParamSpecPointer`, :class:`~gi.repository.GObject.ParamSpecString`, :class:`~gi.repository.GObject.ParamSpecUChar`, :class:`~gi.repository.GObject.ParamSpecUInt`, :class:`~gi.repository.GObject.ParamSpecUInt64`, :class:`~gi.repository.GObject.ParamSpecULong`, :class:`~gi.repository.GObject.ParamSpecUnichar`, :class:`~gi.repository.GObject.ParamSpecValueArray`, :class:`~gi.repository.GObject.ParamSpecVariant` :Constructors: :: ParamSpec(**properties) Methods ------- .. rst-class:: interim-class .. class:: ParamSpec :no-index: .. method:: get_blurb() -> str | None Get the short description of a :obj:`~gi.repository.GObject.ParamSpec`. .. method:: get_default_value() -> ~typing.Any Gets the default value of ``pspec`` as a pointer to a :obj:`~gi.repository.GObject.Value`. The :obj:`~gi.repository.GObject.Value` will remain valid for the life of ``pspec``. .. versionadded:: 2.38 .. method:: get_name() -> str Get the name of a :obj:`~gi.repository.GObject.ParamSpec`. The name is always an "interned" string (as per :func:`~gi.repository.GLib.intern_string`). This allows for pointer-value comparisons. .. method:: get_name_quark() -> int Gets the GQuark for the name. .. versionadded:: 2.46 .. method:: get_nick() -> str Get the nickname of a :obj:`~gi.repository.GObject.ParamSpec`. .. method:: get_qdata(quark: int) -> None Gets back user data pointers stored via :func:`~gi.repository.GObject.ParamSpec.set_qdata`. :param quark: a :obj:`~gi.repository.GLib.Quark`, naming the user data pointer .. method:: get_redirect_target() -> ~gi.repository.GObject.ParamSpec | None If the paramspec redirects operations to another paramspec, returns that paramspec. Redirect is used typically for providing a new implementation of a property in a derived type while preserving all the properties from the parent type. Redirection is established by creating a property of type ``GParamSpecOverride``. See :func:`~gi.repository.GObject.ObjectClass.override_property` for an example of the use of this capability. .. versionadded:: 2.4 .. method:: is_valid_name(name: str) -> bool Validate a property name for a :obj:`~gi.repository.GObject.ParamSpec`. This can be useful for dynamically-generated properties which need to be validated at run-time before actually trying to create them. See [canonical parameter names][canonical-parameter-names] for details of the rules for valid names. .. versionadded:: 2.66 :param name: the canonical name of the property .. method:: set_qdata(quark: int, data: None) -> None Sets an opaque, named pointer on a :obj:`~gi.repository.GObject.ParamSpec`. The name is specified through a :obj:`~gi.repository.GLib.Quark` (retrieved e.g. via :func:`~gi.repository.GLib.quark_from_static_string`), and the pointer can be gotten back from the ``pspec`` with :func:`~gi.repository.GObject.ParamSpec.get_qdata`. Setting a previously set user data pointer, overrides (frees) the old pointer set, using :const:`None` as pointer essentially removes the data stored. :param quark: a :obj:`~gi.repository.GLib.Quark`, naming the user data pointer :param data: an opaque user data pointer .. method:: sink() -> None The initial reference count of a newly created :obj:`~gi.repository.GObject.ParamSpec` is 1, even though no one has explicitly called :func:`~gi.repository.GObject.ParamSpec.ref` on it yet. So the initial reference count is flagged as "floating", until someone calls `g_param_spec_ref (pspec); g_param_spec_sink (pspec);` in sequence on it, taking over the initial reference count (thus ending up with a ``pspec`` that has a reference count of 1 still, but is not flagged "floating" anymore). Virtual Methods --------------- .. rst-class:: interim-class .. class:: ParamSpec :no-index: .. method:: do_finalize() -> None The instance finalization function (optional), should chain up to the finalize method of the parent class. .. method:: do_value_is_valid(value: ~typing.Any) -> bool Checks if contents of ``value`` comply with the specifications set out by this type, without modifying the value. This vfunc is optional. If it isn't set, GObject will use ``value_validate``. Since 2.74 :param value: .. method:: do_value_set_default(value: ~typing.Any) -> None Resets a ``value`` to the default value for this type (recommended, the default is :func:`~gi.repository.GObject.Value.reset`), see :func:`~gi.repository.GObject.param_value_set_default`. :param value: .. method:: do_value_validate(value: ~typing.Any) -> bool Ensures that the contents of ``value`` comply with the specifications set out by this type (optional), see :func:`~gi.repository.GObject.param_value_validate`. :param value: .. method:: do_values_cmp(value1: ~typing.Any, value2: ~typing.Any) -> int Compares ``value1`` with ``value2`` according to this type (recommended, the default is memcmp()), see :func:`~gi.repository.GObject.param_values_cmp`. :param value1: :param value2: Fields ------ .. rst-class:: interim-class .. class:: ParamSpec :no-index: .. attribute:: flags ``GParamFlags`` flags for this parameter .. attribute:: g_type_instance Private ``GTypeInstance`` portion .. attribute:: name Name of this parameter: always an interned string .. attribute:: owner_type ``GType`` type that uses (introduces) this parameter .. attribute:: param_id .. attribute:: qdata .. attribute:: ref_count .. attribute:: value_type The ``GValue`` type for this parameter