diff options
Diffstat (limited to 'helpers/mapping.py')
-rw-r--r-- | helpers/mapping.py | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/helpers/mapping.py b/helpers/mapping.py index 84e9941..58aaf3d 100644 --- a/helpers/mapping.py +++ b/helpers/mapping.py | |||
@@ -7,6 +7,15 @@ class Mapping: | |||
7 | HEIGHT = 298 | 7 | HEIGHT = 298 |
8 | SIZE = WIDTH, HEIGHT | 8 | SIZE = WIDTH, HEIGHT |
9 | 9 | ||
10 | ROW_POSITIONS = { | ||
11 | 'first': 0, | ||
12 | 'second': 50, | ||
13 | 'third': 100, | ||
14 | 'fourth': 150, | ||
15 | 'fifth': 200, | ||
16 | 'sixth': 250, | ||
17 | } | ||
18 | |||
10 | KEYS = [ | 19 | KEYS = [ |
11 | (pygame.K_ESCAPE, 'ESC', 'first', 0, {}), | 20 | (pygame.K_ESCAPE, 'ESC', 'first', 0, {}), |
12 | 21 | ||
@@ -26,17 +35,17 @@ class Mapping: | |||
26 | (pygame.K_F12, 'F12', 'first', 700, {}), | 35 | (pygame.K_F12, 'F12', 'first', 700, {}), |
27 | 36 | ||
28 | 37 | ||
29 | (178, '²', 'second', 0, {}), | 38 | (178, '²', 'second', 0, {}), |
30 | (pygame.K_AMPERSAND, '&', 'second', 50, {}), | 39 | (pygame.K_AMPERSAND, '&', 'second', 50, {}), |
31 | (233, 'é', 'second', 100, {}), | 40 | (233, 'é', 'second', 100, {}), |
32 | (pygame.K_QUOTEDBL, '"', 'second', 150, {}), | 41 | (pygame.K_QUOTEDBL, '"', 'second', 150, {}), |
33 | (pygame.K_QUOTE, "'", 'second', 200, {}), | 42 | (pygame.K_QUOTE, "'", 'second', 200, {}), |
34 | (pygame.K_LEFTPAREN, '(', 'second', 250, {}), | 43 | (pygame.K_LEFTPAREN, '(', 'second', 250, {}), |
35 | (pygame.K_MINUS, '-', 'second', 300, {}), | 44 | (pygame.K_MINUS, '-', 'second', 300, {}), |
36 | (232, 'è', 'second', 350, {}), | 45 | (232, 'è', 'second', 350, {}), |
37 | (pygame.K_UNDERSCORE, '_', 'second', 400, {}), | 46 | (pygame.K_UNDERSCORE, '_', 'second', 400, {}), |
38 | (231, 'ç', 'second', 450, {}), | 47 | (231, 'ç', 'second', 450, {}), |
39 | (224, 'à', 'second', 500, {}), | 48 | (224, 'à', 'second', 500, {}), |
40 | (pygame.K_RIGHTPAREN, ')', 'second', 550, {}), | 49 | (pygame.K_RIGHTPAREN, ')', 'second', 550, {}), |
41 | (pygame.K_EQUALS, '=', 'second', 600, {}), | 50 | (pygame.K_EQUALS, '=', 'second', 600, {}), |
42 | 51 | ||
@@ -57,9 +66,9 @@ class Mapping: | |||
57 | (pygame.K_CARET, '^', 'third', 575, {}), | 66 | (pygame.K_CARET, '^', 'third', 575, {}), |
58 | (pygame.K_DOLLAR, '$', 'third', 625, {}), | 67 | (pygame.K_DOLLAR, '$', 'third', 625, {}), |
59 | 68 | ||
60 | (pygame.K_RETURN, 'Enter', 'third', 692, { 'width': 56, 'height': 98 }), | 69 | (pygame.K_RETURN, 'Enter', 'third', 692, { 'width': 56, 'height': 98 }), |
61 | 70 | ||
62 | (pygame.K_CAPSLOCK, 'CAPS', 'fourth', 0, { 'width': 88, 'disabled': True }), | 71 | (pygame.K_CAPSLOCK, 'CAPS', 'fourth', 0, { 'width': 88, 'disabled': True }), |
63 | 72 | ||
64 | (pygame.K_q, 'q', 'fourth', 90, {}), | 73 | (pygame.K_q, 'q', 'fourth', 90, {}), |
65 | (pygame.K_s, 's', 'fourth', 140, {}), | 74 | (pygame.K_s, 's', 'fourth', 140, {}), |
@@ -71,7 +80,7 @@ class Mapping: | |||
71 | (pygame.K_k, 'k', 'fourth', 440, {}), | 80 | (pygame.K_k, 'k', 'fourth', 440, {}), |
72 | (pygame.K_l, 'l', 'fourth', 490, {}), | 81 | (pygame.K_l, 'l', 'fourth', 490, {}), |
73 | (pygame.K_m, 'm', 'fourth', 540, {}), | 82 | (pygame.K_m, 'm', 'fourth', 540, {}), |
74 | (249, 'ù', 'fourth', 590, {}), | 83 | (249, 'ù', 'fourth', 590, {}), |
75 | (pygame.K_ASTERISK, '*', 'fourth', 640, {}), | 84 | (pygame.K_ASTERISK, '*', 'fourth', 640, {}), |
76 | 85 | ||
77 | 86 | ||
@@ -96,7 +105,7 @@ class Mapping: | |||
96 | (pygame.K_LALT, 'LAlt', 'sixth', 165, { 'disabled': True }), | 105 | (pygame.K_LALT, 'LAlt', 'sixth', 165, { 'disabled': True }), |
97 | (pygame.K_SPACE, 'Espace', 'sixth', 215, { 'width': 248 }), | 106 | (pygame.K_SPACE, 'Espace', 'sixth', 215, { 'width': 248 }), |
98 | (pygame.K_MODE, 'AltGr', 'sixth', 465, { 'disabled': True }), | 107 | (pygame.K_MODE, 'AltGr', 'sixth', 465, { 'disabled': True }), |
99 | (314, 'Compose', 'sixth', 515, { 'disabled': True }), | 108 | (314, 'Compose', 'sixth', 515, { 'disabled': True }), |
100 | (pygame.K_RCTRL, 'RCtrl', 'sixth', 565, { 'width': 63, 'disabled': True }), | 109 | (pygame.K_RCTRL, 'RCtrl', 'sixth', 565, { 'width': 63, 'disabled': True }), |
101 | 110 | ||
102 | 111 | ||
@@ -122,7 +131,14 @@ class Mapping: | |||
122 | self.keys = {} | 131 | self.keys = {} |
123 | self.running = [] | 132 | self.running = [] |
124 | for key in self.KEYS: | 133 | for key in self.KEYS: |
125 | self.keys[key[0]] = Key(self, self.draw_lock, *key[0:4], **key[4]) | 134 | if key[2] in self.ROW_POSITIONS: |
135 | position = self.ROW_POSITIONS[key[2]] | ||
136 | else: | ||
137 | position = key[2] | ||
138 | self.keys[key[0]] = Key(self, | ||
139 | self.draw_lock, | ||
140 | key[0], key[1], position, key[3], | ||
141 | **key[4]) | ||
126 | 142 | ||
127 | def draw(self): | 143 | def draw(self): |
128 | for key_name in self.keys: | 144 | for key_name in self.keys: |