Package gnue :: Package forms :: Package input :: Module GFKeyMapper :: Class BaseKeyMapper
[show private | hide private]

Class BaseKeyMapper


A basic key mapper. This will normally serve most UI's input needs.

Handles physical to logical key mapping for GNUe Forms. Also performs logical key to Events mapping.
Method Summary
  __init__(self, userKeyMap)
Stores the base key map and initializes the translations dict.
  getEvent(self, basekey, shift, ctrl, meta)
If an event is assigned to the specified keystroke then return that command.
  loadUserKeyMap(self, dict)
  setUIKeyMap(self, keyset)
Called by the UI class to setup their required key mappings.
  setUserKeyMap(self, keymap)
Install a key/event mapping.

Method Details

__init__(self, userKeyMap)
(Constructor)

Stores the base key map and initializes the translations dict.

getEvent(self, basekey, shift=False, ctrl=False, meta=False)

If an event is assigned to the specified keystroke then return that command.

The keystroke is the UI-specific keystroke, not our virtual keys. If a command isn't defined but a modifier key is held down then a command USERCOMMAND-[CTRL-][ALT-]key will be returned.

This needs to stay as simple as possible as it gets called for each keystroke
Returns:
The command name or None if the keystroke isn't tied to an event.

loadUserKeyMap(self, dict)

setUIKeyMap(self, keyset)

Called by the UI class to setup their required key mappings.

i.e., we need to know what wxPython thinks F1 is, etc

setUserKeyMap(self, keymap)

Install a key/event mapping.
Parameters:
keymap - a dictinonary with tuples (basekey, shift-state, ctrl-state, meta-state) as keys and event names as values


GNUe Home

Public API

Developer's Corner