The userInput module

The userInput module contains the UserInput class which provides the ability to process keyboard presses from a user and call a specific function when certain keys are received.

The Device class

Inheritance diagram of pyamp.ui.input.userInput.Device

class pyamp.ui.input.userInput.Device(filename)

An abstract input device attached to a Linux evdev device node

poll()

Receive and process all available input events

readMetadata()

Read device identity and capabilities via ioctl()

update_EV_ABS(event)

Scale the absolute axis into the range [-1, 1] using absAxisInfo

The UserInput class

Inheritance diagram of pyamp.ui.input.userInput.UserInput

class pyamp.ui.input.userInput.UserInput(keyboard, debug=False)[source]

The UserInput class uses the amp.ui.input.evdev module to receive the user’s keyboard presses given the specific Linux keyboard device.

This class provides to ability to add a series of callbacks for specific keyboard presses. These functions will be called in the event that the key presses occur.

  • keyboard – The Linux keyboard device
  • debug – True for debugging mode, False otherwise
addCode(key, code)[source]

Add codes for given key press events. The key can be a tuple where the first index is a list of keys and the second index is a list of modifiers. Or it can be simply a list of keys, or it can be a single key.

addCodes(keys)[source]

Add codes for given key press events. Each key in the keys dictionary can be a tuple where the first index is a list of keys and the second index is a list of modifiers. Or it can be simply a list of keys, or it can be a single key.

addKey(key, callback)[source]

Add a single key to the key press cases. The key can be a tuple where the first argument is the list of keys, or a single key, and the second argument is a list of modifiers. Optionally, is can just be a list of keys, or it can be a single key.

addKeyList(keys, callback)[source]

Add a list of keys mapped to a single function. Keys can be a tuple where the first index the a list of keys, or a single key, and the second index is the list of modifiers. Or it can be a list of keys, and finally it can be just a single key.

addKeys(keys)[source]

Add a key to the key press cases. The keys is a dictionary of keys. Each key in the dictionary is a normal tuple form of a key, and the value of the dictionary key is the callback method.

handleKeyPress()[source]

Handle keys that are pressed.

Table Of Contents

Previous topic

The evdev module

Next topic

The web module

This Page