AppStreamGlib.Screenshot

g AppStreamGlib.Screenshot AppStreamGlib.Screenshot GObject.Object GObject.Object GObject.Object->AppStreamGlib.Screenshot

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

kind_from_string (kind)

class

kind_to_string (kind)

class

new ()

add_image (image)

equal (screenshot2)

get_caption (locale)

get_image (width, height)

get_image_for_locale (locale, width, height)

get_images ()

get_images_for_locale (locale)

get_kind ()

get_priority ()

get_source ()

set_caption (locale, caption)

set_kind (kind)

set_priority (priority)

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 AppStreamGlib.Screenshot(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

AppStreamGlib.ScreenshotClass

classmethod kind_from_string(kind)[source]
Parameters:

kind (str) – the string.

Returns:

a AppStreamGlib.ScreenshotKind, or AppStreamGlib.ScreenshotKind.UNKNOWN if not known.

Return type:

AppStreamGlib.ScreenshotKind

Converts the text representation to an enumerated value.

New in version 0.1.0.

classmethod kind_to_string(kind)[source]
Parameters:

kind (AppStreamGlib.ScreenshotKind) – the AppStreamGlib.ScreenshotKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.1.0.

classmethod new()[source]
Returns:

a AppStreamGlib.Screenshot

Return type:

AppStreamGlib.Screenshot

Creates a new AppStreamGlib.Screenshot.

New in version 0.1.0.

add_image(image)[source]
Parameters:

image (AppStreamGlib.Image) – a AppStreamGlib.Image instance.

Adds an image to the screenshot.

New in version 0.1.0.

equal(screenshot2)[source]
Parameters:

screenshot2 (AppStreamGlib.Screenshot) – a AppStreamGlib.Screenshot instance.

Returns:

True for success

Return type:

bool

Checks if two screenshots are the same.

New in version 0.5.7.

get_caption(locale)[source]
Parameters:

locale (str or None) – the locale, or None. e.g. “en_GB”

Returns:

the caption

Return type:

str

Gets the image caption for a specific locale.

New in version 0.1.0.

get_image(width, height)[source]
Parameters:
  • width (int) – target width

  • height (int) – target height

Returns:

an AppStreamGlib.Image, or None

Return type:

AppStreamGlib.Image

Gets the AppStreamGlib.Image closest to the target size. The AppStreamGlib.Image may not actually be the requested size, and the application may have to pad / rescale the image to make it fit.

New in version 0.2.2.

get_image_for_locale(locale, width, height)[source]
Parameters:
  • locale (str or None) – locale, e.g. “en_GB”

  • width (int) – target width

  • height (int) – target height

Returns:

an AppStreamGlib.Image, or None

Return type:

AppStreamGlib.Image

Gets the AppStreamGlib.Image closest to the target size with the specified locale. The AppStreamGlib.Image may not actually be the requested size, and the application may have to pad / rescale the image to make it fit.

FIXME: This function assumes the images are ordered in preference order, e.g. “en_GB -> en -> None"

New in version 0.5.14.

get_images()[source]
Returns:

an array

Return type:

[AppStreamGlib.Image]

Gets the images included in the screenshot of all sizes and locales.

New in version 0.1.0.

get_images_for_locale(locale)[source]
Parameters:

locale (str) – a locale, e.g. en_GB

Returns:

an array

Return type:

[AppStreamGlib.Image]

Returns all images of all sizes that are compatible with a specific locale.

New in version 0.5.14.

get_kind()[source]
Returns:

a AppStreamGlib.ScreenshotKind

Return type:

AppStreamGlib.ScreenshotKind

Gets the screenshot kind.

New in version 0.1.0.

get_priority()[source]
Returns:

a priority value

Return type:

int

Gets the screenshot priority.

New in version 0.3.1.

get_source()[source]
Returns:

an AppStreamGlib.Image, or None

Return type:

AppStreamGlib.Image

Gets the source image (the unscaled version) for the screenshot

New in version 0.1.6.

set_caption(locale, caption)[source]
Parameters:
  • locale (str or None) – the locale, or None. e.g. “en_GB”

  • caption (str) – the caption text.

Sets a caption on the screenshot for a specific locale.

New in version 0.1.0.

set_kind(kind)[source]
Parameters:

kind (AppStreamGlib.ScreenshotKind) – the AppStreamGlib.ScreenshotKind.

Sets the screenshot kind.

New in version 0.1.0.

set_priority(priority)[source]
Parameters:

priority (int) – the priority value.

Sets the screenshot priority. Higher numbers are better.

New in version 0.3.1.