AppStream.Component¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
categories |
||
r/w |
description |
||
r |
icons |
||
r/w |
id |
||
[ |
r/w |
keywords |
|
r/w |
kind |
||
r/w |
name |
||
[ |
r/w |
pkgnames |
|
r/w |
project-group |
||
r/w |
project-license |
||
r |
screenshots |
||
r/w |
summary |
||
r |
urls |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class AppStream.Component(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Returns:
a new
AppStream.Component
- Return type:
Creates a new
AppStream.Component
.
- add_addon(addon)¶
- Parameters:
addon (
AppStream.Component
) – TheAppStream.Component
that extends self
Add a reference to the addon that is enhancing this component.
New in version 0.9.2.
- add_agreement(agreement)¶
- Parameters:
agreement (
AppStream.Agreement
) – anAppStream.Agreement
instance.
Adds an agreement to the software component.
New in version 0.12.1.
- add_bundle(bundle)¶
- Parameters:
bundle (
AppStream.Bundle
) – TheAppStream.Bundle
to add.
Adds a bundle to the component.
New in version 0.8.0.
- add_content_rating(content_rating)¶
- Parameters:
content_rating (
AppStream.ContentRating
) – aAppStream.ContentRating
instance.
Adds a content rating to this component.
New in version 0.11.0.
- add_extends(cpt_id)¶
- Parameters:
cpt_id (
str
) – The id of a component which is extended by this component
Add a reference to the extended component
New in version 0.15.5.
- add_icon(icon)¶
- Parameters:
icon (
AppStream.Icon
) – the validAppStream.Icon
instance to add.
Add an icon to this component.
- add_keyword(keyword, locale)¶
- Parameters:
Add a new keyword to the keywords list for the given locale. This function does not check for duplicate keywords.
- add_language(locale, percentage)¶
- Parameters:
Adds a language to the component.
New in version 0.7.0.
- add_launchable(launchable)¶
- Parameters:
launchable (
AppStream.Launchable
) – aAppStream.Launchable
instance.
Adds a
AppStream.Launchable
containing launchables entries for this component.New in version 0.11.0.
- add_provided(prov)¶
- Parameters:
prov (
AppStream.Provided
) – aAppStream.Provided
instance.
Add a set of provided items to this component.
New in version 0.6.2.
- add_provided_item(kind, item)¶
- Parameters:
kind (
AppStream.ProvidedKind
) – the kind of the provided item (e.g.AppStream.ProvidedKind.MEDIATYPE
)item (
str
) – the item to add.
Adds a provided item to the component with the given kind, creating a new AsProvided for this kind internally if necessary.
- add_reference(reference)¶
- Parameters:
reference (
AppStream.Reference
) – anAppStream.Reference
instance.
Adds an external reference to the software component.
New in version 1.0.0.
- add_relation(relation)¶
- Parameters:
relation (
AppStream.Relation
) – aAppStream.Relation
instance.
Adds a
AppStream.Relation
to set a recommends or requires relation of component self on the item mentioned in theAppStream.Relation
.New in version 0.12.0.
- add_release(release)¶
- Parameters:
release (
AppStream.Release
) – TheAppStream.Release
to add
Add an
AppStream.Release
to this component.
- add_replaces(cid)¶
- Parameters:
cid (
str
) – an AppStream component ID
Add the component ID of a component that gets replaced by the current component.
- add_review(review)¶
- Parameters:
review (
AppStream.Review
) – aAppStream.Review
instance.
Adds a user review to a software component.
New in version 0.14.0.
- add_screenshot(sshot)¶
- Parameters:
sshot (
AppStream.Screenshot
) – TheAppStream.Screenshot
to add
Add an
AppStream.Screenshot
to this component.
- add_suggested(suggested)¶
- Parameters:
suggested (
AppStream.Suggested
) – TheAppStream.Suggested
Add an
AppStream.Suggested
to this component.
- add_tag(ns, tag)¶
- Parameters:
- Returns:
True
if the tag was added.- Return type:
Add a tag to this component.
New in version 0.15.0.
- add_translation(tr)¶
- Parameters:
tr (
AppStream.Translation
) – anAppStream.Translation
instance.
Assign an
AppStream.Translation
object describing the translation system used by this component.New in version 0.9.2.
- add_url(url_kind, url)¶
- Parameters:
url_kind (
AppStream.UrlKind
) – the URL kind, e.g.AppStream.UrlKind.HOMEPAGE
url (
str
) – the full URL.
Adds some URL data to the component.
New in version 0.6.2.
- check_relations(sysinfo, pool, rel_kind)¶
- Parameters:
sysinfo (
AppStream.SystemInfo
orNone
) – anAppStream.SystemInfo
to use for system information.pool (
AppStream.Pool
orNone
) – anAppStream.Pool
to find component dependencies in.rel_kind (
AppStream.RelationKind
) – the kind of relations to check
- Returns:
An array of
AppStream.RelationCheckResult
- Return type:
Verifies the respective relations and presents whether the system specified in
AppStream.SystemInfo
sysinfo and data from pool supply the requested facilities.New in version 1.0.0.
- clear_keywords(locale)¶
-
Remove all keywords for the given locale.
- clear_languages()¶
Remove all registered language translation information.
New in version 0.14.5.
- clear_tags()¶
Remove all tags associated with this component.
New in version 0.15.0.
- get_addons()¶
- Returns:
An array of
AppStream.Component
.- Return type:
Returns a list of
AppStream.Component
objects which are addons extending this component in functionality.This is the reverse of
AppStream.Component.get_extends
()New in version 0.9.2.
- get_agreement_by_kind(kind)¶
- Parameters:
kind (
AppStream.AgreementKind
) – an agreement kind, e.g.AppStream.AgreementKind.EULA
- Returns:
a
AppStream.Agreement
orNone
for not found- Return type:
Gets an agreement the component has specified for the particular kind.
New in version 0.12.1.
- get_agreements()¶
- Returns:
An array of
AppStream.Agreement
.- Return type:
Get a list of all agreements registered with this software component.
New in version 0.15.0.
- get_branch()¶
-
Gets the branch for the application.
New in version 0.14.0.
- get_branding()¶
- Returns:
- Return type:
Get the branding associated with this component, or
None
in case this component has no special branding.New in version 0.15.2.
- get_bundle(bundle_kind)¶
- Parameters:
bundle_kind (
AppStream.BundleKind
) – the bundle kind, e.g.AppStream.BundleKind.LIMBA
.- Returns:
An
AppStream.Bundle
, orNone
if not set.- Return type:
Gets a bundle identifier string.
New in version 0.8.0.
- get_bundles()¶
- Returns:
A list of
AppStream.Bundle
.- Return type:
Get a list of all software bundles associated with this component.
New in version 0.10.
- get_compulsory_for_desktops()¶
- Returns:
A list of desktops where this component is compulsory
- Return type:
[
str
]
- get_content_rating(kind)¶
- Parameters:
kind (
str
) – a ratings kind, e.g. “oars-1.0”- Returns:
a
AppStream.ContentRating
orNone
if not found- Return type:
Gets a content ratings of a specific type that are defined for this component.
New in version 0.11.0.
- get_content_ratings()¶
- Returns:
an array
- Return type:
Gets all content ratings defined for this software.
New in version 0.11.0.
- get_context()¶
- Returns:
the associated
AppStream.Context
orNone
- Return type:
Get the
AppStream.Context
associated with this component. This function may returnNone
if no context is set (which will be the case if the component was not loaded from a file or cache but constructed in memory).New in version 0.11.2.
- get_custom()¶
-
New in version 0.10.5.
- get_custom_value(key)¶
-
Retrieve value for a custom data entry with the given key.
New in version 0.10.5.
- get_data_id()¶
- Returns:
the unique session-specific identifier.
- Return type:
Get a unique identifier for this metadata set. This unique ID is only valid for the current session, as opposed to the AppStream ID which uniquely identifies a software component.
The format of the unique id usually is: %{scope}/%{origin}/%{distribution_system}/%{appstream_id}
For example: system/os/package/org.example.FooBar
- get_date_eol()¶
- Returns:
The EOL date as string in ISO8601 format.
- Return type:
Gets the end-of-life date for the entire component.
New in version 0.15.2.
- get_description()¶
- Returns:
the description.
- Return type:
Get the localized long description of this component.
- get_developer()¶
- Returns:
the developer as
AppStream.Developer
.- Return type:
Get information about the component’s developer or development team. The returned object may be empty if no developer information was available.
- get_extends()¶
- Returns:
A
GLib.PtrArray
orNone
if not set.- Return type:
Returns a string list of IDs of components which are extended by this addon.
See
AppStream.Component.get_extends
() for the reverse.New in version 0.15.5.
- get_icon_by_size(width, height)¶
- Parameters:
- Returns:
An icon matching the given width/height, or
None
if not found.- Return type:
Gets an icon matching the size constraints. The icons are not filtered by type, and the first icon which matches the size is returned. If you want more control over which icons you use for displaying, use the
AppStream.Component.get_icons
() function to get a list of all icons.Note that this function is not HiDPI aware! It will never return an icon with a scaling factor > 1.
- get_icon_stock()¶
- Returns:
An stock icon, or
None
if none found.- Return type:
Gets a stock icon for this component if one is associated with it. Will return
None
otherwise.
- get_icons()¶
- Returns:
A
GLib.PtrArray
of all icons for this component.- Return type:
- get_id()¶
- Returns:
the unique AppStream identifier.
- Return type:
Get the unique AppStream identifier for this component. This ID is unique for the described component, but does not uniquely identify the metadata set.
For a unique ID for this metadata set in the current session, use
AppStream.Component.get_data_id
()
- get_keywords_table()¶
-
Retrieve the internal hash table mapping languages to keword arrays.
- get_kind()¶
- Returns:
the kind of #this.
- Return type:
Returns the
AppStream.ComponentKind
of this component.
- get_language(locale)¶
- Parameters:
locale (
str
orNone
) – the BCP47 locale, orNone
. e.g. “en-GB”- Returns:
a percentage value, -1 if locale was not found
- Return type:
Gets the translation coverage in percent for a specific locale
New in version 0.7.0.
- get_languages()¶
- Returns:
list of locales
- Return type:
[
str
]
Get a list of all languages.
New in version 0.7.0.
- get_launchable(kind)¶
- Parameters:
kind (
AppStream.LaunchableKind
) – a launch kind, e.g.AppStream.LaunchableKind.DESKTOP_ID
- Returns:
a
AppStream.Launchable
orNone
if not found- Return type:
Gets a
AppStream.Launchable
of a specific type that contains launchable entries for this component.New in version 0.11.0.
- get_launchables()¶
- Returns:
an array
- Return type:
New in version 0.11.0.
- get_merge_kind()¶
- Returns:
the
AppStream.MergeKind
of this component.- Return type:
Get the merge method which should apply to duplicate components with this ID.
New in version 0.9.8.
- get_metadata_license()¶
- Returns:
the license.
- Return type:
The license the metadata iself is subjected to.
- get_name_table()¶
-
Get the internal locale to component name mapping table.
- get_name_variant_suffix()¶
- Returns:
the variant suffix
- Return type:
Get variant suffix for the component name (only to be displayed if two components have the same name).
New in version 0.12.10.
- get_pkgname()¶
- Returns:
String array of package names
- Return type:
Get the first package name of the list of packages that need to be installed for this component to be present on the system. Since most components consist of only one package, this is safe to use for about 90% of all cases.
However, to support a component fully, please use
AppStream.Component.get_pkgnames
() for getting all packages that need to be installed, and use this method only to e.g. get the main package to perform a quick “is it installed?” check.
- get_pkgnames()¶
- Returns:
String array of package names
- Return type:
[
str
]
Get a list of package names which this component consists of. This usually is just one package name.
- get_priority()¶
- Return type:
Returns the priority of this component. This method is used internally.
New in version 0.6.1.
- get_project_group()¶
- Returns:
the project group.
- Return type:
Get the component’s project group.
- get_project_license()¶
- Returns:
the license.
- Return type:
Get the license of the project this component belongs to.
- get_provided()¶
- Returns:
A list of
AppStream.Provided
objects.- Return type:
Get a list of
AppStream.Provided
objects associated with this component.
- get_provided_for_kind(kind)¶
- Parameters:
kind (
AppStream.ProvidedKind
) – kind of the provided item, e.g.AppStream.ProvidedKind.MEDIATYPE
- Returns:
AppStream.Provided
containing the items this component provides, orNone
.- Return type:
Get an
AppStream.Provided
object for the given interface type, containing information about the public interfaces (mimetypes, firmware, DBus services, …) this component provides.
- get_recommends()¶
- Returns:
an array
- Return type:
Get an array of items that are recommended by this component.
New in version 0.12.0.
- get_references()¶
- Returns:
An array of
AppStream.Reference
.- Return type:
Get a list of external references and citation information for this component.
New in version 1.0.0.
- get_releases_plain()¶
- Returns:
Release information as
AppStream.ReleaseList
- Return type:
Get release information for this component, without downloading or loading any data from external sources.
- get_replaces()¶
- Returns:
an array of component-IDs
- Return type:
[
str
]
Get a list of component IDs of components that this software replaces entirely.
- get_requires()¶
- Returns:
an array
- Return type:
Get an array of items that are required by this component.
New in version 0.12.0.
- get_reviews()¶
- Returns:
an array
- Return type:
Gets any reviews associated with the component.
New in version 0.14.0.
- get_scope()¶
- Returns:
the
AppStream.ComponentScope
of this component.- Return type:
New in version 0.10.2.
- get_screenshots_all()¶
- Returns:
an array of
AppStream.Screenshot
instances- Return type:
Get a list of all associated screenshots, for all environments.
- get_search_tokens()¶
- Returns:
The string search tokens
- Return type:
[
str
]
Returns all search tokens for this component.
New in version 0.9.7.
- get_sort_score()¶
- Return type:
Returns the sorting priority of this component.
This will only return a valid value if this component was the result of or involved in a search operation which returned sorted results. In most cases you will not need to access this value explicitly, as all results of search operations in AppStream are already sorted from best match to worst.
The returned value is an arbitrary integer value, valid only for the search terms involved in the search operation that yielded this component as a result.
New in version 0.12.11.
- get_suggested()¶
- Returns:
an array of
AppStream.Suggested
instances- Return type:
Get a list of associated suggestions.
- get_summary_table()¶
-
Get the internal locale to component summary mapping table.
- get_supports()¶
- Returns:
an array
- Return type:
Get an array of items that are supported by this component, e.g. to indicate support for a specific piece of hardware.
New in version 0.15.0.
- get_system_compatibility_score(sysinfo, is_template)¶
- Parameters:
sysinfo (
AppStream.SystemInfo
) – anAppStream.SystemInfo
to use for system information.is_template (
bool
) – ifTrue
, treat system info as neutral template, ignoring any peripheral devices or kernel relations.
- Returns:
a compatibility score between 0 and 100
- results:
Receive the resulting check results
- Return type:
(
int
, results: [AppStream.RelationCheckResult
])
Return a score between 0 and 100 determining how compatible the component is with the system configuration provided as parameter.
0 means the componsnt will not work at all, while 100 is best compatibility.
- get_timestamp_eol()¶
- Returns:
UNIX timestamp, or 0 for unset or invalid.
- Return type:
Gets the UNIX timestamp for the date when this component is out of support (end-of-life) and will receive no more updates, not even security fixes.
New in version 0.15.2.
- get_translations()¶
- Returns:
An array of
AppStream.Translation
objects.- Return type:
Get a
GLib.PtrArray
ofAppStream.Translation
objects describing the translation systems and translation-ids (e.g. Gettext domains) used by this software component.Only set for metainfo files.
New in version 0.9.2.
- get_url(url_kind)¶
- Parameters:
url_kind (
AppStream.UrlKind
) – the URL kind, e.g.AppStream.UrlKind.HOMEPAGE
.- Returns:
string, or
None
if unset- Return type:
Gets a URL.
New in version 0.6.2.
- has_category(category)¶
- Parameters:
category (
str
) – the specified category to check- Returns:
True
if the component is in the specified category.- Return type:
Check if component is in the specified category.
- has_tag(ns, tag)¶
- Parameters:
- Returns:
True
if tag exists.- Return type:
Test if the component is tagged with the selected tag.
New in version 0.15.0.
- insert_custom_value(key, value)¶
- Parameters:
- Returns:
True
if the key did not exist yet.- Return type:
Add a key and value pair to the custom data table.
New in version 0.10.5.
- is_compulsory_for_desktop(desktop)¶
- Parameters:
desktop (
str
) – the desktop-id to test for- Returns:
- Return type:
Check if this component is compulsory for the given desktop.
- is_floss()¶
-
Returns
True
if this component is free and open source software. To determine this status, this function will check if it comes from a vetted free-software-only source or whether its licenses are only free software licenses.New in version 0.15.5.
- is_ignored()¶
- Returns:
Whether this component’s metadata should be ignored.
- Return type:
New in version 0.10.2.
- is_member_of_category(category)¶
- Parameters:
category (
AppStream.Category
) – The category to test.- Return type:
Test if the component self is a member of category category.
- is_valid()¶
-
Check if the essential properties of this Component are populated with useful data.
- load_from_bytes(context, format, bytes)¶
- Parameters:
context (
AppStream.Context
) – anAppStream.Context
instance.format (
AppStream.FormatKind
) – the format of the data to load, e.g.AppStream.FormatKind.XML
bytes (
GLib.Bytes
) – the data to load.
- Raises:
- Returns:
True
on success.- Return type:
Load metadata for this component from an XML string. You normally do not want to use this method directly and instead use the more convenient API of
AppStream.Metadata
to create and update components.If this function returns
True
, a valid component is returned unless the selected format wasAppStream.FormatKind.DESKTOP_ENTRY
, in which case a component ID will have to be set explicitly by the caller in order to make the component valid.New in version 0.14.0.
- load_releases(allow_net)¶
- Parameters:
allow_net (
bool
) –- Raises:
- Returns:
Release information as
AppStream.ReleaseList
, orNone
if loading failed.- Return type:
Get release information for this component, download it if necessary.
- remove_tag(ns, tag)¶
- Parameters:
- Returns:
True
if the tag was removed.- Return type:
Remove a tag from this component
New in version 0.15.0.
- search_matches(term)¶
- Parameters:
term (
str
) – the search term.- Returns:
a match scrore, where 0 is no match and 100 is the best match.
- Return type:
Searches component data for a specific keyword.
New in version 0.9.7.
- search_matches_all(terms)¶
- Parameters:
terms (
str
) – the search terms.- Returns:
a match score, where 0 is no match and larger numbers are better matches.
- Return type:
Searches component data for all the specific keywords.
New in version 0.9.8.
- set_branch(branch)¶
- Parameters:
branch (
str
) – the branch, e.g. “master” or “3-16”.
Set the branch that the component instance was sourced from.
New in version 0.14.0.
- set_branding(branding)¶
- Parameters:
branding (
AppStream.Branding
) – anAppStream.Branding
instance.
Set branding for this component.
New in version 0.15.2.
- set_compulsory_for_desktop(desktop)¶
- Parameters:
desktop (
str
) – The name of the desktop.
Mark this component to be compulsory for the specified desktop environment.
- set_context(context)¶
- Parameters:
context (
AppStream.Context
) – theAppStream.Context
.
Sets the document context this component is associated with.
New in version 0.11.2.
- set_context_locale(locale)¶
- Parameters:
locale (
str
) – the new locale.
Set the active locale on the context assoaiacted with this component, creating a new context for the component if none exists yet.
Please not that this will flip the locale of all other components and entities that use the same context as well! This function is just a convenience method, and does not replace proper
AppStream.Context
management.
- set_data_id(value)¶
- Parameters:
value (
str
) – the unique session-specific identifier.
Set the session-specific unique metadata identifier for this component. If two components have a different data_id but the same ID, they will be treated as independent sets of metadata describing the same component type.
- set_date_eol(date)¶
- Parameters:
date (
str
) – the EOL date in ISO8601 format.
Sets an end-of-life date for this component.
New in version 0.15.2.
- set_description(value, locale)¶
- Parameters:
Set long description for this component.
- set_developer(developer)¶
- Parameters:
developer (
AppStream.Developer
) – the newAppStream.Developer
Set the the component’s developer.
- set_id(value)¶
- Parameters:
value (
str
) – the unique identifier.
Set the AppStream identifier for this component.
- set_keywords(new_keywords, locale, deep_copy)¶
- Parameters:
Set keywords for this component, replacing all existing ones for the selected locale.
- set_kind(value)¶
- Parameters:
value (
AppStream.ComponentKind
) – theAppStream.ComponentKind
.
Sets the
AppStream.ComponentKind
of this component.
- set_merge_kind(kind)¶
- Parameters:
kind (
AppStream.MergeKind
) – theAppStream.MergeKind
.
Sets the
AppStream.MergeKind
for this component.New in version 0.9.8.
- set_metadata_license(value)¶
- Parameters:
value (
str
) – the metadata license.
Set the license this metadata is licensed under.
- set_name(value, locale)¶
- Parameters:
Set a human-readable name for this component.
- set_name_variant_suffix(value, locale)¶
- Parameters:
Set a variant suffix for the component name (only to be displayed if components have the same name).
New in version 0.12.10.
- set_pkgname(pkgname)¶
- Parameters:
pkgname (
str
) – the package name
Set the package name that provides this component.
New in version 0.14.5.
- set_pkgnames(packages)¶
- Parameters:
packages ([
str
]) –
Set a list of package names this component consists of. (This should usually be just one package name)
- set_priority(priority)¶
- Parameters:
priority (
int
) – the given priority
Sets the priority of this component. This method is used internally.
New in version 0.6.1.
- set_project_group(value)¶
- Parameters:
value (
str
) – the project group.
Set the component’s project group.
- set_releases(releases)¶
- Parameters:
releases (
AppStream.ReleaseList
) – theAppStream.ReleaseList
to use.
Set a new set of releases for this component.
- set_scope(scope)¶
- Parameters:
scope (
AppStream.ComponentScope
) – theAppStream.ComponentKind
.
Sets the
AppStream.ComponentScope
of this component.
- set_sort_score(score)¶
- Parameters:
score (
int
) – the given sorting score
Sets the sorting score of this component.
New in version 0.9.8.
- set_summary(value, locale)¶
- Parameters:
Set a short description for this component.
- sort_screenshots(environment, style, prioritize_style)¶
- Parameters:
Reorder the screenshots to prioritize a certain environment or style, instead of using the default screenshot order.
If both “environment” and “style” are
None
, the previous default order is restored.
- to_string()¶
- Returns:
A descriptive string
- Return type:
Returns a string identifying this component. (useful for debugging)
- to_xml_data(context)¶
- Parameters:
context (
AppStream.Context
) – anAppStream.Context
instance.- Raises:
- Returns:
True
on success.- Return type:
Serialize this component into an XML string. You normally do not want to use this method directly and instead use the more convenient API of
AppStream.Metadata
to serialize components.New in version 0.12.10.
Property Details¶
- AppStream.Component.props.categories¶
- Name:
categories
- Type:
- Default Value:
- Flags:
string array of categories
- AppStream.Component.props.description¶
-
the description
- AppStream.Component.props.icons¶
-
hash map of icon urls and sizes
- AppStream.Component.props.id¶
-
the unique identifier
- AppStream.Component.props.keywords¶
-
string array of keywords
- AppStream.Component.props.kind¶
- Name:
kind
- Type:
- Default Value:
- Flags:
the
AppStream.ComponentKind
of this component
- AppStream.Component.props.name¶
-
the name
- AppStream.Component.props.pkgnames¶
-
string array of packages name
- AppStream.Component.props.project_group¶
-
the project group
- AppStream.Component.props.project_license¶
-
the project license
- AppStream.Component.props.screenshots¶
- Name:
screenshots
- Type:
- Default Value:
- Flags:
An array of
AppStream.Screenshot
instances
- AppStream.Component.props.summary¶
-
the summary
- AppStream.Component.props.urls¶
- Name:
urls
- Type:
- Default Value:
- Flags:
the urls associated with this component