Handy.SwipeTracker

g GObject.GInterface GObject.GInterface Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.Object GObject.Object Handy.SwipeTracker Handy.SwipeTracker GObject.Object->Handy.SwipeTracker Gtk.Orientable->Handy.SwipeTracker

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gtk.Orientable (2)

Structs:

GObject.ObjectClass (5)

class

new (swipeable)

get_allow_long_swipes ()

get_allow_mouse_drag ()

get_enabled ()

get_reversed ()

get_swipeable ()

set_allow_long_swipes (allow_long_swipes)

set_allow_mouse_drag (allow_mouse_drag)

set_enabled (enabled)

set_reversed (reversed)

shift_position (delta)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Gtk.Orientable (1)

Name

Type

Flags

Short Description

allow-long-swipes

bool

r/w/en

Whether to allow swiping for more than one snap point at a time

allow-mouse-drag

bool

r/w/en

Whether to allow dragging with mouse pointer

enabled

bool

r/w/en

Whether the swipe tracker processes events

reversed

bool

r/w/en

Whether swipe direction is reversed

swipeable

Handy.Swipeable

r/w/co

The swipeable the swipe tracker is attached to

Signals

Inherited:

GObject.Object (1)

Name

Short Description

begin-swipe

This signal is emitted when a possible swipe is detected.

end-swipe

This signal is emitted as soon as the gesture has stopped.

update-swipe

This signal is emitted every time the progress value changes.

Fields

Inherited:

GObject.Object (1)

Class Details

class Handy.SwipeTracker(**kwargs)
Bases:

GObject.Object, Gtk.Orientable

Abstract:

No

Structure:

Handy.SwipeTrackerClass

Swipe tracker used in [class`Carousel`] and [class`Leaflet`].

The HdySwipeTracker 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 [property`SwipeTracker`:py:data::enabled<Handy.SwipeTracker.props.enabled>] property. If they expect to use horizontal orientation, [property`SwipeTracker`:py:data::reversed<Handy.SwipeTracker.props.reversed>] property can be used for supporting RTL text direction.

New in version 1.0.

classmethod new(swipeable)
Parameters:

swipeable (Handy.Swipeable) – a swipeable to add the tracker on

Returns:

the newly created HdySwipeTracker

Return type:

Handy.SwipeTracker

Creates a new HdySwipeTracker object on widget.

New in version 1.0.

get_allow_long_swipes()
Returns:

whether long swipes are allowed

Return type:

bool

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.

New in version 1.2.

get_allow_mouse_drag()
Returns:

TRUE is mouse dragging is allowed

Return type:

bool

Get whether self can be dragged with mouse pointer.

New in version 1.0.

get_enabled()
Returns:

TRUE if self is enabled

Return type:

bool

Get whether self is enabled.

New in version 1.0.

get_reversed()
Returns:

TRUE is the direction is reversed

Return type:

bool

Get whether self is reversing the swipe direction.

New in version 1.0.

get_swipeable()
Returns:

the swipeable widget

Return type:

Handy.Swipeable

Get self's swipeable widget.

New in version 1.0.

set_allow_long_swipes(allow_long_swipes)
Parameters:

allow_long_swipes (bool) – whether to allow long swipes

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.

New in version 1.2.

set_allow_mouse_drag(allow_mouse_drag)
Parameters:

allow_mouse_drag (bool) – whether to allow mouse dragging

Set whether self can be dragged with mouse pointer.

This should usually be FALSE.

New in version 1.0.

set_enabled(enabled)
Parameters:

enabled (bool) – whether to enable to swipe tracker

Set whether self is enabled.

New in version 1.0.

set_reversed(reversed)
Parameters:

reversed (bool) – whether to reverse the swipe direction

Set whether to reverse the swipe direction.

If self is horizontal, can be used for supporting RTL text direction.

New in version 1.0.

shift_position(delta)
Parameters:

delta (float) – the position delta

Move the current progress value by delta.

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

New in version 1.0.

Signal Details

Handy.SwipeTracker.signals.begin_swipe(swipe_tracker, direction, direct)
Signal Name:

begin-swipe

Flags:

RUN_FIRST

Parameters:
  • swipe_tracker (Handy.SwipeTracker) – The object which received the signal

  • direction (Handy.NavigationDirection) – the direction of the swipe

  • direct (bool) – TRUE if the swipe is directly triggered by a gesture, FALSE if it’s triggered via a [class`SwipeGroup`]

This signal is emitted when a possible swipe is detected.

The direction value can be used to restrict the swipe to a certain direction.

New in version 1.0.

Handy.SwipeTracker.signals.end_swipe(swipe_tracker, duration, to)
Signal Name:

end-swipe

Flags:

RUN_FIRST

Parameters:
  • swipe_tracker (Handy.SwipeTracker) – The object which received the signal

  • duration (int) – snap-back animation duration, in milliseconds

  • to (float) – the progress value to animate to

This signal is emitted as soon as the gesture has stopped.

New in version 1.0.

Handy.SwipeTracker.signals.update_swipe(swipe_tracker, progress)
Signal Name:

update-swipe

Flags:

RUN_FIRST

Parameters:
  • swipe_tracker (Handy.SwipeTracker) – The object which received the signal

  • progress (float) – the current animation progress value

This signal is emitted every time the progress value changes.

New in version 1.0.

Property Details

Handy.SwipeTracker.props.allow_long_swipes
Name:

allow-long-swipes

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

New in version 1.2.

Handy.SwipeTracker.props.allow_mouse_drag
Name:

allow-mouse-drag

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to allow dragging with mouse pointer.

This should usually be FALSE.

New in version 1.0.

Handy.SwipeTracker.props.enabled
Name:

enabled

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the swipe tracker is enabled.

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

New in version 1.0.

Handy.SwipeTracker.props.reversed
Name:

reversed

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to reverse the swipe direction.

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

New in version 1.0.

Handy.SwipeTracker.props.swipeable
Name:

swipeable

Type:

Handy.Swipeable

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The widget the swipe tracker is attached to. Must not be NULL.

New in version 1.0.