GObject.ParamSpec¶
- Subclasses:
GObject.ParamSpecBoolean
,GObject.ParamSpecBoxed
,GObject.ParamSpecChar
,GObject.ParamSpecDouble
,GObject.ParamSpecEnum
,GObject.ParamSpecFlags
,GObject.ParamSpecFloat
,GObject.ParamSpecGType
,GObject.ParamSpecInt
,GObject.ParamSpecInt64
,GObject.ParamSpecLong
,GObject.ParamSpecObject
,GObject.ParamSpecOverride
,GObject.ParamSpecParam
,GObject.ParamSpecPointer
,GObject.ParamSpecString
,GObject.ParamSpecUChar
,GObject.ParamSpecUInt
,GObject.ParamSpecUInt64
,GObject.ParamSpecULong
,GObject.ParamSpecUnichar
,GObject.ParamSpecValueArray
,GObject.ParamSpecVariant
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
|
|
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
flags |
r |
|
|
g_type_instance |
r |
private |
|
name |
r |
name of this parameter: always an interned string |
|
owner_type |
r |
|
|
param_id |
r |
||
qdata |
r |
||
ref_count |
r |
||
value_type |
r |
the |
Class Details¶
- class GObject.ParamSpec¶
- Abstract:
Yes
- Structure:
GParamSpec
encapsulates the metadata required to specify parameters, such asGObject
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 [func`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.- classmethod is_valid_name(name)[source]¶
- Parameters:
name (
str
) – the canonical name of the property- Returns:
- Return type:
Validate a property name for a
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 for details of the rules for valid names.
New in version 2.66.
- get_blurb()[source]¶
-
Get the short description of a
GObject.ParamSpec
.
- get_default_value()[source]¶
- Returns:
a pointer to a
GObject.Value
which must not be modified- Return type:
Gets the default value of self as a pointer to a
GObject.Value
.The
GObject.Value
will remain valid for the life of self.New in version 2.38.
- get_name()[source]¶
- Returns:
the name of self.
- Return type:
Get the name of a
GObject.ParamSpec
.The name is always an “interned” string (as per
GLib.intern_string
()). This allows for pointer-value comparisons.
- get_name_quark()[source]¶
- Returns:
the GQuark for self->name.
- Return type:
Gets the GQuark for the name.
New in version 2.46.
- get_nick()[source]¶
- Returns:
the nickname of self.
- Return type:
Get the nickname of a
GObject.ParamSpec
.
- get_qdata(quark)[source]¶
- Parameters:
quark (
int
) – a #GQuark, naming the user data pointer- Returns:
the user data pointer set, or
None
- Return type:
Gets back user data pointers stored via
GObject.ParamSpec.set_qdata
().
- get_redirect_target()[source]¶
- Returns:
paramspec to which requests on this paramspec should be redirected, or
None
if none.- Return type:
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
GObject.ParamSpecOverride
. SeeGObject.ObjectClass.override_property
() for an example of the use of this capability.New in version 2.4.
- set_qdata(quark, data)[source]¶
- Parameters:
Sets an opaque, named pointer on a
GObject.ParamSpec
. The name is specified through a #GQuark (retrieved e.g. viaGLib.quark_from_static_string
()), and the pointer can be gotten back from the self withGObject.ParamSpec.get_qdata
(). Setting a previously set user data pointer, overrides (frees) the old pointer set, usingNone
as pointer essentially removes the data stored.
- sink()[source]¶
The initial reference count of a newly created
GObject.ParamSpec
is 1, even though no one has explicitly called g_param_spec_ref() on it yet. So the initial reference count is flagged as “floating”, until someone callsg_param_spec_ref (pspec); g_param_spec_sink (pspec);
in sequence on it, taking over the initial reference count (thus ending up with a self that has a reference count of 1 still, but is not flagged “floating” anymore).
- steal_qdata(quark)[source]¶
- Parameters:
quark (
int
) – a #GQuark, naming the user data pointer- Returns:
the user data pointer set, or
None
- Return type:
Gets back user data pointers stored via
GObject.ParamSpec.set_qdata
() and removes the data from self without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier.
- do_finalize() virtual¶
The instance finalization function (optional), should chain up to the finalize method of the parent class.
- do_value_is_valid(value) virtual¶
- Parameters:
value (
GObject.Value
) –- Return type:
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.Object
will use value_validate.New in version 2.74.
- do_value_set_default(value) virtual¶
- Parameters:
value (
GObject.Value
) –
Resets a value to the default value for this type (recommended, the default is
GObject.Value.reset
()), seeGObject.param_value_set_default
().
- do_value_validate(value) virtual¶
- Parameters:
value (
GObject.Value
) –- Return type:
Ensures that the contents of value comply with the specifications set out by this type (optional), see
GObject.param_value_validate
().
- do_values_cmp(value1, value2) virtual¶
- Parameters:
value1 (
GObject.Value
) –value2 (
GObject.Value
) –
- Return type:
Compares value1 with value2 according to this type (recommended, the default is memcmp()), see
GObject.param_values_cmp
().