: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` ``GParamSpec`` encapsulates the metadata required to specify parameters, such as ``GObject`` properties. Parameter names -------------------------------------------------------------------------------- A property name consists of one or more segments consisting of ASCII letters and digits, separated by either the ``-`` or ``_`` character. The first character of a property name must be a letter. These are the same rules as for signal naming (see :obj:`~gi.repository.GObject.signal_new`\). When creating and looking up a ``GParamSpec``\, either separator can be used, but they cannot be mixed. Using ``-`` is considerably more efficient, and is the ‘canonical form’. Using ``_`` is discouraged. Methods ------- .. rst-class:: interim-class .. class:: ParamSpec :no-index: .. method:: do_finalize(self) -> None .. method:: do_get_property(pspec) :param pspec: .. method:: do_set_property(pspec, value) :param pspec: :param value: .. method:: do_value_is_valid(self, value: ~gi.repository.GObject.Value) -> bool :param value: .. method:: do_value_set_default(self, value: ~gi.repository.GObject.Value) -> None :param value: .. method:: do_value_validate(self, value: ~gi.repository.GObject.Value) -> bool :param value: .. method:: do_values_cmp(self, value1: ~gi.repository.GObject.Value, value2: ~gi.repository.GObject.Value) -> int :param value1: :param value2: .. method:: get_blurb() -> str | None Get the short description of a :obj:`~gi.repository.GObject.ParamSpec`\. .. method:: get_default_value() -> ~gi.repository.GObject.Value 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) -> ~typing.Any | 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.overrides.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 .. classmethod:: is_valid_name() -> 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]:obj:`~gi.repository.GObject.ParamSpec#parameter-names` for details of the rules for valid names. .. versionadded:: 2.66 .. method:: set_qdata(quark: int, data: ~typing.Any = 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 type of the None singleton. .. method:: do_value_is_valid(value: ~gi.repository.GObject.Value) -> bool The type of the None singleton. :param value: .. method:: do_value_set_default(value: ~gi.repository.GObject.Value) -> None The type of the None singleton. :param value: .. method:: do_value_validate(value: ~gi.repository.GObject.Value) -> bool The type of the None singleton. :param value: .. method:: do_values_cmp(value1: ~gi.repository.GObject.Value, value2: ~gi.repository.GObject.Value) -> int The type of the None singleton. :param value1: :param value2: Fields ------ .. rst-class:: interim-class .. class:: ParamSpec :no-index: .. attribute:: blurb .. 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:: nick .. 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