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_HOOKS
flag 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_BOXED
derived type id for name.- Return type:
This function creates a new
GObject.TYPE_BOXED
derived 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function for use with signals with handlers that take aGObject.Object
and 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function for use with signals with a singleGObject.Object
argument.
- 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function for use with signals with a singleGLib.Variant
argument.
- 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – Additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
A
GObject.ClosureMarshal
function 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.Value
to store the return value. May beNone
if 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.Values
holding the arguments on which to invoke the callback of closure.invocation_hint (
object
orNone
) – The invocation hint given as the last argument toGObject.Closure.invoke
().marshal_data (
object
orNone
) – 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 aNone
marshaller.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 beNone
or 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.EnumValue
structs for the possible enumeration values. The array is terminated by a struct with all members being 0.
- Returns:
the
GObject.TypeInfo
struct to be filled in- Return type:
info:
GObject.TypeInfo
This function is meant to be called from the
complete_type_info
function of aGObject.TypePlugin
implementation, 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.EnumClass
value (
int
) – the value to look up
- Returns:
the
GObject.EnumValue
for value, orNone
if value is not a member of the enumeration- Return type:
Returns the
GObject.EnumValue
for a value.
- GObject.enum_get_value_by_name(enum_class, name)[source]¶
- Parameters:
enum_class (
GObject.EnumClass
) – aGObject.EnumClass
name (
str
) – the name to look up
- Returns:
the
GObject.EnumValue
with name name, orNone
if the enumeration doesn’t have a member with that name- Return type:
Looks up a
GObject.EnumValue
by name.
- GObject.enum_get_value_by_nick(enum_class, nick)[source]¶
- Parameters:
enum_class (
GObject.EnumClass
) – aGObject.EnumClass
nick (
str
) – the nickname to look up
- Returns:
the
GObject.EnumValue
with nickname nick, orNone
if the enumeration doesn’t have a member with that nickname- Return type:
Looks up a
GObject.EnumValue
by 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.EnumValue
structs for the possible enumeration values. The array is terminated by a struct with all members being 0.GObject.Object
keeps 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.EnumClass
typevalue (
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.FlagsValue
structs for the possible enumeration values. The array is terminated by a struct with all members being 0.
- Returns:
the
GObject.TypeInfo
struct 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.TypePlugin
implementation, see the example forGObject.enum_complete_type_info
() above.
- GObject.flags_get_first_value(flags_class, value)[source]¶
- Parameters:
flags_class (
GObject.FlagsClass
) – aGObject.FlagsClass
value (
int
) – the value
- Returns:
the first
GObject.FlagsValue
which is set in value, orNone
if none is set- Return type:
Returns the first
GObject.FlagsValue
which is set in value.
- GObject.flags_get_value_by_name(flags_class, name)[source]¶
- Parameters:
flags_class (
GObject.FlagsClass
) – aGObject.FlagsClass
name (
str
) – the name to look up
- Returns:
the
GObject.FlagsValue
with name name, orNone
if there is no flag with that name- Return type:
Looks up a
GObject.FlagsValue
by name.
- GObject.flags_get_value_by_nick(flags_class, nick)[source]¶
- Parameters:
flags_class (
GObject.FlagsClass
) – aGObject.FlagsClass
nick (
str
) – the nickname to look up
- Returns:
the
GObject.FlagsValue
with nickname nick, orNone
if there is no flag with that nickname- Return type:
Looks up a
GObject.FlagsValue
by 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.FlagsValue
structs for the possible flags values. The array is terminated by a struct with all members being 0.GObject.Object
keeps 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.FlagsClass
typevalue (
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.ParamSpecBoolean
instance specifying aGObject.TYPE_BOOLEAN
property. 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_BOXED
derived type of this propertyflags (
GObject.ParamFlags
) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecBoxed
instance specifying aGObject.TYPE_BOXED
derived 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.ParamSpecChar
instance specifying aGObject.TYPE_CHAR
property.
- 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.ParamSpecDouble
instance specifying aGObject.TYPE_DOUBLE
property.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.GType
derived fromGObject.TYPE_ENUM
default_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.ParamSpecEnum
instance specifying aGObject.TYPE_ENUM
property.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.GType
derived fromGObject.TYPE_FLAGS
default_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.ParamSpecFlags
instance specifying aGObject.TYPE_FLAGS
property.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.ParamSpecFloat
instance specifying aGObject.TYPE_FLOAT
property.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.GType
whose subtypes are allowed as values of the property (useGObject.TYPE_NONE
for any type)flags (
GObject.ParamFlags
) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecGType
instance specifying aGObject.TYPE_GTYPE
property.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.ParamSpecInt
instance specifying aGObject.TYPE_INT
property.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.ParamSpecInt64
instance specifying aGObject.TYPE_INT64
property.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.ParamSpecLong
instance specifying aGObject.TYPE_LONG
property.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_OBJECT
derived type of this propertyflags (
GObject.ParamFlags
) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecBoxed
instance specifying aGObject.TYPE_OBJECT
derived 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.GType
derived fromGObject.TYPE_PARAM
flags (
GObject.ParamFlags
) – flags for the property specified
- Returns:
a newly created parameter specification
- Return type:
Creates a new
GObject.ParamSpecParam
instance specifying aGObject.TYPE_PARAM
property.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.ParamSpecPointer
instance 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 (
str
orNone
) – 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.ParamSpecString
instance.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.ParamSpecUChar
instance specifying aGObject.TYPE_UCHAR
property.
- 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.ParamSpecUInt
instance specifying aGObject.TYPE_UINT
property.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.ParamSpecUInt64
instance specifying aGObject.TYPE_UINT64
property.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.ParamSpecULong
instance specifying aGObject.TYPE_ULONG
property.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.ParamSpecUnichar
instance specifying aGObject.TYPE_UINT
property.GObject.Value
structures 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.VariantType
default_value (
GLib.Variant
orNone
) – aGLib.Variant
of type type to use as the default value, orNone
flags (
GObject.ParamFlags
) – flags for the property specified
- Returns:
the newly created
GObject.ParamSpec
- Return type:
Creates a new
GObject.ParamSpecVariant
instance specifying aGLib.Variant
property.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.ParamSpec
type.pspec_info (
GObject.ParamSpecTypeInfo
) – TheGObject.ParamSpecTypeInfo
for thisGObject.ParamSpec
type.
- 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.ParamSpecTypeInfo
structure pointed to by info to manage theGObject.ParamSpec
type and its instances.
- GObject.param_value_convert(pspec, src_value, dest_value, strict_validation)[source]¶
- Parameters:
pspec (
GObject.ParamSpec
) – a validGObject.ParamSpec
src_value (
GObject.Value
) – sourceGObject.Value
dest_value (
GObject.Value
) – destinationGObject.Value
of correct type for pspecstrict_validation (
bool
) –True
requires dest_value to conform to pspec without modifications
- Returns:
True
if transformation and validation were successful,False
otherwise 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
True
this 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.ParamSpec
value (
GObject.Value
) – aGObject.Value
of 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.ParamSpec
value (
GObject.Value
) – aGObject.Value
of 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.ParamSpec
value (
GObject.Value
) – aGObject.Value
of 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.ParamSpec
value (
GObject.Value
) – aGObject.Value
of 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.ParamSpecInt
might 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.ParamSpec
value1 (
GObject.Value
) – aGObject.Value
of correct type for pspecvalue2 (
GObject.Value
) – aGObject.Value
of 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_POINTER
derived type id for name.- Return type:
Creates a new
GObject.TYPE_POINTER
derived type id for a new pointer type with name name.
- GObject.remove_emission_hook(obj, detailed_signal, hook_id)¶
- GObject.signal_accumulator_first_wins(ihint, return_accu, handler_return, dummy)[source]¶
- Parameters:
ihint (
GObject.SignalInvocationHint
) – standardGObject.SignalAccumulator
parameterreturn_accu (
GObject.Value
) – standardGObject.SignalAccumulator
parameterhandler_return (
GObject.Value
) – standardGObject.SignalAccumulator
parameterdummy (
object
orNone
) – standardGObject.SignalAccumulator
parameter
- Returns:
standard
GObject.SignalAccumulator
result- Return type:
A predefined
GObject.SignalAccumulator
for 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.SignalAccumulator
parameterreturn_accu (
GObject.Value
) – standardGObject.SignalAccumulator
parameterhandler_return (
GObject.Value
) – standardGObject.SignalAccumulator
parameterdummy (
object
orNone
) – standardGObject.SignalAccumulator
parameter
- Returns:
standard
GObject.SignalAccumulator
result- Return type:
A predefined
GObject.SignalAccumulator
for signals that return a boolean values. The behavior that this accumulator gives is that a return ofTrue
stops the signal emission: no further callbacks will be invoked, while a return ofFalse
allows the emission to continue. The idea here is that aTrue
return 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.SignalEmissionHook
function.
- 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_HOOKS
flag 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.Value
for 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 doesn’t exist, a critical warning is emitted.
- 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 doesn’t exist, a critical warning is emitted.
- 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.Value
for 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
None
if 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.Closure
orNone
) – The closure the handler will invoke.func (
object
orNone
) – The C closure callback of the handler (useless for non-C closures).data (
object
orNone
) – 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.SignalMatchType
flags, 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.Closure
orNone
) – The closure the handlers will invoke.func (
object
orNone
) – The C closure callback of the handlers (useless for non-C closures).data (
object
orNone
) – 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.SignalMatchType
flags, 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.FUNC
orGObject.SignalMatchType.DATA
match flags is required for successful matches. If no handlers were found, 0 is returned, the number of blocked handlers otherwise.Support for
GObject.SignalMatchType.ID
was 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.Object
dispose 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.Closure
orNone
) – The closure the handlers will invoke.func (
object
orNone
) – The C closure callback of the handlers (useless for non-C closures).data (
object
orNone
) – 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.SignalMatchType
flags, 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.FUNC
orGObject.SignalMatchType.DATA
match flags is required for successful matches. If no handlers were found, 0 is returned, the number of disconnected handlers otherwise.Support for
GObject.SignalMatchType.ID
was 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.Closure
orNone
) – The closure the handlers will invoke.func (
object
orNone
) – The C closure callback of the handlers (useless for non-C closures).data (
object
orNone
) – 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.SignalMatchType
flags, 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.FUNC
orGObject.SignalMatchType.DATA
match 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.ID
was 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:
True
if a handler is connected to the signal,False
otherwise.- 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 canonical parameter names 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
None
if 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.Window
type called “my-signal” that calls a handler with aGtk.Button
widget 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_newv(signal_name, itype, signal_flags, class_closure, accumulator, accu_data, c_marshaller, return_type, param_types)[source]¶
- Parameters:
signal_name (
str
) – the name for the signalitype (
GObject.GType
) – the type this signal pertains to. It will also pertain to types which are derived from this typesignal_flags (
GObject.SignalFlags
) – a combination ofGObject.SignalFlags
specifying detail of when the default handler is to be invoked. You should at least specifyGObject.SignalFlags.RUN_FIRST
orGObject.SignalFlags.RUN_LAST
class_closure (
GObject.Closure
orNone
) – The closure to invoke on signal emission; may beNone
accumulator (
GObject.SignalAccumulator
orNone
) – the accumulator for this signal; may beNone
c_marshaller (
GObject.ClosureMarshal
orNone
) – the function to translate arrays of parameter values to signal emissions into C language callback invocations orNone
return_type (
GObject.GType
) – the type of return value, orGObject.TYPE_NONE
for a signal without a return valueparam_types ([
GObject.GType
] orNone
) – an array of types, one for each parameter (may beNone
if n_params is zero)
- Returns:
the signal id
- Return type:
Creates a new signal. (This is usually done in the class initializer.)
See
GObject.signal_new
() for details on allowed signal names.If c_marshaller is
None
,GObject.CClosure.marshal_generic
() will be used as the marshaller for this signal.
- 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.SignalQuery
is 0. All members filled into theGObject.SignalQuery
structure 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_LAST
and 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.GType
identifier 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.SourceFuncs
structure 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
bool
return value, it will returnTrue
. (If the source expects any other type of return value, it will return a 0/None
value; whateverGObject.Value.init
() initializes aGObject.Value
to for that type.)If the source is not one of the standard GLib types, the closure_callback and closure_marshal fields of the
GLib.SourceFuncs
structure must have been filled in with pointers to appropriate functions.
- GObject.strdup_value_contents(value)[source]¶
- Parameters:
value (
GObject.Value
) –GObject.Value
which 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.Value
contents 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.GType
of 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.GType
value of an instantiatable typeinterface_type (
GObject.GType
) –GObject.GType
value of an interface typeplugin (
GObject.TypePlugin
) –GObject.TypePlugin
structure to retrieve theGObject.InterfaceInfo
from
Adds interface_type to the dynamic instance_type. The information contained in the
GObject.TypePlugin
structure 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.GType
value of an instantiatable typeinterface_type (
GObject.GType
) –GObject.GType
value of an interface typeinfo (
GObject.InterfaceInfo
) –GObject.InterfaceInfo
structure for this (instance_type, interface_type) combination
Adds interface_type to the static instance_type. The information contained in the
GObject.InterfaceInfo
structure 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.TypeInstance
structure- 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_peek(type)[source]¶
- Parameters:
type (
GObject.GType
) – type ID of a classed type- Returns:
the
GObject.TypeClass
structure for the given type ID orNone
if the class does not currently exist- Return type:
This function is essentially the same as
GObject.TypeClass.ref
(), except that the classes reference count isn’t incremented. As a consequence, this function may returnNone
if 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.TypeClass
structure for the given type ID orNone
if 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.TypeClass
structure 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.
- GObject.type_default_interface_peek(g_type)[source]¶
- Parameters:
g_type (
GObject.GType
) – an interface type- Returns:
the default vtable for the interface, or
None
if 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.
- 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.
- 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-count
debug flag is set (by setting theGOBJECT_DEBUG
variable to includeinstance-count
).New in version 2.44.
- GObject.type_get_plugin(type)[source]¶
- Parameters:
type (
GObject.GType
) –GObject.GType
to retrieve the plugin for- Returns:
the corresponding plugin if type is a dynamic type,
None
otherwise- Return type:
Returns the
GObject.TypePlugin
structure for type.
- GObject.type_get_qdata(type, quark)[source]¶
- Parameters:
type (
GObject.GType
) – aGObject.GType
quark (
int
) – a #GQuark id to identify the data
- Returns:
the data, or
None
if 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.TypeDebugFlags
values 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_DEBUG
environment 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.GType
value of an interface typeprerequisite_type (
GObject.GType
) –GObject.GType
value 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.GType
doesn’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.GType
of an instantiatable typeinterface_type (
GObject.GType
) –GObject.GType
of an interface type
- Returns:
the
GObject.TypePlugin
for the dynamic interface interface_type of instance_type- Return type:
Returns the
GObject.TypePlugin
structure for the dynamic interface interface_type which has been added to instance_type, orNone
if interface_type has not been added to instance_type or does not have aGObject.TypePlugin
structure. 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_INVALID
if none- Return type:
Returns the most specific instantiatable prerequisite of an interface type. If the interface type has no instantiatable prerequisite,
GObject.TYPE_INVALID
is 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.TypeClass
structureiface_type (
GObject.GType
) – an interface ID which this class conforms to
- Returns:
the
GObject.TypeInterface
structure of iface_type if implemented by instance_class,None
otherwise- Return type:
Returns the
GObject.TypeInterface
structure 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.GType
containing 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:
True
if 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.GType
API) cannot cope with invalid type IDs.GObject.TYPE_INVALID
may 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.GType
of 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.GType
is passed in, the type member of theGObject.TypeQuery
is 0. All members filled into theGObject.TypeQuery
structure 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.TypePlugin
structure to retrieve theGObject.TypeInfo
fromflags (
GObject.TypeFlags
) – bitwise combination ofGObject.TypeFlags
values
- Returns:
the new type identifier or
GObject.TYPE_INVALID
if 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.TypePlugin
structure 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.TypeInfo
structure for this typefinfo (
GObject.TypeFundamentalInfo
) –GObject.TypeFundamentalInfo
structure for this typeflags (
GObject.TypeFlags
) – bitwise combination ofGObject.TypeFlags
values
- 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.TypeInfo
structure pointed to by info and theGObject.TypeFundamentalInfo
structure 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.TypeInfo
structure for this typeflags (
GObject.TypeFlags
) – bitwise combination ofGObject.TypeFlags
values
- 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.TypeInfo
structure 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.GType
quark (
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:
True
ifGObject.Value.copy
() is possible with src_type and dest_type.- Return type:
Returns whether a
GObject.Value
of type src_type can be copied into aGObject.Value
of 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.