Manette.Device

g GObject.Object GObject.Object Manette.Device Manette.Device GObject.Object->Manette.Device

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_device_type ()

get_guid ()

get_mapping ()

get_name ()

has_input (type, code)

has_rumble ()

has_user_mapping ()

remove_user_mapping ()

rumble (strong_magnitude, weak_magnitude, milliseconds)

save_user_mapping (mapping_string)

supports_mapping ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

absolute-axis-event

Emitted when an absolute axis’ value changes.

button-press-event

Emitted when a button is pressed.

button-release-event

Emitted when a button is released.

disconnected

Emitted when the device is disconnected.

event

Emitted for any kind of event before mapping it.

hat-axis-event

Emitted when a hat axis’ value changes.

Fields

Inherited:

GObject.Object (1)

Class Details

class Manette.Device(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Manette.DeviceClass

An object representing a physical gamepad.

See also: [class`Monitor`].

get_device_type()
Returns:

the device type

Return type:

Manette.DeviceType

Gets the device type of self.

New in version 0.2.10.

get_guid()
Returns:

the identifier used by SDL mappings

Return type:

str

Gets the identifier used by SDL mappings to discriminate game controller devices.

New in version 0.2.10.

get_mapping()
Returns:

the mapping for self

Return type:

str or None

Gets the user mapping for self, or default mapping if there isn’t any.

Can return NULL if there’s no mapping or self doesn’t support mappings.

New in version 0.2.10.

get_name()
Returns:

the name of self

Return type:

str

Gets the device’s name.

has_input(type, code)
Parameters:
  • type (int) – the input type

  • code (int) – the input code

Returns:

whether the device has the given input

Return type:

bool

Gets whether the device has the given input.

If the input is present, it means that the device can send events for it regardless of whether the device is mapped or not.

has_rumble()
Returns:

whether self supports rumble

Return type:

bool

Gets whether self supports rumble.

has_user_mapping()
Returns:

whether self has a user mapping

Return type:

bool

Gets whether self has a user mapping.

remove_user_mapping()

Removes the user mapping for self.

rumble(strong_magnitude, weak_magnitude, milliseconds)
Parameters:
  • strong_magnitude (int) – the magnitude for the heavy motor

  • weak_magnitude (int) – the magnitude for the light motor

  • milliseconds (int) – the rumble effect play time in milliseconds

Returns:

whether the rumble effect was played

Return type:

bool

Make self rumble during milliseconds milliseconds.

The heavy and light motors will rumble at their respectively defined magnitudes.

The duration cannot exceed 32767 milliseconds.

save_user_mapping(mapping_string)
Parameters:

mapping_string (str) – the mapping string

Saves mapping_string as the user mapping for self.

supports_mapping()
Returns:

whether self supports mapping

Return type:

bool

Gets whether self supports mapping.

New in version 0.2.10.

Signal Details

Manette.Device.signals.absolute_axis_event(device, event)
Signal Name:

absolute-axis-event

Flags:

RUN_LAST

Parameters:

Emitted when an absolute axis’ value changes.

Manette.Device.signals.button_press_event(device, event)
Signal Name:

button-press-event

Flags:

RUN_LAST

Parameters:

Emitted when a button is pressed.

Manette.Device.signals.button_release_event(device, event)
Signal Name:

button-release-event

Flags:

RUN_LAST

Parameters:

Emitted when a button is released.

Manette.Device.signals.disconnected(device)
Signal Name:

disconnected

Flags:

RUN_LAST

Parameters:

device (Manette.Device) – The object which received the signal

Emitted when the device is disconnected.

Manette.Device.signals.event(device, event)
Signal Name:

event

Flags:

RUN_LAST

Parameters:

Emitted for any kind of event before mapping it.

Manette.Device.signals.hat_axis_event(device, event)
Signal Name:

hat-axis-event

Flags:

RUN_LAST

Parameters:

Emitted when a hat axis’ value changes.