Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- GObject.add_emission_hook(type, name, callback, *user_data)¶
- Parameters:
type (
GObject.Object) – a Python GObject instance or typename (
str) – a signal namecallback – a function
user_data – zero or more extra arguments that will be passed to callback
The add_emission_hook() function adds an emission hook for the signal specified by name, which will get called for any emission of that signal, independent of the instance. This is possible only for signals which don’t have the
GObject.SignalFlags.NO_HOOKSflag set.
- GObject.boxed_copy(boxed_type, src_boxed)[source]¶
- Parameters:
boxed_type (
GObject.GType) – The type of src_boxed.src_boxed (
object) – The boxed structure to be copied.
- Returns:
The newly created copy of the boxed structure.
- Return type:
Provide a copy of a boxed structure src_boxed which is of type boxed_type.
- GObject.boxed_free(boxed_type, boxed)[source]¶
- Parameters:
boxed_type (
GObject.GType) – The type of boxed.boxed (
object) – The boxed structure to be freed.
Free the boxed structure boxed which is of type boxed_type.
- GObject.boxed_type_register_static(name, boxed_copy, boxed_free)[source]¶
- Parameters:
name (
str) – Name of the new boxed type.boxed_copy (
GObject.BoxedCopyFunc) – Boxed structure copy function.boxed_free (
GObject.BoxedFreeFunc) – Boxed structure free function.
- Returns:
New
GObject.TYPE_BOXEDderived type id for name.- Return type:
This function creates a new
GObject.TYPE_BOXEDderived type id for a new boxed type with name name.Boxed type handling functions have to be provided to copy and free opaque boxed structures of this type.
For the general case, it is recommended to use G_DEFINE_BOXED_TYPE() instead of calling
GObject.boxed_type_register_static() directly. The macro will create the appropriate*_get_type()function for the boxed type.
- GObject.cclosure_marshal_BOOLEAN__BOXED_BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with handlers that take two boxed pointers as arguments and return a boolean. If you have such a signal, you will probably also need to use an accumulator, such asGObject.signal_accumulator_true_handled().
- GObject.cclosure_marshal_BOOLEAN__FLAGS(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with handlers that take a flags type as an argument and return a boolean. If you have such a signal, you will probably also need to use an accumulator, such asGObject.signal_accumulator_true_handled().
- GObject.cclosure_marshal_STRING__OBJECT_POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with handlers that take aGObject.Objectand a pointer and produce a string. It is highly unlikely that your signal handler fits this description.
- GObject.cclosure_marshal_VOID__BOOLEAN(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single boolean argument.
- GObject.cclosure_marshal_VOID__BOXED(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single argument which is any boxed pointer type.
- GObject.cclosure_marshal_VOID__CHAR(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single character argument.
- GObject.cclosure_marshal_VOID__DOUBLE(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with one double-precision floating point argument.
- GObject.cclosure_marshal_VOID__ENUM(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single argument with an enumerated type.
- GObject.cclosure_marshal_VOID__FLAGS(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single argument with a flags types.
- GObject.cclosure_marshal_VOID__FLOAT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with one single-precision floating point argument.
- GObject.cclosure_marshal_VOID__INT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single integer argument.
- GObject.cclosure_marshal_VOID__LONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with with a single long integer argument.
- GObject.cclosure_marshal_VOID__OBJECT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a singleGObject.Objectargument.
- GObject.cclosure_marshal_VOID__PARAM(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single argument of typeGObject.ParamSpec.
- GObject.cclosure_marshal_VOID__POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single raw pointer argument type.If it is possible, it is better to use one of the more specific functions such as
GObject.CClosure.marshal_VOID__OBJECT() orGObject.CClosure.marshal_VOID__OBJECT().
- GObject.cclosure_marshal_VOID__STRING(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single string argument.
- GObject.cclosure_marshal_VOID__UCHAR(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single unsigned character argument.
- GObject.cclosure_marshal_VOID__UINT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with with a single unsigned integer argument.
- GObject.cclosure_marshal_VOID__UINT_POINTER(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with an unsigned int and a pointer as arguments.
- GObject.cclosure_marshal_VOID__ULONG(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a single unsigned long integer argument.
- GObject.cclosure_marshal_VOID__VARIANT(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with a singleGLib.Variantargument.
- GObject.cclosure_marshal_VOID__VOID(closure, return_value, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_value (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshalfunction for use with signals with no arguments.
- GObject.cclosure_marshal_generic(closure, return_gvalue, n_param_values, param_values, invocation_hint, marshal_data)[source]¶
- Parameters:
closure (
GObject.Closure) – AGObject.Closure.return_gvalue (
GObject.Value) – AGObject.Valueto store the return value. May beNoneif the callback of closure doesn’t return a value.n_param_values (
int) – The length of the param_values array.param_values (
GObject.Value) – An array ofGObject.Valuesholding the arguments on which to invoke the callback of closure.invocation_hint (
objectorNone) – The invocation hint given as the last argument toGObject.Closure.invoke().marshal_data (
objectorNone) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A generic marshaller function implemented via libffi.
Normally this function is not passed explicitly to
GObject.signal_new(), but used automatically by GLib when specifying aNonemarshaller.New in version 2.30.
- GObject.clear_signal_handler(handler_id_ptr, instance)[source]¶
- Parameters:
handler_id_ptr (
int) – A pointer to a handler ID (of typeint) of the handler to be disconnected.instance (
GObject.Object) – The instance to remove the signal handler from. This pointer may beNoneor invalid, if the handler ID is zero.
Disconnects a handler from instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to. The handler_id_ptr is then set to zero, which is never a valid handler ID value (see g_signal_connect()).
If the handler ID is 0 then this function does nothing.
There is also a macro version of this function so that the code will be inlined.
New in version 2.62.
- GObject.enum_complete_type_info(g_enum_type, const_values)[source]¶
- Parameters:
g_enum_type (
GObject.GType) – the type identifier of the type being completedconst_values (
GObject.EnumValue) – An array ofGObject.EnumValuestructs for the possible enumeration values. The array is terminated by a struct with all members being 0.
- Returns:
the
GObject.TypeInfostruct to be filled in- Return type:
info:
GObject.TypeInfo
This function is meant to be called from the
complete_type_infofunction of aGObject.TypePluginimplementation, as in the following example:static void my_enum_complete_type_info (GTypePlugin *plugin, GType g_type, GTypeInfo *info, GTypeValueTable *value_table) { static const GEnumValue values[] = { { MY_ENUM_FOO, "MY_ENUM_FOO", "foo" }, { MY_ENUM_BAR, "MY_ENUM_BAR", "bar" }, { 0, NULL, NULL } }; g_enum_complete_type_info (type, info, values); }
- GObject.enum_get_value(enum_class, value)[source]¶
- Parameters:
enum_class (
GObject.EnumClass) – aGObject.EnumClassvalue (
int) – the value to look up
- Returns:
the
GObject.EnumValuefor value, orNoneif value is not a member of the enumeration- Return type:
Returns the
GObject.EnumValuefor a value.
- GObject.enum_get_value_by_name(enum_class, name)[source]¶
- Parameters:
enum_class (
GObject.EnumClass) – aGObject.EnumClassname (
str) – the name to look up
- Returns:
the
GObject.EnumValuewith name name, orNoneif the enumeration doesn’t have a member with that name- Return type:
Looks up a
GObject.EnumValueby name.
- GObject.enum_get_value_by_nick(enum_class, nick)[source]¶
- Parameters:
enum_class (
GObject.EnumClass) – aGObject.EnumClassnick (
str) – the nickname to look up
- Returns:
the
GObject.EnumValuewith nickname nick, orNoneif the enumeration doesn’t have a member with that nickname- Return type:
Looks up a
GObject.EnumValueby nickname.
- GObject.enum_register_static(name, const_static_values)[source]¶
- Parameters:
name (
str) – A nul-terminated string used as the name of the new type.const_static_values ([
GObject.EnumValue]) – An array ofGObject.EnumValuestructs for the possible enumeration values. The array is terminated by a struct with all members being 0.GObject.Objectkeeps a reference to the data, so it cannot be stack-allocated.
- Returns:
The new type identifier.
- Return type:
Registers a new static enumeration type with the name name.
It is normally more convenient to let glib-mkenums, generate a my_enum_get_type() function from a usual C enumeration definition than to write one yourself using
GObject.enum_register_static().
- GObject.enum_to_string(g_enum_type, value)[source]¶
- Parameters:
g_enum_type (
GObject.GType) – the type identifier of aGObject.EnumClasstypevalue (
int) – the value
- Returns:
a newly-allocated text string
- Return type:
Pretty-prints value in the form of the enum’s name.
This is intended to be used for debugging purposes. The format of the output may change in the future.
New in version 2.54.
- GObject.flags_complete_type_info(g_flags_type, const_values)[source]¶
- Parameters:
g_flags_type (
GObject.GType) – the type identifier of the type being completedconst_values (
GObject.FlagsValue) – An array ofGObject.FlagsValuestructs for the possible enumeration values. The array is terminated by a struct with all members being 0.
- Returns:
the
GObject.TypeInfostruct to be filled in- Return type:
info:
GObject.TypeInfo
This function is meant to be called from the complete_type_info() function of a
GObject.TypePluginimplementation, see the example forGObject.enum_complete_type_info() above.
- GObject.flags_get_first_value(flags_class, value)[source]¶
- Parameters:
flags_class (
GObject.FlagsClass) – aGObject.FlagsClassvalue (
int) – the value
- Returns:
the first
GObject.FlagsValuewhich is set in value, orNoneif none is set- Return type:
Returns the first
GObject.FlagsValuewhich is set in value.
- GObject.flags_get_value_by_name(flags_class, name)[source]¶
- Parameters:
flags_class (
GObject.FlagsClass) – aGObject.FlagsClassname (
str) – the name to look up
- Returns:
the
GObject.FlagsValuewith name name, orNoneif there is no flag with that name- Return type:
Looks up a
GObject.FlagsValueby name.
- GObject.flags_get_value_by_nick(flags_class, nick)[source]¶
- Parameters:
flags_class (
GObject.FlagsClass) – aGObject.FlagsClassnick (
str) – the nickname to look up
- Returns:
the
GObject.FlagsValuewith nickname nick, orNoneif there is no flag with that nickname- Return type:
Looks up a
GObject.FlagsValueby nickname.
- GObject.flags_register_static(name, const_static_values)[source]¶
- Parameters:
name (
str) – A nul-terminated string used as the name of the new type.const_static_values ([
GObject.FlagsValue]) – An array ofGObject.FlagsValuestructs for the possible flags values. The array is terminated by a struct with all members being 0.GObject.Objectkeeps a reference to the data, so it cannot be stack-allocated.
- Returns:
The new type identifier.
- Return type:
Registers a new static flags type with the name name.
It is normally more convenient to let glib-mkenums generate a my_flags_get_type() function from a usual C enumeration definition than to write one yourself using
GObject.flags_register_static().
- GObject.flags_to_string(flags_type, value)[source]¶
- Parameters:
flags_type (
GObject.GType) – the type identifier of aGObject.FlagsClasstypevalue (
int) – the value
- Returns:
a newly-allocated text string
- Return type:
Pretty-prints value in the form of the flag names separated by `` | `` and sorted. Any extra bits will be shown at the end as a hexadecimal number.
This is intended to be used for debugging purposes. The format of the output may change in the future.
New in version 2.54.
- GObject.list_properties(type)¶
- Parameters:
type (
GObject.Object) – a Python GObject instance or type that the signal is associated with- Returns:
a list of
GObject.ParamSpec- Return type:
Takes a GObject/GInterface subclass or a GType and returns a list of GParamSpecs for all properties of type.
- GObject.new(gtype_or_similar, **kwargs)¶
- Parameters:
type (
GObject.Object) – a Python GObject typekwargs – set of property-value pairs
- Returns:
a new object of the specified type
The Gobject.new() function returns a new object of the specified type. type must specify a type that is a descendant of gobject.GObject. GObject properties can set via keyword arguments.
- GObject.param_spec_boolean(name, nick, blurb, default_value, flags)[source]¶
- Parameters:
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecBooleaninstance specifying aGObject.TYPE_BOOLEANproperty. In many cases, it may be more appropriate to use an enum withGObject.param_spec_enum(), both to improve code clarity by using explicitly named values, and to allow for more values to be added in future without breaking API.See g_param_spec_internal() for details on property names.
- GObject.param_spec_boxed(name, nick, blurb, boxed_type, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedboxed_type (
GObject.GType) –GObject.TYPE_BOXEDderived type of this propertyflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecBoxedinstance specifying aGObject.TYPE_BOXEDderived property.See g_param_spec_internal() for details on property names.
- GObject.param_spec_char(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
int) – minimum value for the property specifiedmaximum (
int) – maximum value for the property specifieddefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecCharinstance specifying aGObject.TYPE_CHARproperty.
- GObject.param_spec_double(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
float) – minimum value for the property specifiedmaximum (
float) – maximum value for the property specifieddefault_value (
float) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecDoubleinstance specifying aGObject.TYPE_DOUBLEproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_enum(name, nick, blurb, enum_type, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedenum_type (
GObject.GType) – aGObject.GTypederived fromGObject.TYPE_ENUMdefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecEnuminstance specifying aGObject.TYPE_ENUMproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_flags(name, nick, blurb, flags_type, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedflags_type (
GObject.GType) – aGObject.GTypederived fromGObject.TYPE_FLAGSdefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecFlagsinstance specifying aGObject.TYPE_FLAGSproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_float(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
float) – minimum value for the property specifiedmaximum (
float) – maximum value for the property specifieddefault_value (
float) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecFloatinstance specifying aGObject.TYPE_FLOATproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_gtype(name, nick, blurb, is_a_type, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedis_a_type (
GObject.GType) – aGObject.GTypewhose subtypes are allowed as values of the property (useGObject.TYPE_NONEfor any type)flags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecGTypeinstance specifying aGObject.TYPE_GTYPEproperty.See g_param_spec_internal() for details on property names.
New in version 2.10.
- GObject.param_spec_int(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
int) – minimum value for the property specifiedmaximum (
int) – maximum value for the property specifieddefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecIntinstance specifying aGObject.TYPE_INTproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_int64(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
int) – minimum value for the property specifiedmaximum (
int) – maximum value for the property specifieddefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecInt64instance specifying aGObject.TYPE_INT64property.See g_param_spec_internal() for details on property names.
- GObject.param_spec_long(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
int) – minimum value for the property specifiedmaximum (
int) – maximum value for the property specifieddefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecLonginstance specifying aGObject.TYPE_LONGproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_object(name, nick, blurb, object_type, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedobject_type (
GObject.GType) –GObject.TYPE_OBJECTderived type of this propertyflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecBoxedinstance specifying aGObject.TYPE_OBJECTderived property.See g_param_spec_internal() for details on property names.
- GObject.param_spec_param(name, nick, blurb, param_type, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedparam_type (
GObject.GType) – aGObject.GTypederived fromGObject.TYPE_PARAMflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecParaminstance specifying aGObject.TYPE_PARAMproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_pointer(name, nick, blurb, flags)[source]¶
- Parameters:
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecPointerinstance specifying a pointer property. Where possible, it is better to useGObject.param_spec_object() orGObject.param_spec_boxed() to expose memory management information.See g_param_spec_internal() for details on property names.
- GObject.param_spec_string(name, nick, blurb, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifieddefault_value (
strorNone) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecStringinstance.See g_param_spec_internal() for details on property names.
- GObject.param_spec_uchar(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
int) – minimum value for the property specifiedmaximum (
int) – maximum value for the property specifieddefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecUCharinstance specifying aGObject.TYPE_UCHARproperty.
- GObject.param_spec_uint(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
int) – minimum value for the property specifiedmaximum (
int) – maximum value for the property specifieddefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecUIntinstance specifying aGObject.TYPE_UINTproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_uint64(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
int) – minimum value for the property specifiedmaximum (
int) – maximum value for the property specifieddefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecUInt64instance specifying aGObject.TYPE_UINT64property.See g_param_spec_internal() for details on property names.
- GObject.param_spec_ulong(name, nick, blurb, minimum, maximum, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedminimum (
int) – minimum value for the property specifiedmaximum (
int) – maximum value for the property specifieddefault_value (
int) – default value for the property specifiedflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecULonginstance specifying aGObject.TYPE_ULONGproperty.See g_param_spec_internal() for details on property names.
- GObject.param_spec_unichar(name, nick, blurb, default_value, flags)[source]¶
- Parameters:
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecUnicharinstance specifying aGObject.TYPE_UINTproperty.GObject.Valuestructures for this property can be accessed withGObject.Value.set_uint() andGObject.Value.get_uint().See g_param_spec_internal() for details on property names.
- GObject.param_spec_variant(name, nick, blurb, type, default_value, flags)[source]¶
- Parameters:
name (
str) – canonical name of the property specifiedtype (
GLib.VariantType) – aGLib.VariantTypedefault_value (
GLib.VariantorNone) – aGLib.Variantof type type to use as the default value, orNoneflags (
GObject.ParamFlags) – flags for the property specified
- Returns:
the newly created
GObject.ParamSpec- Return type:
Creates a new
GObject.ParamSpecVariantinstance specifying aGLib.Variantproperty.If default_value is floating, it is consumed.
See g_param_spec_internal() for details on property names.
New in version 2.26.
- GObject.param_type_register_static(name, pspec_info)[source]¶
- Parameters:
name (
str) – 0-terminated string used as the name of the newGObject.ParamSpectype.pspec_info (
GObject.ParamSpecTypeInfo) – TheGObject.ParamSpecTypeInfofor thisGObject.ParamSpectype.
- Returns:
The new type identifier.
- Return type:
Registers name as the name of a new static type derived from
GObject.TYPE_PARAM.The type system uses the information contained in the
GObject.ParamSpecTypeInfostructure pointed to by info to manage theGObject.ParamSpectype and its instances.
- GObject.param_value_convert(pspec, src_value, dest_value, strict_validation)[source]¶
- Parameters:
pspec (
GObject.ParamSpec) – a validGObject.ParamSpecsrc_value (
GObject.Value) – sourceGObject.Valuedest_value (
GObject.Value) – destinationGObject.Valueof correct type for pspecstrict_validation (
bool) –Truerequires dest_value to conform to pspec without modifications
- Returns:
Trueif transformation and validation were successful,Falseotherwise and dest_value is left untouched.- Return type:
Transforms src_value into dest_value if possible, and then validates dest_value, in order for it to conform to pspec. If strict_validation is
Truethis function will only succeed if the transformed dest_value complied to pspec without modifications.See also
GObject.Value.type_transformable(),GObject.Value.transform() andGObject.param_value_validate().
- GObject.param_value_defaults(pspec, value)[source]¶
- Parameters:
pspec (
GObject.ParamSpec) – a validGObject.ParamSpecvalue (
GObject.Value) – aGObject.Valueof correct type for pspec
- Returns:
whether value contains the canonical default for this pspec
- Return type:
Checks whether value contains the default value as specified in pspec.
- GObject.param_value_is_valid(pspec, value)[source]¶
- Parameters:
pspec (
GObject.ParamSpec) – a validGObject.ParamSpecvalue (
GObject.Value) – aGObject.Valueof correct type for pspec
- Returns:
whether the contents of value comply with the specifications set out by pspec.
- Return type:
Return whether the contents of value comply with the specifications set out by pspec.
New in version 2.74.
- GObject.param_value_set_default(pspec, value)[source]¶
- Parameters:
pspec (
GObject.ParamSpec) – a validGObject.ParamSpecvalue (
GObject.Value) – aGObject.Valueof correct type for pspec; since 2.64, you can also pass an emptyGObject.Value, initialized with %G_VALUE_INIT
Sets value to its default value as specified in pspec.
- GObject.param_value_validate(pspec, value)[source]¶
- Parameters:
pspec (
GObject.ParamSpec) – a validGObject.ParamSpecvalue (
GObject.Value) – aGObject.Valueof correct type for pspec
- Returns:
whether modifying value was necessary to ensure validity
- Return type:
Ensures that the contents of value comply with the specifications set out by pspec. For example, a
GObject.ParamSpecIntmight require that integers stored in value may not be smaller than -42 and not be greater than +42. If value contains an integer outside of this range, it is modified accordingly, so the resulting value will fit into the range -42 .. +42.
- GObject.param_values_cmp(pspec, value1, value2)[source]¶
- Parameters:
pspec (
GObject.ParamSpec) – a validGObject.ParamSpecvalue1 (
GObject.Value) – aGObject.Valueof correct type for pspecvalue2 (
GObject.Value) – aGObject.Valueof correct type for pspec
- Returns:
-1, 0 or +1, for a less than, equal to or greater than result
- Return type:
Compares value1 with value2 according to pspec, and return -1, 0 or +1, if value1 is found to be less than, equal to or greater than value2, respectively.
- GObject.pointer_type_register_static(name)[source]¶
- Parameters:
name (
str) – the name of the new pointer type.- Returns:
a new
GObject.TYPE_POINTERderived type id for name.- Return type:
Creates a new
GObject.TYPE_POINTERderived type id for a new pointer type with name name.
- GObject.remove_emission_hook(obj, detailed_signal, hook_id)¶
The type of the None singleton.
- GObject.signal_accumulator_first_wins(ihint, return_accu, handler_return, dummy)[source]¶
- Parameters:
ihint (
GObject.SignalInvocationHint) – standardGObject.SignalAccumulatorparameterreturn_accu (
GObject.Value) – standardGObject.SignalAccumulatorparameterhandler_return (
GObject.Value) – standardGObject.SignalAccumulatorparameterdummy (
objectorNone) – standardGObject.SignalAccumulatorparameter
- Returns:
standard
GObject.SignalAccumulatorresult- Return type:
A predefined
GObject.SignalAccumulatorfor signals intended to be used as a hook for application code to provide a particular value. Usually only one such value is desired and multiple handlers for the same signal don’t make much sense (except for the case of the default handler defined in the class structure, in which case you will usually want the signal connection to override the class handler).This accumulator will use the return value from the first signal handler that is run as the return value for the signal and not run any further handlers (ie: the first handler “wins”).
New in version 2.28.
- GObject.signal_accumulator_true_handled(ihint, return_accu, handler_return, dummy)[source]¶
- Parameters:
ihint (
GObject.SignalInvocationHint) – standardGObject.SignalAccumulatorparameterreturn_accu (
GObject.Value) – standardGObject.SignalAccumulatorparameterhandler_return (
GObject.Value) – standardGObject.SignalAccumulatorparameterdummy (
objectorNone) – standardGObject.SignalAccumulatorparameter
- Returns:
standard
GObject.SignalAccumulatorresult- Return type:
A predefined
GObject.SignalAccumulatorfor signals that return a boolean values. The behavior that this accumulator gives is that a return ofTruestops the signal emission: no further callbacks will be invoked, while a return ofFalseallows the emission to continue. The idea here is that aTruereturn indicates that the callback handled the signal, and no further handling is needed.New in version 2.4.
- GObject.signal_add_emission_hook(signal_id, detail, hook_func)[source]¶
- Parameters:
signal_id (
int) – the signal identifier, as returned byGObject.signal_lookup().detail (
int) – the detail on which to call the hook.hook_func (
GObject.SignalEmissionHook) – aGObject.SignalEmissionHookfunction.
- Returns:
the hook id, for later use with
GObject.signal_remove_emission_hook().- Return type:
Adds an emission hook for a signal, which will get called for any emission of that signal, independent of the instance. This is possible only for signals which don’t have
GObject.SignalFlags.NO_HOOKSflag set.
- GObject.signal_chain_from_overridden(instance_and_params, return_value)[source]¶
- Parameters:
instance_and_params ([
GObject.Value]) – the argument list of the signal emission. The first element in the array is aGObject.Valuefor the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.return_value (
GObject.Value) – Location for the return value.
Calls the original class closure of a signal. This function should only be called from an overridden class closure; see
GObject.signal_override_class_closure() andGObject.signal_override_class_handler().
- GObject.signal_connect_closure(instance, detailed_signal, closure, after)[source]¶
- Parameters:
instance (
GObject.Object) – the instance to connect to.detailed_signal (
str) – a string of the form “signal-name::detail”.closure (
GObject.Closure) – the closure to connect.after (
bool) – whether the handler should be called before or after the default handler of the signal.
- Returns:
the handler ID (always greater than 0)
- Return type:
Connects a closure to a signal for a particular object.
If closure is a floating reference (see
GObject.Closure.sink()), this function takes ownership of closure.This function cannot fail. If the given signal name doesn’t exist, a critical warning is emitted. No validation is performed on the ‘detail’ string when specified in detailed_signal, other than a non-empty check.
Refer to the signals documentation for more details.
- GObject.signal_connect_closure_by_id(instance, signal_id, detail, closure, after)[source]¶
- Parameters:
instance (
GObject.Object) – the instance to connect to.signal_id (
int) – the id of the signal.detail (
int) – the detail.closure (
GObject.Closure) – the closure to connect.after (
bool) – whether the handler should be called before or after the default handler of the signal.
- Returns:
the handler ID (always greater than 0)
- Return type:
Connects a closure to a signal for a particular object.
If closure is a floating reference (see
GObject.Closure.sink()), this function takes ownership of closure.This function cannot fail. If the given signal name doesn’t exist, a critical warning is emitted. No validation is performed on the ‘detail’ string when specified in detailed_signal, other than a non-empty check.
Refer to the signals documentation for more details.
- GObject.signal_emitv(instance_and_params, signal_id, detail, return_value)[source]¶
- Parameters:
instance_and_params ([
GObject.Value]) – argument list for the signal emission. The first element in the array is aGObject.Valuefor the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.signal_id (
int) – the signal iddetail (
int) – the detailreturn_value (
GObject.Value) – Location to store the return value of the signal emission. This must be provided if the specified signal returns a value, but may be ignored otherwise.
- Returns:
Location to store the return value of the signal emission. This must be provided if the specified signal returns a value, but may be ignored otherwise.
- Return type:
return_value:
GObject.Value
Emits a signal. Signal emission is done synchronously. The method will only return control after all handlers are called or signal emission was stopped.
Note that
GObject.signal_emitv() doesn’t change return_value if no handlers are connected, in contrast to g_signal_emit() and g_signal_emit_valist().
- GObject.signal_get_invocation_hint(instance)[source]¶
- Parameters:
instance (
GObject.Object) – the instance to query- Returns:
the invocation hint of the innermost signal emission, or
Noneif not found.- Return type:
Returns the invocation hint of the innermost signal emission of instance.
- GObject.signal_handler_block(instance, handler_id)[source]¶
Blocks the signal handler from being invoked until handler_unblock() is called.
- Parameters:
obj (GObject.Object) – Object instance to block handlers for.
handler_id (int) – Id of signal to block.
- Returns:
A context manager which optionally can be used to automatically unblock the handler:
with GObject.signal_handler_block(obj, id): pass
- GObject.signal_handler_disconnect(instance, handler_id)[source]¶
- Parameters:
instance (
GObject.Object) – The instance to remove the signal handler from.handler_id (
int) – Handler id of the handler to be disconnected.
Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to. The handler_id becomes invalid and may be reused.
The handler_id has to be a valid signal handler id, connected to a signal of instance.
- GObject.signal_handler_find(instance, mask, signal_id, detail, closure, func, data)[source]¶
- Parameters:
instance (
GObject.Object) – The instance owning the signal handler to be found.mask (
GObject.SignalMatchType) – Mask indicating which of signal_id, detail, closure, func and/or data the handler has to match.signal_id (
int) – Signal the handler has to be connected to.detail (
int) – Signal detail the handler has to be connected to.closure (
GObject.ClosureorNone) – The closure the handler will invoke.func (
objectorNone) – The C closure callback of the handler (useless for non-C closures).data (
objectorNone) – The closure data of the handler’s closure.
- Returns:
A valid non-0 signal handler id for a successful match.
- Return type:
Finds the first signal handler that matches certain selection criteria. The criteria mask is passed as an OR-ed combination of
GObject.SignalMatchTypeflags, and the criteria values are passed as arguments. The match mask has to be non-0 for successful matches. If no handler was found, 0 is returned.
- GObject.signal_handler_is_connected(instance, handler_id)[source]¶
- Parameters:
instance (
GObject.Object) – The instance where a signal handler is sought.handler_id (
int) – the handler ID.
- Returns:
whether handler_id identifies a handler connected to instance.
- Return type:
Returns whether handler_id is the ID of a handler connected to instance.
- GObject.signal_handler_unblock(instance, handler_id)[source]¶
- Parameters:
instance (
GObject.Object) – The instance to unblock the signal handler of.handler_id (
int) – Handler id of the handler to be unblocked.
Undoes the effect of a previous
GObject.signal_handler_block() call. A blocked handler is skipped during signal emissions and will not be invoked, unblocking it (for exactly the amount of times it has been blocked before) reverts its “blocked” state, so the handler will be recognized by the signal system and is called upon future or currently ongoing signal emissions (since the order in which handlers are called during signal emissions is deterministic, whether the unblocked handler in question is called as part of a currently ongoing emission depends on how far that emission has proceeded yet).The handler_id has to be a valid id of a signal handler that is connected to a signal of instance and is currently blocked.
- GObject.signal_handlers_block_matched(instance, mask, signal_id, detail, closure, func, data)[source]¶
- Parameters:
instance (
GObject.Object) – The instance to block handlers from.mask (
GObject.SignalMatchType) – Mask indicating which of signal_id, detail, closure, func and/or data the handlers have to match.signal_id (
int) – Signal the handlers have to be connected to.detail (
int) – Signal detail the handlers have to be connected to.closure (
GObject.ClosureorNone) – The closure the handlers will invoke.func (
objectorNone) – The C closure callback of the handlers (useless for non-C closures).data (
objectorNone) – The closure data of the handlers’ closures.
- Returns:
The number of handlers that matched.
- Return type:
Blocks all handlers on an instance that match a certain selection criteria.
The criteria mask is passed as a combination of
GObject.SignalMatchTypeflags, and the criteria values are passed as arguments. A handler must match on all flags set in mask to be blocked (i.e. the match is conjunctive).Passing at least one of the
GObject.SignalMatchType.ID,GObject.SignalMatchType.CLOSURE,GObject.SignalMatchType.FUNCorGObject.SignalMatchType.DATAmatch flags is required for successful matches. If no handlers were found, 0 is returned, the number of blocked handlers otherwise.Support for
GObject.SignalMatchType.IDwas added in GLib 2.78.
- GObject.signal_handlers_destroy(instance)[source]¶
- Parameters:
instance (
GObject.Object) – The instance whose signal handlers are destroyed
Destroy all signal handlers of a type instance. This function is an implementation detail of the
GObject.Objectdispose implementation, and should not be used outside of the type system.
- GObject.signal_handlers_disconnect_matched(instance, mask, signal_id, detail, closure, func, data)[source]¶
- Parameters:
instance (
GObject.Object) – The instance to remove handlers from.mask (
GObject.SignalMatchType) – Mask indicating which of signal_id, detail, closure, func and/or data the handlers have to match.signal_id (
int) – Signal the handlers have to be connected to.detail (
int) – Signal detail the handlers have to be connected to.closure (
GObject.ClosureorNone) – The closure the handlers will invoke.func (
objectorNone) – The C closure callback of the handlers (useless for non-C closures).data (
objectorNone) – The closure data of the handlers’ closures.
- Returns:
The number of handlers that matched.
- Return type:
Disconnects all handlers on an instance that match a certain selection criteria.
The criteria mask is passed as a combination of
GObject.SignalMatchTypeflags, and the criteria values are passed as arguments. A handler must match on all flags set in mask to be disconnected (i.e. the match is conjunctive).Passing at least one of the
GObject.SignalMatchType.ID,GObject.SignalMatchType.CLOSURE,GObject.SignalMatchType.FUNCorGObject.SignalMatchType.DATAmatch flags is required for successful matches. If no handlers were found, 0 is returned, the number of disconnected handlers otherwise.Support for
GObject.SignalMatchType.IDwas added in GLib 2.78.
- GObject.signal_handlers_unblock_matched(instance, mask, signal_id, detail, closure, func, data)[source]¶
- Parameters:
instance (
GObject.Object) – The instance to unblock handlers from.mask (
GObject.SignalMatchType) – Mask indicating which of signal_id, detail, closure, func and/or data the handlers have to match.signal_id (
int) – Signal the handlers have to be connected to.detail (
int) – Signal detail the handlers have to be connected to.closure (
GObject.ClosureorNone) – The closure the handlers will invoke.func (
objectorNone) – The C closure callback of the handlers (useless for non-C closures).data (
objectorNone) – The closure data of the handlers’ closures.
- Returns:
The number of handlers that matched.
- Return type:
Unblocks all handlers on an instance that match a certain selection criteria.
The criteria mask is passed as a combination of
GObject.SignalMatchTypeflags, and the criteria values are passed as arguments. A handler must match on all flags set in mask to be unblocked (i.e. the match is conjunctive).Passing at least one of the
GObject.SignalMatchType.ID,GObject.SignalMatchType.CLOSURE,GObject.SignalMatchType.FUNCorGObject.SignalMatchType.DATAmatch flags is required for successful matches. If no handlers were found, 0 is returned, the number of unblocked handlers otherwise. The match criteria should not apply to any handlers that are not currently blocked.Support for
GObject.SignalMatchType.IDwas added in GLib 2.78.
- GObject.signal_has_handler_pending(instance, signal_id, detail, may_be_blocked)[source]¶
- Parameters:
instance (
GObject.Object) – the object whose signal handlers are sought.signal_id (
int) – the signal id.detail (
int) – the detail.may_be_blocked (
bool) – whether blocked handlers should count as match.
- Returns:
Trueif a handler is connected to the signal,Falseotherwise.- Return type:
Returns whether there are any handlers connected to instance for the given signal id and detail.
If detail is 0 then it will only match handlers that were connected without detail. If detail is non-zero then it will match handlers connected both without detail and with the given detail. This is consistent with how a signal emitted with detail would be delivered to those handlers.
Since 2.46 this also checks for a non-default class closure being installed, as this is basically always what you want.
One example of when you might use this is when the arguments to the signal are difficult to compute. A class implementor may opt to not emit the signal if no one is attached anyway, thus saving the cost of building the arguments.
- GObject.signal_is_valid_name(name)[source]¶
- Parameters:
name (
str) – the canonical name of the signal- Returns:
- Return type:
Validate a signal name. This can be useful for dynamically-generated signals which need to be validated at run-time before actually trying to create them.
See [func`GObject`.signal_new] for details of the rules for valid names. The rules for signal names are the same as those for property names.
New in version 2.66.
- GObject.signal_list_ids(itype)[source]¶
- Parameters:
itype (
GObject.GType) – Instance or interface type.- Returns:
Newly allocated array of signal IDs.
- Return type:
[
int]
Lists the signals by id that a certain instance or interface type created. Further information about the signals can be acquired through
GObject.signal_query().
- GObject.signal_list_names(type_)¶
Returns a list of signal names for the given type
- Parameters:
type_ (
GObject.GType) –- Returns:
A list of signal names
- Return type:
- GObject.signal_lookup(name, itype)[source]¶
- Parameters:
name (
str) – the signal’s name.itype (
GObject.GType) – the type that the signal operates on.
- Returns:
the signal’s identifying number, or 0 if no signal was found.
- Return type:
Given the name of the signal and the type of object it connects to, gets the signal’s identifying integer. Emitting the signal by number is somewhat faster than using the name each time.
Also tries the ancestors of the given type.
The type class passed as itype must already have been instantiated (for example, using
GObject.TypeClass.ref()) for this function to work, as signals are always installed during class initialization.See
GObject.signal_new() for details on allowed signal names.
- GObject.signal_name(signal_id)[source]¶
- Parameters:
signal_id (
int) – the signal’s identifying number.- Returns:
the signal name, or
Noneif the signal number was invalid.- Return type:
Given the signal’s identifier, finds its name.
Two different signals may have the same name, if they have differing types.
- GObject.signal_new(signal_name, type, flags, return_type, param_types)[source]¶
- Parameters:
signal_name (
str) – the name of the signaltype (
GObject.Object) – a Python GObject instance or type that the signal is associated withflags (
GObject.SignalFlags) – the signal flagsreturn_type (
type) – the return type of the signal handlerparam_types ([
type]) – the parameter types passed to the signal handler
- Returns:
a unique integer signal ID
- Return type:
The
GObject.signal_new() function registers a signal with the specified signal_name for the specified object type.return_type is the type of the return value from a signal handler and may be a gobject type, type ID or instance. The param_types parameter is a list of additional types that are passed to the signal handler. Each parameter type may be specified as a gobject type, type ID or instance. For example, to add a signal to the
Gtk.Windowtype called “my-signal” that calls a handler with aGtk.Buttonwidget and an integer value and a return value that is a boolean, use:GObject.signal_new("my_signal", Gtk.Window, GObject.SignalFlags.RUN_LAST, GObject.TYPE_BOOLEAN, (Gtk.Button, GObject.TYPE_INT))
- GObject.signal_override_class_closure(signal_id, instance_type, class_closure)[source]¶
- Parameters:
signal_id (
int) – the signal idinstance_type (
GObject.GType) – the instance type on which to override the class closure for the signal.class_closure (
GObject.Closure) – the closure.
Overrides the class closure (i.e. the default handler) for the given signal for emissions on instances of instance_type. instance_type must be derived from the type to which the signal belongs.
See
GObject.signal_chain_from_overridden() and g_signal_chain_from_overridden_handler() for how to chain up to the parent class closure from inside the overridden one.
- GObject.signal_override_class_handler(signal_name, instance_type, class_handler)[source]¶
- Parameters:
signal_name (
str) – the name for the signalinstance_type (
GObject.GType) – the instance type on which to override the class handler for the signal.class_handler (
GObject.Callback) – the handler.
Overrides the class closure (i.e. the default handler) for the given signal for emissions on instances of instance_type with callback class_handler. instance_type must be derived from the type to which the signal belongs.
See
GObject.signal_chain_from_overridden() and g_signal_chain_from_overridden_handler() for how to chain up to the parent class closure from inside the overridden one.New in version 2.18.
- GObject.signal_parse_name(detailed_signal, itype, force_detail_quark)[source]¶
Parse a detailed signal name into (signal_id, detail).
- Parameters:
detailed_signal (str) – Signal name which can include detail. For example: “notify:prop_name”
- Returns:
Tuple of (signal_id, detail)
- Raises:
ValueError – If the given signal is unknown.
- GObject.signal_query(signal_id)[source]¶
- Parameters:
signal_id (
int) – The signal id of the signal to query information for.- Returns:
A user provided structure that is filled in with constant values upon success.
- Return type:
query:
GObject.SignalQuery
Queries the signal system for in-depth information about a specific signal. This function will fill in a user-provided structure to hold signal-specific information. If an invalid signal id is passed in, the signal_id member of the
GObject.SignalQueryis 0. All members filled into theGObject.SignalQuerystructure should be considered constant and have to be left untouched.
- GObject.signal_remove_emission_hook(signal_id, hook_id)[source]¶
- Parameters:
signal_id (
int) – the id of the signalhook_id (
int) – the id of the emission hook, as returned byGObject.signal_add_emission_hook()
Deletes an emission hook.
- GObject.signal_stop_emission(instance, signal_id, detail)[source]¶
- Parameters:
instance (
GObject.Object) – the object whose signal handlers you wish to stop.signal_id (
int) – the signal identifier, as returned byGObject.signal_lookup().detail (
int) – the detail which the signal was emitted with.
Stops a signal’s current emission.
This will prevent the default method from running, if the signal was
GObject.SignalFlags.RUN_LASTand you connected normally (i.e. without the “after” flag).Prints a warning if used on a signal which isn’t being emitted.
- GObject.signal_stop_emission_by_name(instance, detailed_signal)[source]¶
- Parameters:
instance (
GObject.Object) – the object whose signal handlers you wish to stop.detailed_signal (
str) – a string of the form “signal-name::detail”.
Stops a signal’s current emission.
This is just like
GObject.signal_stop_emission() except it will look up the signal id for you.
- GObject.signal_type_cclosure_new(itype, struct_offset)[source]¶
- Parameters:
itype (
GObject.GType) – theGObject.GTypeidentifier of an interface or classed typestruct_offset (
int) – the offset of the member function of itype's class structure which is to be invoked by the new closure
- Returns:
a floating reference to a new
GObject.CClosure- Return type:
Creates a new closure which invokes the function found at the offset struct_offset in the class structure of the interface or classed type identified by itype.
- GObject.source_set_closure(source, closure)[source]¶
- Parameters:
source (
GLib.Source) – the sourceclosure (
GObject.Closure) – aGObject.Closure
Set the callback for a source as a
GObject.Closure.If the source is not one of the standard GLib types, the closure_callback and closure_marshal fields of the
GLib.SourceFuncsstructure must have been filled in with pointers to appropriate functions.
- GObject.source_set_dummy_callback(source)[source]¶
- Parameters:
source (
GLib.Source) – the source
Sets a dummy callback for source. The callback will do nothing, and if the source expects a
boolreturn value, it will returnTrue. (If the source expects any other type of return value, it will return a 0/Nonevalue; whateverGObject.Value.init() initializes aGObject.Valueto for that type.)If the source is not one of the standard GLib types, the closure_callback and closure_marshal fields of the
GLib.SourceFuncsstructure must have been filled in with pointers to appropriate functions.
- GObject.strdup_value_contents(value)[source]¶
- Parameters:
value (
GObject.Value) –GObject.Valuewhich contents are to be described.- Returns:
Newly allocated string.
- Return type:
Return a newly allocated string, which describes the contents of a
GObject.Value. The main purpose of this function is to describeGObject.Valuecontents for debugging output, the way in which the contents are described may change between different GLib versions.
- GObject.type_add_class_private(class_type, private_size)[source]¶
- Parameters:
class_type (
GObject.GType) –GObject.GTypeof a classed typeprivate_size (
int) – size of private structure
Registers a private class structure for a classed type; when the class is allocated, the private structures for the class and all of its parent types are allocated sequentially in the same memory block as the public structures, and are zero-filled.
This function should be called in the type’s get_type() function after the type is registered. The private structure can be retrieved using the G_TYPE_CLASS_GET_PRIVATE() macro.
New in version 2.24.
- GObject.type_add_instance_private(class_type, private_size)[source]¶
- Parameters:
class_type (
GObject.GType) –private_size (
int) –
- Return type:
- GObject.type_add_interface_dynamic(instance_type, interface_type, plugin)[source]¶
- Parameters:
instance_type (
GObject.GType) –GObject.GTypevalue of an instantiatable typeinterface_type (
GObject.GType) –GObject.GTypevalue of an interface typeplugin (
GObject.TypePlugin) –GObject.TypePluginstructure to retrieve theGObject.InterfaceInfofrom
Adds interface_type to the dynamic instance_type. The information contained in the
GObject.TypePluginstructure pointed to by plugin is used to manage the relationship.
- GObject.type_add_interface_static(instance_type, interface_type, info)[source]¶
- Parameters:
instance_type (
GObject.GType) –GObject.GTypevalue of an instantiatable typeinterface_type (
GObject.GType) –GObject.GTypevalue of an interface typeinfo (
GObject.InterfaceInfo) –GObject.InterfaceInfostructure for this (instance_type, interface_type) combination
Adds interface_type to the static instance_type. The information contained in the
GObject.InterfaceInfostructure pointed to by info is used to manage the relationship.
- GObject.type_check_class_is_a(g_class, is_a_type)[source]¶
- Parameters:
g_class (
GObject.TypeClass) –is_a_type (
GObject.GType) –
- Return type:
- GObject.type_check_instance(instance)[source]¶
- Parameters:
instance (
GObject.TypeInstance) – a validGObject.TypeInstancestructure- Returns:
- Return type:
Private helper function to aid implementation of the G_TYPE_CHECK_INSTANCE() macro.
- GObject.type_check_instance_is_a(instance, iface_type)[source]¶
- Parameters:
instance (
GObject.TypeInstance) –iface_type (
GObject.GType) –
- Return type:
- GObject.type_check_instance_is_fundamentally_a(instance, fundamental_type)[source]¶
- Parameters:
instance (
GObject.TypeInstance) –fundamental_type (
GObject.GType) –
- Return type:
- GObject.type_check_is_value_type(type)[source]¶
- Parameters:
type (
GObject.GType) –- Return type:
- GObject.type_check_value(value)[source]¶
- Parameters:
value (
GObject.Value) –- Return type:
- GObject.type_check_value_holds(value, type)[source]¶
- Parameters:
value (
GObject.Value) –type (
GObject.GType) –
- Return type:
- GObject.type_children(type)[source]¶
- Parameters:
type (
GObject.GType) – the parent type- Returns:
Newly allocated and 0-terminated array of child types, free with
GLib.free()- Return type:
Return a newly allocated and 0-terminated array of type IDs, listing the child types of type.
- GObject.type_class_get(type)[source]¶
- Parameters:
type (
GObject.GType) – type ID of a classed type- Returns:
the class structure for the type
- Return type:
Retrieves the type class of the given type.
This function will create the class on demand if it does not exist already.
If you don’t want to create the class, use
GObject.TypeClass.peek() instead.New in version 2.84.
- GObject.type_class_peek(type)[source]¶
- Parameters:
type (
GObject.GType) – type ID of a classed type- Returns:
the
GObject.TypeClassstructure for the given type ID orNoneif the class does not currently exist- Return type:
Retrieves the class for a give type.
This function is essentially the same as
GObject.TypeClass.get(), except that the class may have not been instantiated yet.As a consequence, this function may return
Noneif the class of the type passed in does not currently exist (hasn’t been referenced before).
- GObject.type_class_peek_static(type)[source]¶
- Parameters:
type (
GObject.GType) – type ID of a classed type- Returns:
the
GObject.TypeClassstructure for the given type ID orNoneif the class does not currently exist or is dynamically loaded- Return type:
A more efficient version of
GObject.TypeClass.peek() which works only for static types.New in version 2.4.
- GObject.type_class_ref(type)[source]¶
- Parameters:
type (
GObject.GType) – type ID of a classed type- Returns:
the
GObject.TypeClassstructure for the given type ID- Return type:
Increments the reference count of the class structure belonging to type.
This function will demand-create the class if it doesn’t exist already.
Deprecated since version 2.84: Use
GObject.TypeClass.get() instead
- GObject.type_default_interface_get(g_type)[source]¶
- Parameters:
g_type (
GObject.GType) – an interface type- Returns:
the default vtable for the interface.
- Return type:
Returns the default interface vtable for the given g_type.
If the type is not currently in use, then the default vtable for the type will be created and initialized by calling the base interface init and default vtable init functions for the type (the base_init and class_init members of
GObject.TypeInfo).If you don’t want to create the interface vtable, you should use
GObject.type_default_interface_peek() instead.Calling
GObject.type_default_interface_get() is useful when you want to make sure that signals and properties for an interface have been installed.New in version 2.84.
- GObject.type_default_interface_peek(g_type)[source]¶
- Parameters:
g_type (
GObject.GType) – an interface type- Returns:
the default vtable for the interface, or
Noneif the type is not currently in use- Return type:
If the interface type g_type is currently in use, returns its default interface vtable.
New in version 2.4.
- GObject.type_default_interface_ref(g_type)[source]¶
- Parameters:
g_type (
GObject.GType) – an interface type- Returns:
the default vtable for the interface; call
GObject.type_default_interface_unref() when you are done using the interface.- Return type:
Increments the reference count for the interface type g_type, and returns the default interface vtable for the type.
If the type is not currently in use, then the default vtable for the type will be created and initialized by calling the base interface init and default vtable init functions for the type (the base_init and class_init members of
GObject.TypeInfo). CallingGObject.type_default_interface_ref() is useful when you want to make sure that signals and properties for an interface have been installed.New in version 2.4.
Deprecated since version 2.84: Use
GObject.type_default_interface_get() instead
- GObject.type_default_interface_unref(g_iface)[source]¶
- Parameters:
g_iface (
GObject.TypeInterface) – the default vtable structure for an interface, as returned byGObject.type_default_interface_ref()
Decrements the reference count for the type corresponding to the interface default vtable g_iface.
If the type is dynamic, then when no one is using the interface and all references have been released, the finalize function for the interface’s default vtable (the class_finalize member of
GObject.TypeInfo) will be called.New in version 2.4.
Deprecated since version 2.84: Interface reference counting has been removed and interface types now cannot be finalized. This function no longer does anything.
- GObject.type_depth(type)[source]¶
- Parameters:
type (
GObject.GType) – aGObject.GType- Returns:
the depth of type
- Return type:
Returns the length of the ancestry of the passed in type. This includes the type itself, so that e.g. a fundamental type has depth 1.
- GObject.type_ensure(type)[source]¶
- Parameters:
type (
GObject.GType) – aGObject.GType
Ensures that the indicated type has been registered with the type system, and its _class_init() method has been run.
In theory, simply calling the type’s _get_type() method (or using the corresponding macro) is supposed take care of this. However, _get_type() methods are often marked %G_GNUC_CONST for performance reasons, even though this is technically incorrect (since %G_GNUC_CONST requires that the function not have side effects, which _get_type() methods do on the first call). As a result, if you write a bare call to a _get_type() macro, it may get optimized out by the compiler. Using
GObject.type_ensure() guarantees that the type’s _get_type() method is called.New in version 2.34.
- GObject.type_free_instance(instance)[source]¶
- Parameters:
instance (
GObject.TypeInstance) – an instance of a type
Frees an instance of a type, returning it to the instance pool for the type, if there is one.
Like g_type_create_instance(), this function is reserved for implementors of fundamental types.
- GObject.type_from_name(name)[source]¶
- Parameters:
name (
str) – type name to look up- Returns:
corresponding type ID or 0
- Return type:
Look up the type ID from a given type name, returning 0 if no type has been registered under this name (this is the preferred method to find out by name whether a specific type has been registered yet).
- GObject.type_fundamental(type_id)[source]¶
- Parameters:
type_id (
GObject.GType) – valid type ID- Returns:
fundamental type ID
- Return type:
Internal function, used to extract the fundamental type ID portion. Use G_TYPE_FUNDAMENTAL() instead.
- GObject.type_fundamental_next()[source]¶
- Returns:
the next available fundamental type ID to be registered, or 0 if the type system ran out of fundamental type IDs
- Return type:
Returns the next free fundamental type id which can be used to register a new fundamental type with
GObject.type_register_fundamental(). The returned type ID represents the highest currently registered fundamental type identifier.
- GObject.type_get_instance_count(type)[source]¶
- Parameters:
type (
GObject.GType) – aGObject.GType- Returns:
the number of instances allocated of the given type; if instance counts are not available, returns 0.
- Return type:
Returns the number of instances allocated of the particular type; this is only available if GLib is built with debugging support and the
instance-countdebug flag is set (by setting theGOBJECT_DEBUGvariable to includeinstance-count).New in version 2.44.
- GObject.type_get_plugin(type)[source]¶
- Parameters:
type (
GObject.GType) –GObject.GTypeto retrieve the plugin for- Returns:
the corresponding plugin if type is a dynamic type,
Noneotherwise- Return type:
Returns the
GObject.TypePluginstructure for type.
- GObject.type_get_qdata(type, quark)[source]¶
- Parameters:
type (
GObject.GType) – aGObject.GTypequark (
int) – a #GQuark id to identify the data
- Returns:
the data, or
Noneif no data was found- Return type:
Obtains data which has previously been attached to type with
GObject.type_set_qdata().Note that this does not take subtyping into account; data attached to one type with
GObject.type_set_qdata() cannot be retrieved from a subtype usingGObject.type_get_qdata().
- GObject.type_get_type_registration_serial()[source]¶
- Returns:
An unsigned int, representing the state of type registrations
- Return type:
Returns an opaque serial number that represents the state of the set of registered types. Any time a type is registered this serial changes, which means you can cache information based on type lookups (such as
GObject.type_from_name()) and know if the cache is still valid at a later time by comparing the current serial with the one at the type lookup.New in version 2.36.
- GObject.type_init()[source]¶
This function used to initialise the type system. Since GLib 2.36, the type system is initialised automatically and this function does nothing.
Deprecated since version 2.36: the type system is now initialised automatically
- GObject.type_init_with_debug_flags(debug_flags)[source]¶
- Parameters:
debug_flags (
GObject.TypeDebugFlags) – bitwise combination ofGObject.TypeDebugFlagsvalues for debugging purposes
This function used to initialise the type system with debugging flags. Since GLib 2.36, the type system is initialised automatically and this function does nothing.
If you need to enable debugging features, use the
GOBJECT_DEBUGenvironment variable.Deprecated since version 2.36: the type system is now initialised automatically
- GObject.type_interface_add_prerequisite(interface_type, prerequisite_type)[source]¶
- Parameters:
interface_type (
GObject.GType) –GObject.GTypevalue of an interface typeprerequisite_type (
GObject.GType) –GObject.GTypevalue of an interface or instantiatable type
Adds prerequisite_type to the list of prerequisites of interface_type. This means that any type implementing interface_type must also implement prerequisite_type. Prerequisites can be thought of as an alternative to interface derivation (which
GObject.GTypedoesn’t support). An interface can have at most one instantiatable prerequisite type.
- GObject.type_interface_get_plugin(instance_type, interface_type)[source]¶
- Parameters:
instance_type (
GObject.GType) –GObject.GTypeof an instantiatable typeinterface_type (
GObject.GType) –GObject.GTypeof an interface type
- Returns:
the
GObject.TypePluginfor the dynamic interface interface_type of instance_type- Return type:
Returns the
GObject.TypePluginstructure for the dynamic interface interface_type which has been added to instance_type, orNoneif interface_type has not been added to instance_type or does not have aGObject.TypePluginstructure. SeeGObject.type_add_interface_dynamic().
- GObject.type_interface_instantiatable_prerequisite(interface_type)[source]¶
- Parameters:
interface_type (
GObject.GType) – an interface type- Returns:
the instantiatable prerequisite type or
GObject.TYPE_INVALIDif none- Return type:
Returns the most specific instantiatable prerequisite of an interface type. If the interface type has no instantiatable prerequisite,
GObject.TYPE_INVALIDis returned.See
GObject.TypeInterface.add_prerequisite() for more information about prerequisites.New in version 2.68.
- GObject.type_interface_peek(instance_class, iface_type)[source]¶
- Parameters:
instance_class (
GObject.TypeClass) – aGObject.TypeClassstructureiface_type (
GObject.GType) – an interface ID which this class conforms to
- Returns:
the
GObject.TypeInterfacestructure of iface_type if implemented by instance_class,Noneotherwise- Return type:
Returns the
GObject.TypeInterfacestructure of an interface to which the passed in class conforms.
- GObject.type_interface_prerequisites(interface_type)[source]¶
- Parameters:
interface_type (
GObject.GType) – an interface type- Returns:
a newly-allocated zero-terminated array of
GObject.GTypecontaining the prerequisites of interface_type- Return type:
Returns the prerequisites of an interfaces type.
New in version 2.2.
- GObject.type_interfaces(type)[source]¶
- Parameters:
type (
GObject.GType) – the type to list interface types for- Returns:
Newly allocated and 0-terminated array of interface types, free with
GLib.free()- Return type:
Return a newly allocated and 0-terminated array of type IDs, listing the interface types that type conforms to.
- GObject.type_is_a(type, is_a_type)[source]¶
- Parameters:
type (
GObject.GType) – type to check ancestry foris_a_type (
GObject.GType) – possible ancestor of type or interface that type could conform to
- Returns:
Trueif type is a is_a_type- Return type:
If is_a_type is a derivable type, check whether type is a descendant of is_a_type. If is_a_type is an interface, check whether type conforms to it.
- GObject.type_name(type)[source]¶
- Parameters:
type (
GObject.GType) – type to return name for- Returns:
static type name or
None- Return type:
Get the unique name that is assigned to a type ID.
Note that this function (like all other
GObject.GTypeAPI) cannot cope with invalid type IDs.GObject.TYPE_INVALIDmay be passed to this function, as may be any other validly registered type ID, but randomized type IDs should not be passed in and will most likely lead to a crash.
- GObject.type_name_from_class(g_class)[source]¶
- Parameters:
g_class (
GObject.TypeClass) –- Return type:
- GObject.type_name_from_instance(instance)[source]¶
- Parameters:
instance (
GObject.TypeInstance) –- Return type:
- GObject.type_next_base(leaf_type, root_type)[source]¶
- Parameters:
leaf_type (
GObject.GType) – descendant of root_type and the type to be returnedroot_type (
GObject.GType) – immediate parent of the returned type
- Returns:
immediate child of root_type and ancestor of leaf_type
- Return type:
Given a leaf_type and a root_type which is contained in its ancestry, return the type that root_type is the immediate parent of. In other words, this function determines the type that is derived directly from root_type which is also a base class of leaf_type. Given a root type and a leaf type, this function can be used to determine the types and order in which the leaf type is descended from the root type.
- GObject.type_parent(type)[source]¶
- Parameters:
type (
GObject.GType) – the derived type- Returns:
the parent type
- Return type:
Return the direct parent type of the passed in type. If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.
- GObject.type_qname(type)[source]¶
- Parameters:
type (
GObject.GType) – type to return quark of type name for- Returns:
the type names quark or 0
- Return type:
Get the corresponding quark of the type IDs name.
- GObject.type_query(type)[source]¶
- Parameters:
type (
GObject.GType) –GObject.GTypeof a static, classed type- Returns:
a user provided structure that is filled in with constant values upon success
- Return type:
query:
GObject.TypeQuery
Queries the type system for information about a specific type.
This function will fill in a user-provided structure to hold type-specific information. If an invalid
GObject.GTypeis passed in, the type member of theGObject.TypeQueryis 0. All members filled into theGObject.TypeQuerystructure should be considered constant and have to be left untouched.Since GLib 2.78, this function allows queries on dynamic types. Previously it only supported static types.
- GObject.type_register(class_)¶
- Parameters:
class – a Python class that is a descendant of
GObject.Object
The GObject.type_register() function registers the specified Python class as a GObject type. class_ must be a descendant of GObject.Object. The function generates a name for the new type.
- GObject.type_register_dynamic(parent_type, type_name, plugin, flags)[source]¶
- Parameters:
parent_type (
GObject.GType) – type from which this type will be derivedtype_name (
str) – 0-terminated string used as the name of the new typeplugin (
GObject.TypePlugin) –GObject.TypePluginstructure to retrieve theGObject.TypeInfofromflags (
GObject.TypeFlags) – bitwise combination ofGObject.TypeFlagsvalues
- Returns:
the new type identifier or
GObject.TYPE_INVALIDif registration failed- Return type:
Registers type_name as the name of a new dynamic type derived from parent_type. The type system uses the information contained in the
GObject.TypePluginstructure pointed to by plugin to manage the type and its instances (if not abstract). The value of flags determines the nature (e.g. abstract or not) of the type.
- GObject.type_register_fundamental(type_id, type_name, info, finfo, flags)[source]¶
- Parameters:
type_id (
GObject.GType) – a predefined type identifiertype_name (
str) – 0-terminated string used as the name of the new typeinfo (
GObject.TypeInfo) –GObject.TypeInfostructure for this typefinfo (
GObject.TypeFundamentalInfo) –GObject.TypeFundamentalInfostructure for this typeflags (
GObject.TypeFlags) – bitwise combination ofGObject.TypeFlagsvalues
- Returns:
the predefined type identifier
- Return type:
Registers type_id as the predefined identifier and type_name as the name of a fundamental type. If type_id is already registered, or a type named type_name is already registered, the behaviour is undefined. The type system uses the information contained in the
GObject.TypeInfostructure pointed to by info and theGObject.TypeFundamentalInfostructure pointed to by finfo to manage the type and its instances. The value of flags determines additional characteristics of the fundamental type.
- GObject.type_register_static(parent_type, type_name, info, flags)[source]¶
- Parameters:
parent_type (
GObject.GType) – type from which this type will be derivedtype_name (
str) – 0-terminated string used as the name of the new typeinfo (
GObject.TypeInfo) –GObject.TypeInfostructure for this typeflags (
GObject.TypeFlags) – bitwise combination ofGObject.TypeFlagsvalues
- Returns:
the new type identifier
- Return type:
Registers type_name as the name of a new static type derived from parent_type. The type system uses the information contained in the
GObject.TypeInfostructure pointed to by info to manage the type and its instances (if not abstract). The value of flags determines the nature (e.g. abstract or not) of the type.
- GObject.type_set_qdata(type, quark, data)[source]¶
- Parameters:
type (
GObject.GType) – aGObject.GTypequark (
int) – a #GQuark id to identify the data
Attaches arbitrary data to a type.
- GObject.type_test_flags(type, flags)[source]¶
- Parameters:
type (
GObject.GType) –flags (
int) –
- Return type:
- GObject.value_type_compatible(src_type, dest_type)[source]¶
- Parameters:
src_type (
GObject.GType) – source type to be copied.dest_type (
GObject.GType) – destination type for copying.
- Returns:
TrueifGObject.Value.copy() is possible with src_type and dest_type.- Return type:
Returns whether a
GObject.Valueof type src_type can be copied into aGObject.Valueof type dest_type.
- GObject.value_type_transformable(src_type, dest_type)[source]¶
- Parameters:
src_type (
GObject.GType) – Source type.dest_type (
GObject.GType) – Target type.
- Returns:
- Return type:
Check whether
GObject.Value.transform() is able to transform values of type src_type into values of type dest_type. Note that for the types to be transformable, they must be compatible or a transformation function must be registered.