Adw.BreakpointCondition¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
Details¶
- class Adw.BreakpointCondition¶
Describes condition for an [class`Breakpoint`].
New in version 1.4.
- classmethod new_and(condition_1, condition_2)¶
- Parameters:
condition_1 (
Adw.BreakpointCondition) – first conditioncondition_2 (
Adw.BreakpointCondition) – second condition
- Returns:
the newly created condition
- Return type:
Creates a condition that triggers when condition_1 and condition_2 are both true.
New in version 1.4.
- classmethod new_length(type, value, unit)¶
- Parameters:
type (
Adw.BreakpointConditionLengthType) – the length typevalue (
float) – the length valueunit (
Adw.LengthUnit) – the length unit
- Returns:
the newly created condition
- Return type:
Creates a condition that triggers on length changes.
New in version 1.4.
- classmethod new_or(condition_1, condition_2)¶
- Parameters:
condition_1 (
Adw.BreakpointCondition) – first conditioncondition_2 (
Adw.BreakpointCondition) – second condition
- Returns:
the newly created condition
- Return type:
Creates a condition that triggers when either condition_1 or condition_2 is true.
New in version 1.4.
- classmethod new_ratio(type, width, height)¶
- Parameters:
type (
Adw.BreakpointConditionRatioType) – the ratio typewidth (
int) – ratio widthheight (
int) – ratio height
- Returns:
the newly created condition
- Return type:
Creates a condition that triggers on ratio changes.
The ratio is represented as width divided by height.
New in version 1.4.
- classmethod parse(str)¶
- Parameters:
str (
str) – the string specifying the condition- Returns:
the parsed condition
- Return type:
Parses a condition from a string.
Length conditions are specified as
<type>: <value>[<unit>], where:<type>can bemin-width,max-width,min-heightormax-height<value>is a fractional number<unit>can bepx,ptorsp
If the unit is omitted,
pxis assumed.See [ctor`BreakpointCondition`.new_length].
Examples:
min-width: 500pxmin-height: 400ptmax-width: 100spmax-height: 500
Ratio conditions are specified as
<type>: <width>[/<height>], where:<type>can bemin-aspect-ratioormax-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/3max-aspect-ratio: 1
The logical operators
and,orcan 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/3max-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.
- copy()¶
- Returns:
a copy of self
- Return type:
Copies self.
New in version 1.4.
- free()¶
Frees self.
New in version 1.4.