Events

Freevo Plugin Writing HOWTO: Writing your own plugins for Freevo
Prev | Chapter 2. Internal Structure | Next

# 2.2. Events

The communication between input devices (remote control or keyboard) and the menu or the application is based on events. It's also possible that a plugin sends an event to other parts of Freevo. The mapping between keys and the events depends on the application type (menu, video, audio, etc). See `event.py` for details about the default event mapping.

A event is an identifier string and optional an argument. The event itself can be compared with a string, comparing two event objects only compares the identifier. This makes it possible to check for events without caring for the argument.

An event is send into Freevo with the function `rc.post_event`. The events are stored in a fifo queue. If an event is in the queue, Freevo tries to find the correct eventhandler for this event. If the menu is active, Freevo will pass the event to the current selected item. Each item will send the event to it's parent if it doesn't consume the event. If the event wasn't consumed by one of the menu items, it will be passed to the DaemonPlugins (see DaemonPlugins section for deatils).

Instead of the class `Event`, the plugin can use the functions helper functions in `plugin.py` `event` to create and `isevent` to get the name of an event. This functions adds the string `PLUGIN_EVENT` to the event name. The media menu has some extra redraw checkings if the event has something to do with a plugin.

Prev | Home | Next
Internal Structure | Up | The Menu System