AppStream.Pool¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class AppStream.Pool(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Returns:
- Return type:
Creates a new
AppStream.Pool
.
- add_components(cbox)¶
- Parameters:
cbox (
AppStream.ComponentBox
) – Components to add to the pool.- Raises:
- Returns:
True
if the new components were successfully added to the pool.- Return type:
Register a set of components with the pool temporarily. Data from components added like this will not be cached.
New in version 0.15.0.
- add_extra_data_location(directory, format_style)¶
- Parameters:
directory (
str
) – An existing filesystem location.format_style (
AppStream.FormatStyle
) – The expected format style of the metadata, e.g.AppStream.FormatStyle.CATALOG
Add an additional non-standard location to the metadata pool where metadata will be read from. If directory contains a “xml”, “xmls”, “yaml” or “icons” subdirectory (or all of them), those paths will be added to the search paths instead.
- add_flags(flags)¶
- Parameters:
flags (
AppStream.PoolFlags
) – TheAppStream.PoolFlags
to add.
Convenience function to add one or multiple
AppStream.PoolFlags
to the flag set of this data pool.New in version 0.15.0.
- build_search_tokens(search)¶
- Parameters:
search (
str
) – the (user-provided) search phrase.- Returns:
(array zero-terminated=1): Valid tokens to search for, or
None
for error- Return type:
[
str
]
Splits up a string into an array of tokens that are suitable for searching. This includes stripping whitespaces, casefolding the terms and removing greylist words.
This function is usually called automatically when needed, you will only need to run it explicitly when you need to check which search tokens the pool will actually use internally for a given phrase.
- clear()¶
Remove all metadata from the pool, data will be reloaded once
AppStream.Pool.load
is called again.
- get_components()¶
- Returns:
- Return type:
Get a list of found components.
- get_components_by_bundle_id(kind, bundle_id, match_prefix)¶
- Parameters:
kind (
AppStream.BundleKind
) – The kind of the bundle we are looking forbundle_id (
str
) – The bundle ID to match, as specified inAppStream.Bundle
match_prefix (
bool
) –True
to match the ID by prefix,False
to perform an absolute match.
- Returns:
- Return type:
Find components that are provided by a bundle with a specific ID by its prefix. For example, given a
AppStream.BundleKind.FLATPAK
and a bundle_id “org.kde.dolphin/”, it will list all the components that bundle dolphin. If the bundle_id is “org.kde.dolphin/x86_64” it will give those with also the architecture.New in version 0.16.0.
- get_components_by_categories(categories)¶
- Parameters:
categories ([
str
]) – An array of XDG categories to include.- Returns:
an
AppStream.ComponentBox
of found components.- Return type:
Return a list of components which are in all of the categories.
- get_components_by_extends(extended_id)¶
- Parameters:
extended_id (
str
) – The ID of the component to search extensions for.- Returns:
- Return type:
Find components extending the component with the given ID. They can then be registered to the
AppStream.Component
they extend viaAppStream.Component.add_addon
. If theAppStream.PoolFlags.RESOLVE_ADDONS
pool flag is set, addons are automatically resolved and this explicit function is not needed, but overall query time will be increased (so only use this flag if you will be resolving addon information later anyway).New in version 0.15.0.
- get_components_by_id(cid)¶
- Parameters:
cid (
str
) – The AppStream-ID to look for.- Returns:
- Return type:
Get a specific component by its ID. This function may contain multiple results if we have data describing this component from multiple scopes/origin types.
- get_components_by_kind(kind)¶
- Parameters:
kind (
AppStream.ComponentKind
) – AnAppStream.ComponentKind
.- Returns:
an
AppStream.ComponentBox
of found components.- Return type:
Return a list of all components in the pool which are of a certain kind.
- get_components_by_launchable(kind, id)¶
- Parameters:
kind (
AppStream.LaunchableKind
) – AnAppStream.LaunchableKind
id (
str
) – The ID of the launchable.
- Returns:
an
AppStream.ComponentBox
of found components.- Return type:
Find components in the AppStream data pool which provide a specific launchable. See
AppStream.Launchable
for details on launchables, or refer to the AppStream specification.New in version 0.11.4.
- get_components_by_provided_item(kind, item)¶
- Parameters:
kind (
AppStream.ProvidedKind
) – An #AsProvidesKinditem (
str
) – The value of the provided item.
- Returns:
an
AppStream.ComponentBox
of found components.- Return type:
Find components in the AppStream data pool which provide a certain item.
- get_flags()¶
- Return type:
Get the
AppStream.PoolFlags
for this data pool.
- get_locale()¶
- Returns:
Locale used for metadata parsing.
- Return type:
Gets the currently used locale.
- is_empty()¶
-
Check if this pool contains any data.
- load(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
.- Raises:
- Returns:
True
if update completed without error.- Return type:
Builds an index of all found components in the watched locations. The function will try to get as much data into the pool as possible, so even if the update completes with
False
, it might still have added components to the pool.The function will load from all possible data sources, preferring caches if they are up to date.
- load_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
.callback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
Asynchronously loads data from all registered locations. Equivalent to
AppStream.Pool.load
() (but asynchronous)New in version 0.12.10.
- load_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – AGio.AsyncResult
- Raises:
- Returns:
True
for success- Return type:
Retrieve the result of
AppStream.Pool.load_async
().New in version 0.12.10.
- remove_flags(flags)¶
- Parameters:
flags (
AppStream.PoolFlags
) – TheAppStream.PoolFlags
to remove.
Convenience function to remove one or multiple
AppStream.PoolFlags
from the flag set of this data pool.New in version 0.15.0.
- reset_extra_data_locations()¶
Remove all explicitly added metadata locations.
New in version 0.15.0.
- search(search)¶
- Parameters:
search (
str
) – A search string- Returns:
an
AppStream.ComponentBox
of the found components.- Return type:
Search for a list of components matching the search term. The list will be ordered by match score.
New in version 0.9.7.
- set_flags(flags)¶
- Parameters:
flags (
AppStream.PoolFlags
) – The newAppStream.PoolFlags
.
Set the
AppStream.PoolFlags
for this data pool.
- set_load_std_data_locations(enabled)¶
- Parameters:
enabled (
bool
) – Whether loading of data from standard locations should be enabled.
This is a convenience function that enables or disables loading of metadata from well-known standard locations by configuring the
AppStream.PoolFlags
of thisAppStream.Pool
accordingly. Data affected by this includes the OS data catalog, metainfo, desktop-entry files and Flatpak data. If you need more fine-grained control, set theAppStream.PoolFlags
explicitly.New in version 0.15.0.
- set_locale(locale)¶
- Parameters:
locale (
str
) – the BCP47 or POSIX locale to use for this pool.
Sets the current locale which should be used when parsing metadata.
- do_changed() virtual¶
Signal Details¶
- AppStream.Pool.signals.changed(pool)¶
- Signal Name:
changed
- Flags:
- Parameters:
pool (
AppStream.Pool
) – The object which received the signal
The
::changed
signal is emitted when components have been added or removed from the metadata pool.New in version 0.15.0.