1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/usr/bin/env python
#
# Copyright (C) 2009, Joseph C. Lee
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from gi.repository import Gdk
KEY_MAP = {
Gdk.KEY_KP_Up : 'up',
Gdk.KEY_KP_Down : 'down',
Gdk.KEY_KP_Left : 'left',
Gdk.KEY_KP_Right : 'right',
Gdk.KEY_w : 'up',
Gdk.KEY_s : 'down',
Gdk.KEY_a : 'left',
Gdk.KEY_d : 'right',
Gdk.KEY_KP_8 : 'up',
Gdk.KEY_KP_2 : 'down',
Gdk.KEY_KP_4 : 'left',
Gdk.KEY_KP_6 : 'right',
Gdk.KEY_Up : 'up',
Gdk.KEY_Down : 'down',
Gdk.KEY_Left : 'left',
Gdk.KEY_Right : 'right',
Gdk.KEY_uparrow : 'up',
Gdk.KEY_downarrow : 'down',
Gdk.KEY_leftarrow : 'left',
Gdk.KEY_rightarrow : 'right',
Gdk.KEY_Return : 'select',
Gdk.KEY_KP_Space : 'select',
Gdk.KEY_KP_Enter : 'select',
Gdk.KEY_space : 'select',
Gdk.KEY_End : 'select',
Gdk.KEY_KP_End : 'select',
Gdk.KEY_KP_1 : 'select',
Gdk.KEY_q : 'select',
Gdk.KEY_Home : 'new',
Gdk.KEY_KP_Home : 'new',
Gdk.KEY_Page_Down : 'redo',
Gdk.KEY_KP_Page_Down : 'redo',
Gdk.KEY_Page_Up : 'undo',
Gdk.KEY_KP_Page_Up : 'undo',
}
|