SwipeTracker#

class SwipeTracker(**properties: Any)#

Superclasses: Object

Implemented Interfaces: Orientable

A swipe tracker used in Carousel, NavigationView and OverlaySplitView.

The AdwSwipeTracker object can be used for implementing widgets with swipe gestures. It supports touch-based swipes, pointer dragging, and touchpad scrolling.

The widgets will probably want to expose the enabled property. If they expect to use horizontal orientation, reversed can be used for supporting RTL text direction.

Constructors#

class SwipeTracker
classmethod new(swipeable: Swipeable) SwipeTracker#

Creates a new AdwSwipeTracker for widget.

Parameters:

swipeable – a widget to add the tracker on

Methods#

class SwipeTracker
get_allow_long_swipes() bool#

Gets whether to allow swiping for more than one snap point at a time.

get_allow_mouse_drag() bool#

Gets whether self can be dragged with mouse pointer.

get_allow_window_handle() bool#

Gets whether to allow touchscreen swiping from GtkWindowHandle.

Added in version 1.5.

get_enabled() bool#

Gets whether self is enabled.

get_lower_overshoot() bool#

Gets whether to allow swiping past the first available snap point.

Added in version 1.4.

get_reversed() bool#

Gets whether self is reversing the swipe direction.

get_swipeable() Swipeable#

Get the widget self is attached to.

get_upper_overshoot() bool#

Gets whether to allow swiping past the last available snap point.

Added in version 1.4.

set_allow_long_swipes(allow_long_swipes: bool) None#

Sets whether to allow swiping for more than one snap point at a time.

If the value is FALSE, each swipe can only move to the adjacent snap points.

Parameters:

allow_long_swipes – whether to allow long swipes

set_allow_mouse_drag(allow_mouse_drag: bool) None#

Sets whether self can be dragged with mouse pointer.

Parameters:

allow_mouse_drag – whether to allow mouse dragging

set_allow_window_handle(allow_window_handle: bool) None#

Sets whether to allow touchscreen swiping from GtkWindowHandle.

Setting it to TRUE will make dragging the window impossible.

Added in version 1.5.

Parameters:

allow_window_handle – whether to allow swiping from window handles

set_enabled(enabled: bool) None#

Sets whether self is enabled.

When it’s not enabled, no events will be processed. Usually widgets will want to expose this via a property.

Parameters:

enabled – whether self is enabled

set_lower_overshoot(overshoot: bool) None#

Sets whether to allow swiping past the first available snap point.

Added in version 1.4.

Parameters:

overshoot – whether to allow swiping past the first available snap point

set_reversed(reversed: bool) None#

Sets whether to reverse the swipe direction.

If the swipe tracker is horizontal, it can be used for supporting RTL text direction.

Parameters:

reversed – whether to reverse the swipe direction

set_upper_overshoot(overshoot: bool) None#

Sets whether to allow swiping past the last available snap point.

Added in version 1.4.

Parameters:

overshoot – whether to allow swiping past the last available snap point

shift_position(delta: float) None#

Moves the current progress value by delta.

This can be used to adjust the current position if snap points move during the gesture.

Parameters:

delta – the position delta

Properties#

class SwipeTracker
props.allow_long_swipes: bool#

The type of the None singleton.

props.allow_mouse_drag: bool#

The type of the None singleton.

props.allow_window_handle: bool#

The type of the None singleton.

Added in version 1.5.

props.enabled: bool#

The type of the None singleton.

props.lower_overshoot: bool#

The type of the None singleton.

Added in version 1.4.

props.reversed: bool#

The type of the None singleton.

props.swipeable: Swipeable#

The type of the None singleton.

props.upper_overshoot: bool#

The type of the None singleton.

Added in version 1.4.

Signals#

class SwipeTracker.signals
begin_swipe() None#

The type of the None singleton.

end_swipe(velocity: float, to: float) None#

The type of the None singleton.

Parameters:
  • velocity – the velocity of the swipe

  • to – the progress value to animate to

prepare(direction: NavigationDirection) None#

The type of the None singleton.

Parameters:

direction – the direction of the swipe

update_swipe(progress: float) None#

The type of the None singleton.

Parameters:

progress – the current animation progress value