Index: branches/rewrite-1/elisa/core/input_event.py =================================================================== --- branches/rewrite-1/elisa/core/input_event.py (revisión: 2160) +++ branches/rewrite-1/elisa/core/input_event.py (copia de trabajo) @@ -23,29 +23,32 @@ __maintainer2__ = 'Florian Boucault ' -# FIXME: this is a *work in progress*, many questions are left unanswered -# such as: -# - do we need more information than that ? -# - how do we handle events from multiple viewports in pigment ? - from elisa.core.utils import enum +# Type of the input device having produced the event EventSource = enum.Enum('KEYBOARD', 'MOUSE', 'REMOTE', 'OTHER') +# What kind of event it is EventType = enum.Enum('MOUSE_DOWN', 'MOUSE_UP', 'MOUSE_MOVE', 'KEY_DOWN', - 'KEY_UP', 'ACTION') + 'KEY_UP') +# Code corresponding to the key that has been pressed # TODO: add KEY_* EventValue = enum.Enum('MOUSE_LEFT', 'MOUSE_MIDDLE', 'MOUSE_RIGHT', - 'ACTION_GO_UP', 'ACTION_GO_DOWN', 'ACTION_GO_LEFT', - 'ACTION_GO_RIGHT', 'ACTION_OK', 'ACTION_MENU', - 'ACTION_EXIT', 'ACTION_PLAY', 'ACTION_PAUSE', - 'ACTION_STOP', 'ACTION_INC_PLAYBACK_SPEED', - 'ACTION_DEC_PLAYBACK_SPEED', 'ACTION_SEEK_FORWARD', - 'ACTION_SEEK_BACKWARD', 'ACTION_TOGGLE_FULLSCREEN', - 'ACTION_MUTE', 'ACTION_VOL_UP', 'ACTION_VOL_DOWN') + +# Modifier, useful for keyboards EventModifier = enum.Enum('NONE', 'CTRL', 'SHIFT', 'ALT') +# Action that should be triggered by the event +EventAction = enum.Enum('ACTION_GO_UP', 'ACTION_GO_DOWN', 'ACTION_GO_LEFT', + 'ACTION_GO_RIGHT', 'ACTION_OK', 'ACTION_MENU', + 'ACTION_EXIT', 'ACTION_PLAY', 'ACTION_PAUSE', + 'ACTION_STOP', 'ACTION_INC_PLAYBACK_SPEED', + 'ACTION_DEC_PLAYBACK_SPEED', 'ACTION_SEEK_FORWARD', + 'ACTION_SEEK_BACKWARD', 'ACTION_TOGGLE_FULLSCREEN', + 'ACTION_MUTE', 'ACTION_VOL_UP', 'ACTION_VOL_DOWN') + + class InputEvent: """ InputEvent base class @@ -54,7 +57,7 @@ InputManager with them. This class should allow us to abstract any kind of input event that can be injected in Elisa. - @ivar source: source device of the event (keyboard, mouse, ...) + @ivar source: type of the source device of the event (keyboard, mouse, ...) @ivar type: type of event (KEY_UP, KEY_DOWN, ...) @ivar value: event's value (KEY_a, MOUSE_LEFT, ...) @ivar modifier: event's modifier, especially useful for keyboards