:right-sidebar: True BreakpointCondition =================================================================== .. currentmodule:: gi.repository.Adw .. versionadded:: 1.4 .. class:: BreakpointCondition(*args, **kwargs) :no-contents-entry: Describes condition for an :obj:`~gi.repository.Adw.Breakpoint`\. Constructors ------------ .. rst-class:: interim-class .. class:: BreakpointCondition :no-index: .. classmethod:: new_and(condition_1: ~gi.repository.Adw.BreakpointCondition, condition_2: ~gi.repository.Adw.BreakpointCondition) -> ~gi.repository.Adw.BreakpointCondition Creates a condition that triggers when ``condition_1`` and ``condition_2`` are both true. .. versionadded:: 1.4 :param condition_1: first condition :param condition_2: second condition .. classmethod:: new_length(type: ~gi.repository.Adw.BreakpointConditionLengthType, value: float, unit: ~gi.repository.Adw.LengthUnit) -> ~gi.repository.Adw.BreakpointCondition Creates a condition that triggers on length changes. .. versionadded:: 1.4 :param type: the length type :param value: the length value :param unit: the length unit .. classmethod:: new_or(condition_1: ~gi.repository.Adw.BreakpointCondition, condition_2: ~gi.repository.Adw.BreakpointCondition) -> ~gi.repository.Adw.BreakpointCondition Creates a condition that triggers when either ``condition_1`` or ``condition_2`` is true. .. versionadded:: 1.4 :param condition_1: first condition :param condition_2: second condition .. classmethod:: new_ratio(type: ~gi.repository.Adw.BreakpointConditionRatioType, width: int, height: int) -> ~gi.repository.Adw.BreakpointCondition Creates a condition that triggers on ratio changes. The ratio is represented as ``width`` divided by ``height``\. .. versionadded:: 1.4 :param type: the ratio type :param width: ratio width :param height: ratio height Methods ------- .. rst-class:: interim-class .. class:: BreakpointCondition :no-index: .. method:: free() -> None Frees ``self``\. .. versionadded:: 1.4 .. classmethod:: parse() -> ~gi.repository.Adw.BreakpointCondition Parses a condition from a string. Length conditions are specified as ``: []``\, where: - ```` can be ``min-width``\, ``max-width``\, ``min-height`` or ``max-height`` - ```` is a fractional number - ```` can be ``px``\, ``pt`` or ``sp`` If the unit is omitted, ``px`` is assumed. See :obj:`~gi.repository.BreakpointCondition.new_length`\. Examples: - ``min-width: 500px`` - ``min-height: 400pt`` - ``max-width: 100sp`` - ``max-height: 500`` Ratio conditions are specified as ``: [/]``\, where: - ```` can be ``min-aspect-ratio`` or ``max-aspect-ratio`` - ```` and ```` are integer numbers See :obj:`~gi.repository.BreakpointCondition.new_ratio`\. The ratio is represented as ```` divided by ````\. If ```` 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: - `` and ``\: the condition is true when both ````\s are true, same as when using :obj:`~gi.repository.BreakpointCondition.new_and` - `` or ``\: the condition is true when either of the ````\s is true, same as when using :obj:`~gi.repository.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. .. versionadded:: 1.4 .. method:: to_string() -> str Returns a textual representation of ``self``\. The returned string can be parsed by :obj:`~gi.repository.BreakpointCondition.parse`\. .. versionadded:: 1.4