GIRepository.Repository¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class GIRepository.Repository(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GIRepository.Repository
is used to manage repositories of namespaces. Namespaces are represented on disk by type libraries (.typelib files).### Discovery of type libraries
GIRepository.Repository
will typically look for agirepository-1.0
directory under the library directory used when compiling gobject-introspection.It is possible to control the search paths programmatically, using
GIRepository.Repository.prepend_search_path
(). It is also possible to modify the search paths by using theGI_TYPELIB_PATH
environment variable. The environment variable takes precedence over the default search path and theGIRepository.Repository.prepend_search_path
() calls.- classmethod get_default()¶
- Returns:
The global singleton
GIRepository.Repository
- Return type:
Returns the singleton process-global default
GIRepository.Repository
. It is not currently supported to have multiple repositories in a particular process, but this function is provided in the unlikely eventuality that it would become possible, and as a convenience for higher level language bindings to conform to theGObject.Object
method call conventions.All methods on
GIRepository.Repository
also acceptNone
as an instance parameter to mean this default repository, which is usually more convenient for C.
- classmethod get_option_group()¶
- Returns:
the option group
- Return type:
Obtain the option group for girepository, it’s used by the dumper and for programs that wants to provide introspection information
- classmethod get_search_path()¶
- Returns:
GLib.SList
of strings- Return type:
[
str
]
Returns the current search path
GIRepository.Repository
will use when loading typelib files. The list is internal toGIRepository.Repository
and should not be freed, nor should its string elements.
- classmethod prepend_search_path(directory)¶
- Parameters:
directory (
str
) – directory name to prepend to the typelib search path
Prepends directory to the typelib search path.
See also:
GIRepository.Repository.get_search_path
().
- enumerate_versions(namespace_)¶
- Parameters:
namespace (
str
) – GI namespace, e.g. “Gtk”- Returns:
the array of versions.
- Return type:
[
str
]
Obtain an unordered list of versions (either currently loaded or available) for namespace_ in this self.
- find_by_error_domain(domain)¶
- Parameters:
domain (
int
) – aGLib.Error
domain- Returns:
#GIEnumInfo representing metadata about domain's enum type, or
None
- Return type:
Searches for the enum type corresponding to the given
GLib.Error
domain. Before calling this function for a particular namespace, you must callGIRepository.Repository.require
() once to load the namespace, or otherwise ensure the namespace has already been loaded.New in version 1.30.
- find_by_gtype(gtype)¶
- Parameters:
gtype (
GObject.GType
) –GObject.GType
to search for- Returns:
GIRepository.BaseInfo
representing metadata about type, orNone
- Return type:
Searches all loaded namespaces for a particular
GObject.GType
. Note that in order to locate the metadata, the namespace corresponding to the type must first have been loaded. There is currently no mechanism for determining the namespace which corresponds to an arbitraryGObject.GType
- thus, this function will operate most reliably when you know theGObject.GType
to originate from be from a loaded namespace.
- find_by_name(namespace_, name)¶
- Parameters:
- Returns:
GIRepository.BaseInfo
representing metadata about name, orNone
- Return type:
Searches for a particular entry in a namespace. Before calling this function for a particular namespace, you must call
GIRepository.Repository.require
() once to load the namespace, or otherwise ensure the namespace has already been loaded.
- get_c_prefix(namespace_)¶
- Parameters:
namespace (
str
) – Namespace to inspect- Returns:
C namespace prefix, or
None
if none associated- Return type:
This function returns the “C prefix”, or the C level namespace associated with the given introspection namespace. Each C symbol starts with this prefix, as well each
GObject.GType
in the library.Note: The namespace must have already been loaded using a function such as
GIRepository.Repository.require
() before calling this function.
- get_dependencies(namespace_)¶
- Parameters:
namespace (
str
) – Namespace of interest- Returns:
all versioned dependencies
- Return type:
[
str
]
Retrieves all (transitive) versioned dependencies for namespace_.
The strings are of the form
namespace-version
.Note: namespace_ must have already been loaded using a function such as
GIRepository.Repository.require
() before calling this function.To get only the immediate dependencies for namespace_, use
GIRepository.Repository.get_immediate_dependencies
().
- get_immediate_dependencies(namespace_)¶
- Parameters:
namespace (
str
) – Namespace of interest- Returns:
Zero-terminated string array of immediate versioned dependencies
- Return type:
[
str
]
Return an array of the immediate versioned dependencies for namespace_. Returned strings are of the form
namespace-version
.Note: namespace_ must have already been loaded using a function such as
GIRepository.Repository.require
() before calling this function.To get the transitive closure of dependencies for namespace_, use
GIRepository.Repository.get_dependencies
().New in version 1.44.
- get_info(namespace_, index)¶
- Parameters:
- Returns:
GIRepository.BaseInfo
containing metadata- Return type:
This function returns a particular metadata entry in the given namespace namespace_. The namespace must have already been loaded before calling this function. See
GIRepository.Repository.get_n_infos
() to find the maximum number of entries.
- get_loaded_namespaces()¶
- Returns:
List of namespaces
- Return type:
[
str
]
Return the list of currently loaded namespaces.
- get_n_infos(namespace_)¶
- Parameters:
namespace (
str
) – Namespace to inspect- Returns:
number of metadata entries
- Return type:
This function returns the number of metadata entries in given namespace namespace_. The namespace must have already been loaded before calling this function.
- get_object_gtype_interfaces(gtype)¶
- Parameters:
gtype (
GObject.GType
) – aGObject.GType
whose fundamental type isGObject.TYPE_OBJECT
- Returns:
Interfaces for gtype
- Return type:
interfaces_out: [
GIRepository.BaseInfo
]
Look up the implemented interfaces for gtype. This function cannot fail per se; but for a totally “unknown”
GObject.GType
, it may return 0 implemented interfaces.The semantics of this function are designed for a dynamic binding, where in certain cases (such as a function which returns an interface which may have “hidden” implementation classes), not all data may be statically known, and will have to be determined from the
GObject.GType
of the object. An example is g_file_new_for_path() returning a concrete class of #GLocalFile, which is aGObject.GType
we see at runtime, but not statically.New in version 1.62.
- Parameters:
namespace (
str
) – Namespace to inspect- Returns:
Comma-separated list of paths to shared libraries, or
None
if none are associated- Return type:
This function returns a comma-separated list of paths to the shared C libraries associated with the given namespace namespace_. There may be no shared library path associated, in which case this function will return
None
.Note: The namespace must have already been loaded using a function such as
GIRepository.Repository.require
() before calling this function.
- get_typelib_path(namespace_)¶
- Parameters:
namespace (
str
) – GI namespace to use, e.g. “Gtk”- Returns:
Filesystem path (or $lt;builtin$gt;) if successful,
None
if namespace is not loaded- Return type:
If namespace namespace_ is loaded, return the full path to the .typelib file it was loaded from. If the typelib for namespace namespace_ was included in a shared library, return the special string “<builtin>”.
- get_version(namespace_)¶
-
This function returns the loaded version associated with the given namespace namespace_.
Note: The namespace must have already been loaded using a function such as
GIRepository.Repository.require
() before calling this function.
- is_registered(namespace_, version)¶
- Parameters:
- Returns:
- Return type:
Check whether a particular namespace (and optionally, a specific version thereof) is currently loaded. This function is likely to only be useful in unusual circumstances; in order to act upon metadata in the namespace, you should call
GIRepository.Repository.require
() instead which will ensure the namespace is loaded, and return as quickly as this function will if it has already been loaded.
- load_typelib(typelib, flags)¶
- Parameters:
typelib (
GIRepository.Typelib
) – TODOflags (
GIRepository.RepositoryLoadFlags
) – TODO
- Raises:
- Return type:
TODO
- require(namespace_, version, flags)¶
- Parameters:
namespace (
str
) – GI namespace to use, e.g. “Gtk”version (
str
orNone
) – Version of namespace, may beNone
for latestflags (
GIRepository.RepositoryLoadFlags
) – Set ofGIRepository.RepositoryLoadFlags
, may be 0
- Raises:
- Returns:
a pointer to the
GIRepository.Typelib
if successful,None
otherwise- Return type:
Force the namespace namespace_ to be loaded if it isn’t already. If namespace_ is not loaded, this function will search for a “.typelib” file using the repository search path. In addition, a version version of namespace may be specified. If version is not specified, the latest will be used.
- require_private(typelib_dir, namespace_, version, flags)¶
- Parameters:
typelib_dir (
str
) – Private directory where to find the requested typelibnamespace (
str
) – GI namespace to use, e.g. “Gtk”version (
str
orNone
) – Version of namespace, may beNone
for latestflags (
GIRepository.RepositoryLoadFlags
) – Set ofGIRepository.RepositoryLoadFlags
, may be 0
- Raises:
- Returns:
a pointer to the
GIRepository.Typelib
if successful,None
otherwise- Return type:
Force the namespace namespace_ to be loaded if it isn’t already. If namespace_ is not loaded, this function will search for a “.typelib” file within the private directory only. In addition, a version version of namespace should be specified. If version is not specified, the latest will be used.