Swipeable

class Swipeable(*args, **kwargs)

Implementations: Carousel, Flap, Leaflet, NavigationView, OverlaySplitView

An interface for swipeable widgets.

The AdwSwipeable interface is implemented by all swipeable widgets.

See SwipeTracker for details about implementing it.

Methods

class Swipeable
get_cancel_progress() float

Gets the progress self will snap back to after the gesture is canceled.

get_distance() float

Gets the swipe distance of self.

This corresponds to how many pixels 1 unit represents.

get_progress() float

Gets the current progress of self.

get_snap_points() list[float]

Gets the snap points of self.

Each snap point represents a progress value that is considered acceptable to end the swipe on.

get_swipe_area(navigation_direction: NavigationDirection, is_drag: bool) Rectangle

Gets the area self can start a swipe from for the given direction and gesture type.

This can be used to restrict swipes to only be possible from a certain area, for example, to only allow edge swipes, or to have a draggable element and ignore swipes elsewhere.

If not implemented, the default implementation returns the allocation of self, allowing swipes from anywhere.

Parameters:
  • navigation_direction – the direction of the swipe

  • is_drag – whether the swipe is caused by a dragging gesture

Virtual Methods

class Swipeable
do_get_cancel_progress() float

Gets the progress self will snap back to after the gesture is canceled.

do_get_distance() float

Gets the swipe distance of self.

This corresponds to how many pixels 1 unit represents.

do_get_progress() float

Gets the current progress of self.

do_get_snap_points() list[float]

Gets the snap points of self.

Each snap point represents a progress value that is considered acceptable to end the swipe on.

do_get_swipe_area(navigation_direction: NavigationDirection, is_drag: bool) Rectangle

Gets the area self can start a swipe from for the given direction and gesture type.

This can be used to restrict swipes to only be possible from a certain area, for example, to only allow edge swipes, or to have a draggable element and ignore swipes elsewhere.

If not implemented, the default implementation returns the allocation of self, allowing swipes from anywhere.

Parameters:
  • navigation_direction – the direction of the swipe

  • is_drag – whether the swipe is caused by a dragging gesture