Functions

breakpoint_condition_parse (str)

easing_ease (self, value)

get_enable_animations (widget)

get_major_version ()

get_micro_version ()

get_minor_version ()

init ()

is_initialized ()

length_unit_from_px (unit, value, settings)

length_unit_to_px (unit, value, settings)

lerp (a, b, t)

Details

Adw.breakpoint_condition_parse(str)
Parameters:

str (str) – the string specifying the condition

Returns:

the parsed condition

Return type:

Adw.BreakpointCondition

Parses a condition from a string.

Length conditions are specified as <type>: <value>[<unit>], where:

  • <type> can be min-width, max-width, min-height or max-height

  • <value> is a fractional number

  • <unit> can be px, pt or sp

If the unit is omitted, px is assumed.

See [ctor`BreakpointCondition`.new_length].

Examples:

  • min-width: 500px

  • min-height: 400pt

  • max-width: 100sp

  • max-height: 500

Ratio conditions are specified as <type>: <width>[/<height>], where:

  • <type> can be min-aspect-ratio or max-aspect-ratio

  • <width> and <height> are integer numbers

See [ctor`BreakpointCondition`.new_ratio].

The ratio is represented as <width> divided by <height>.

If <height> is omitted, it’s assumed to be 1.

Examples:

  • min-aspect-ratio: 4/3

  • max-aspect-ratio: 1

The logical operators and, or can be used to compose a complex condition as follows:

  • <condition> and <condition>: the condition is true when both ``<condition>``s are true, same as when using [ctor`BreakpointCondition`.new_and]

  • <condition> or <condition>: the condition is true when either of the ``<condition>``s is true, same as when using [ctor`BreakpointCondition`.new_or]

Examples:

  • min-width: 400px and max-aspect-ratio: 4/3

  • max-width: 360sp or max-width: 360px

Conditions can be further nested using parentheses, for example:

  • min-width: 400px and (max-aspect-ratio: 4/3 or max-height: 400px)

If parentheses are omitted, the first operator takes priority.

New in version 1.4.

Adw.easing_ease(self, value)
Parameters:
Returns:

the easing for value

Return type:

float

Computes easing with easing for value.

value should generally be in the [0, 1] range.

Adw.get_enable_animations(widget)
Parameters:

widget (Gtk.Widget) – a GtkWidget

Returns:

whether animations are enabled for widget

Return type:

bool

Checks whether animations are enabled for widget.

This should be used when implementing an animated widget to know whether to animate it or not.

Adw.get_major_version()
Returns:

the major version number of the Adwaita library

Return type:

int

Returns the major version number of the Adwaita library.

For example, in libadwaita version 1.2.3 this is 1.

This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the [constMAJOR_VERSION] constant, which represents the major version of the libadwaita headers you have included when compiling your code.

Adw.get_micro_version()
Returns:

the micro version number of the Adwaita library

Return type:

int

Returns the micro version number of the Adwaita library.

For example, in libadwaita version 1.2.3 this is 3.

This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the [constMAJOR_VERSION] constant, which represents the micro version of the libadwaita headers you have included when compiling your code.

Adw.get_minor_version()
Returns:

the minor version number of the Adwaita library

Return type:

int

Returns the minor version number of the Adwaita library.

For example, in libadwaita version 1.2.3 this is 2.

This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the [constMAJOR_VERSION] constant, which represents the minor version of the libadwaita headers you have included when compiling your code.

Adw.init()

Initializes Libadwaita.

This function can be used instead of [func`Gtk`.init] as it initializes GTK implicitly.

There’s no need to call this function if you’re using [class`Application`].

If Libadwaita has already been initialized, the function will simply return.

This makes sure translations, types, themes, and icons for the Adwaita library are set up properly.

Adw.is_initialized()
Returns:

the initialization status

Return type:

bool

Use this function to check if libadwaita has been initialized with [func`init`].

Adw.length_unit_from_px(unit, value, settings)
Parameters:
Returns:

the length in unit

Return type:

float

Converts value from pixels to unit.

New in version 1.4.

Adw.length_unit_to_px(unit, value, settings)
Parameters:
Returns:

the length in pixels

Return type:

float

Converts value from unit to pixels.

New in version 1.4.

Adw.lerp(a, b, t)
Parameters:
  • a (float) – the start

  • b (float) – the end

  • t (float) – the interpolation rate

Returns:

the computed value

Return type:

float

Computes the linear interpolation between a and b for t.