Shared
- class appstream_python.Shared.TranslateableTag
Represents a translatable tag
- get_default_text() → str
Returns the untranslated text
- Return type
str
- set_default_text(text: str) → None
Sets the untranslated text
- Parameters
text (str) –
- Return type
None
- get_translated_text(lang: str) → Optional[str]
Returns the translated text
- Parameters
lang (str) –
- Return type
Optional[str]
- get_translated_text_default(lang: str) → Optional[str]
Returns the translated text. Returns the default text, if the translation does not exists
- Parameters
lang (str) –
- Return type
Optional[str]
- set_translated_text(lang: str, text: str) → None
Sets the translated text
- Parameters
lang (str) –
text (str) –
- Return type
None
- get_available_languages() → list[str]
Returns a list with all languages of the tag
- Return type
list[str]
- load_tags(tag_list: list[lxml.etree.Element]) → None
Load a list of Tags
- Parameters
tag_list (list[lxml.etree.Element]) –
- Return type
None
- write_tags(parent_tag: Element, tag_name: str) → None
Writes a Tag
- Parameters
parent_tag (Element) –
tag_name (str) –
- Return type
None
- clear() → None
Resets all data
- Return type
None
- class appstream_python.Shared.TranslateableList
Represents a translatable list
- get_default_list() → list[str]
Returns a list with the default items
- Return type
list[str]
- get_translated_list(lang: str) → list[str]
Returns the translated list for the given language
- Parameters
lang (str) –
- Return type
list[str]
- load_tag(tag: Element) → None
Loads an Tag. Only for internal use.
- Parameters
tag (Element) –
- Return type
None
- write_all_tag(parent_tag: Element, tag_name: str) → None
Writes the XML tags. Onnly for internal use.
- Parameters
parent_tag (Element) –
tag_name (str) –
- Return type
None
- write_untranslated_tags(parent_tag: Element, tag_name: str) → None
Writes the untranslated XML tags. Onnly for internal use.
- Parameters
parent_tag (Element) –
tag_name (str) –
- Return type
None
- write_translated_tags(parent_tag: Element, tag_name: str, lang: str) → None
Writes the translated XML tags. Onnly for internal use.
- Parameters
parent_tag (Element) –
tag_name (str) –
lang (str) –
- Return type
None
- clear() → None
Resets all data
- Return type
None
- class appstream_python.Shared.DescriptionItem
The Interface for a Description Item
- get_type() → Literal['paragraph', 'unordered-list', 'ordered-list']
Retutns the Type of the Item
- Return type
Literal[‘paragraph’, ‘unordered-list’, ‘ordered-list’]
- load_tags(tag_list: list[lxml.etree.Element]) → None
Loads teh XML tags into the Elemnt. Only for internal use.
- Parameters
tag_list (list[lxml.etree.Element]) –
- Return type
None
- get_tags(parent_tag: Element) → None
Get the XML Tag from the Element. Only for internal use.
- Parameters
parent_tag (Element) –
- Return type
None
- get_translated_tag(lang: Optional[str]) → Element
Loads the tag for a given language
- Parameters
lang (Optional[str]) –
- Return type
Element
- to_plain_text(lang: Optional[str] = None) → str
Returns the content as plain text
- Parameters
lang (Optional[str]) –
- Return type
str
- class appstream_python.Shared.DescriptionParagraph
Represents a paragraph <p> in the Description
- content
The Text of the Paragraph
- get_type() → Literal['paragraph', 'unordered-list', 'ordered-list']
Retutns the Type of the Item
- Return type
Literal[‘paragraph’, ‘unordered-list’, ‘ordered-list’]
- load_tags(tag_list: list[lxml.etree.Element]) → None
Loads teh XML tags into the Elemnt. Only for internal use.
- Parameters
tag_list (list[lxml.etree.Element]) –
- Return type
None
- get_tags(parent_tag: Element) → None
Get the XML Tag from the Element. Only for internal use.
- Parameters
parent_tag (Element) –
- Return type
None
- get_translated_tag(lang: Optional[str]) → Element
Loads the tag for a given language
- Parameters
lang (Optional[str]) –
- Return type
Element
- to_plain_text(lang: Optional[str] = None) → str
Returns the content as plain text
- Parameters
lang (Optional[str]) –
- Return type
str
- class appstream_python.Shared.DescriptionList(list_type: str)
Represents a list <ul>/<ol> in the Description
- Parameters
list_type (str) –
- content: TranslateableList
The list
- get_type() → Literal['paragraph', 'unordered-list', 'ordered-list']
Returns the Type of the Item
- Return type
Literal[‘paragraph’, ‘unordered-list’, ‘ordered-list’]
- load_tags(tag_list: list[lxml.etree.Element]) → None
Loads the XML tags into the Elemnt. Only for internal use.
- Parameters
tag_list (list[lxml.etree.Element]) –
- Return type
None
- get_tags(parent_tag: Element) → None
Get the XML Tag from the Element. Only for internal use.
- Parameters
parent_tag (Element) –
- Return type
None
- get_translated_tag(lang: Optional[str] = None) → Element
Loads the tag for a given language
- Parameters
lang (Optional[str]) –
- Return type
Element
- to_plain_text(lang: Optional[str] = None) → str
Returns the content as plain text
- Parameters
lang (Optional[str]) –
- Return type
str
- class appstream_python.Shared.Description
Represents a <description> tag
- items: list[appstream_python.Shared.DescriptionItem]
All Description Items
- load_tags(tag: Element) → None
Load a XML tag. Onyl for internal use.
- Parameters
tag (Element) –
- Return type
None
- get_tags(parent_tag: Element) → None
Writes a Description tag. Only for internal use.
- Parameters
parent_tag (Element) –
- Return type
None
- to_html(lang: Optional[str] = None) → str
Get the HTML code of the description in the given language
- Parameters
lang (Optional[str]) –
- Return type
str
- to_plain_text(lang: Optional[str] = None) → str
Converts the Description into Plain Text
- Parameters
lang (Optional[str]) – The language
- Returns
The Description
- Return type
str