AppStreamCompose.Hint

g AppStreamCompose.Hint AppStreamCompose.Hint GObject.Object GObject.Object GObject.Object->AppStreamCompose.Hint

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new_for_tag (tag)

add_explanation_var (var_name, text)

format_explanation ()

format_explanation_plain ()

get_explanation_template ()

get_explanation_vars_list ()

get_severity ()

get_tag ()

is_error ()

is_valid ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class AppStreamCompose.Hint(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

AppStreamCompose.HintClass

classmethod new_for_tag(tag)
Parameters:

tag (str) – The tag ID to construct this hint for.

Raises:

GLib.Error

Return type:

AppStreamCompose.Hint

Creates a new AppStreamCompose.Hint with the given tag. If the selected tag was not registered+ with the global tag registry, None is returned and an error is set.

Added in version 0.14.0.

add_explanation_var(var_name, text)
Parameters:
  • var_name (str) – Name of the variable to be replaced.

  • text (str) – Replacement for the variable name.

Add a replacement variable for the explanation text.

Added in version 0.13.0.

format_explanation()
Returns:

Explanation text for this hint as HTML.

Return type:

str

Formats the explanation template to return a human-readable issue hint explanation, with all placeholder variables replaced.

Explanation templates contain markup, so the result of this function is a snippet of HTML, ready to be embedded into a generated report.

Use AppStreamCompose.Hint.format_explanation_plain if you need text to display without HTML markup.

Added in version 0.13.0.

format_explanation_plain()
Returns:

Explanation text for this hint as plain text.

Return type:

str

Formats the explanation template like AppStreamCompose.Hint.format_explanation does, but resolves all markup of the template into plain text: emphasis is dropped, code spans are marked the way Markdown does, line breaks become actual line breaks, links are reduced to their text followed by the URL they point to, and escaped characters are unescaped.

Added in version 1.2.0.

get_explanation_template()
Return type:

str

Gets the explanation template for this hint.

Added in version 0.13.0.

get_explanation_vars_list()
Returns:

A flattened GLib.PtrArray with the key/value pairs.

Return type:

[str]

Returns a list with the flattened key/value pairs for this hint. Values are located in uneven list entries, following their keys in even list entries.

Added in version 0.14.0.

get_severity()
Return type:

AppStream.IssueSeverity

Gets the issue severity of this hint.

Added in version 0.13.0.

get_tag()
Return type:

str

Gets the unique tag for the type of this hint.

Added in version 0.13.0.

is_error()
Returns:

True if this hint describes an error.

Return type:

bool

Added in version 0.13.0.

is_valid()
Returns:

True if this hint is valid.

Return type:

bool

Check if this hint is valid (it requires at least a tag and a severity in order to be considered valid).

Added in version 0.13.0.