Clutter.Script¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
The path of the currently parsed file |
||
r |
Whether the |
||
r/w |
The translation domain used to localize string |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Clutter.Script(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
Clutter.Script
structure contains only private data and should be accessed using the provided APINew in version 0.6.
- classmethod new()¶
- Returns:
the newly created
Clutter.Script
instance. UseGObject.Object.unref
() when done.- Return type:
Creates a new
Clutter.Script
instance.Clutter.Script
can be used to load objects definitions for scenegraph elements, like actors, or behavioural elements, like behaviours and timelines. The definitions must be encoded using the JavaScript Object Notation (JSON) language.New in version 0.6.
- add_search_paths(paths)¶
- Parameters:
paths ([
str
]) – an array of strings containing different search paths
Adds paths to the list of search paths held by self.
The search paths are used by
Clutter.Script.lookup_filename
(), which can be used to define search paths for the textures source file name or other custom, file-based properties.New in version 0.8.
- add_states(name, state)¶
- Parameters:
name (
str
orNone
) – a name for the state, orNone
to set the defaultClutter.State
state (
Clutter.State
) – aClutter.State
Associates a
Clutter.State
to theClutter.Script
instance using the given name.The
Clutter.Script
instance will use state to resolve target states when connecting signal handlers.The
Clutter.Script
instance will take a reference on theClutter.State
passed to this function.New in version 1.8.
Deprecated since version 1.12.
- connect_signals(user_data)¶
-
Connects all the signals defined into a UI definition file to their handlers.
This method invokes
Clutter.Script.connect_signals_full
() internally and usesGModule.Module
's introspective features (by opening the current module’s scope) to look at the application’s symbol table.Note that this function will not work if
GModule.Module
is not supported by the platform Clutter is running on.New in version 0.6.
- connect_signals_full(func, *user_data)¶
- Parameters:
func (
Clutter.ScriptConnectFunc
) – signal connection functionuser_data (
object
orNone
) – data to be passed to the signal handlers, orNone
Connects all the signals defined into a UI definition file to their handlers.
This function allows to control how the signal handlers are going to be connected to their respective signals. It is meant primarily for language bindings to allow resolving the function names using the native API, but it can also be used on platforms that do not support
GModule.Module
.Applications should use
Clutter.Script.connect_signals
().New in version 0.6.
- ensure_objects()¶
Ensure that every object defined inside self is correctly constructed. You should rarely need to use this function.
New in version 0.6.
- get_object(name)¶
- Parameters:
name (
str
) – the name of the object to retrieve- Returns:
the named object, or
None
if no object with the given name was available- Return type:
Retrieves the object bound to name. This function does not increment the reference count of the returned object.
New in version 0.6.
- get_states(name)¶
- Parameters:
name (
str
orNone
) – the name of theClutter.State
, orNone
- Returns:
a pointer to the
Clutter.State
for the given name. TheClutter.State
is owned by theClutter.Script
instance and it should not be unreferenced- Return type:
Retrieves the
Clutter.State
for the given state_name.If name is
None
, this function will return the defaultClutter.State
instance.New in version 1.8.
Deprecated since version 1.12.
- get_translation_domain()¶
-
Retrieves the translation domain set using
Clutter.Script.set_translation_domain
().New in version 1.10.
- get_type_from_name(type_name)¶
- Parameters:
type_name (
str
) – name of the type to look up- Returns:
the type for the requested type name, or
GObject.TYPE_INVALID
if not corresponding type was found.- Return type:
Looks up a type by name, using the virtual function that
Clutter.Script
has for that purpose. This function should rarely be used.New in version 0.6.
- list_objects()¶
- Returns:
a list of
GObject.Object
s, orNone
. The objects are owned by theClutter.Script
instance. Use g_list_free() on the returned list when done.- Return type:
Retrieves all the objects created by self.
Note: this function does not increment the reference count of the objects it returns.
New in version 0.8.
- load_from_data(data, length)¶
- Parameters:
- Raises:
- Returns:
on error, zero is returned and error is set accordingly. On success, the merge id for the UI definitions is returned. You can use the merge id with
Clutter.Script.unmerge_objects
().- Return type:
Loads the definitions from data into self and merges with the currently loaded ones, if any.
New in version 0.6.
- load_from_file(filename)¶
- Parameters:
filename (
str
) – the full path to the definition file- Raises:
- Returns:
on error, zero is returned and error is set accordingly. On success, the merge id for the UI definitions is returned. You can use the merge id with
Clutter.Script.unmerge_objects
().- Return type:
Loads the definitions from filename into self and merges with the currently loaded ones, if any.
New in version 0.6.
- load_from_resource(resource_path)¶
- Parameters:
resource_path (
str
) – the resource path of the file to parse- Raises:
- Returns:
on error, zero is returned and error is set accordingly. On success, the merge id for the UI definitions is returned. You can use the merge id with
Clutter.Script.unmerge_objects
().- Return type:
Loads the definitions from a resource file into self and merges with the currently loaded ones, if any.
New in version 1.10.
- lookup_filename(filename)¶
- Parameters:
filename (
str
) – the name of the file to lookup- Returns:
the full path of filename or
None
if no path was found.- Return type:
Looks up filename inside the search paths of self. If filename is found, its full path will be returned .
New in version 0.8.
- set_translation_domain(domain)¶
-
Sets the translation domain for self.
New in version 1.10.
- unmerge_objects(merge_id)¶
- Parameters:
merge_id (
int
) – merge id returned when loading a UI definition
Unmerges the objects identified by merge_id.
New in version 0.6.
- do_get_type_from_name(type_name) virtual¶
- Parameters:
type_name (
str
) – name of the type to look up- Returns:
the type for the requested type name, or
GObject.TYPE_INVALID
if not corresponding type was found.- Return type:
Looks up a type by name, using the virtual function that
Clutter.Script
has for that purpose. This function should rarely be used.New in version 0.6.
Property Details¶
- Clutter.Script.props.filename¶
-
The path of the currently parsed file. If
Clutter.Script
:filename-set
isFalse
then the value of this property is undefined.New in version 0.6.
- Clutter.Script.props.filename_set¶
-
Whether the
Clutter.Script
:filename
property is set. If this property isTrue
then the currently parsed data comes from a file, and the file name is stored inside theClutter.Script
:filename
property.New in version 0.6.
- Clutter.Script.props.translation_domain¶
-
The translation domain, used to localize strings marked as translatable inside a UI definition.
If
Clutter.Script
:translation-domain
is set toNone
,Clutter.Script
will use gettext(), otherwiseGLib.dgettext
() will be used.New in version 1.10.