]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blob - music_sampler.kv
Show last used keys
[perso/Immae/Projets/Python/MusicSampler.git] / music_sampler.kv
1 #:import math math
2 #:import h helpers
3
4 <Key>:
5 pad_col_sep: 0 if not self.pad_cols else self.parent.pad_x
6 pad_cols: False
7
8 y: (self.parent.top-self.parent.y) - (self.row) * self.parent.key_size - (self.row - 1) * self.parent.key_sep
9 x: (self.col - 1) * self.parent.key_size + int(self.col - 1) * self.parent.key_sep + self.pad_col_sep
10 size_hint: None, None
11 line_color: 120/255, 120/255, 120/255, 1
12 enabled: True
13 line_width: 2
14 row: 1
15 col: 0
16 key_code: 0
17 key_sym: ""
18 key_width: 1
19 key_height: 1
20 width: self.key_width * (self.parent.key_size + self.parent.key_sep) - self.parent.key_sep
21 height: self.key_height * (self.parent.key_size + self.parent.key_sep) - self.parent.key_sep
22 canvas.before:
23 Color:
24 rgba: self.color
25 RoundedRectangle:
26 pos: self.x, self.y
27 size: self.size
28 canvas:
29 Color:
30 rgba: self.line_color
31 Line:
32 rounded_rectangle: self.x + self.line_width, self.y + self.line_width, self.width - 2 * self.line_width, self.height - 2 * self.line_width, 10
33 width: self.line_width
34 Label:
35 id: key_label
36 font_name: h.path() + "fonts/Ubuntu-B.ttf"
37 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size))
38 color: 0, 0, 0, 1
39 text: self.parent.key_sym
40 text_size: self.parent.width,self.font_size
41 shorten: True
42 shorten_from: "right"
43 split_str: ""
44 center_x: self.parent.x + self.texture_size[0] /2 + 5
45 center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5
46 Label:
47 id: key_description_title
48 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
49 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2))
50 color: 0, 0, 0, 1
51 text: self.parent.description_title
52 text_size: self.parent.width - 2*self.parent.line_width, self.font_size
53 halign: "right"
54 valign: "middle"
55 center_x: self.parent.x + self.texture_size[0] /2
56 center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5
57 Label:
58 id: key_description
59 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
60 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2))
61 color: 0, 0, 0, 1
62 text: "\n".join(self.parent.description)
63 text_size: 2 * self.parent.width,self.parent.height - key_label.font_size
64 halign: "left"
65 valign: "middle"
66 pos: self.parent.x + 2 * self.parent.line_width + 2, self.parent.y
67 size_hint: None, None
68 size: 2 * self.parent.width - 2 * self.parent.line_width, self.parent.height - key_label.font_size
69
70 <Screen>:
71 canvas:
72 Color:
73 rgba: 229/255, 228/255, 226/255, 1
74 Rectangle:
75 pos: 0, 0
76 size: self.width, self.height
77
78 key_size: int( (3 * self.width - 16) / 56)
79 key_sep: int( self.key_size / 24)
80 key_pad_sep: int( self.key_size / 7) + 1
81
82 border: (self.width - self.key_size * 18 - self.key_sep * 16 - self.key_pad_sep)/ 2
83
84 mapping_height: self.key_size * 6 + self.key_sep * 5
85 mapping_width: self.key_size * 18 + self.key_sep * 16 + self.key_pad_sep
86 mapping_x: self.border
87 mapping_y: self.top - self.mapping_height - self.border
88
89 key_list_width: 4 * (mock_ubuntu_regular.width or 0)
90 key_list_height: self.height - self.mapping_height - 3 * self.border
91 key_list_x: (self.action_list_width or 0) + 2 * self.border
92 key_list_y: self.border
93
94 action_list_height: self.height - self.mapping_height - 3 * self.border
95 action_list_width: 3 * self.width / 4 - self.key_list_width - self.border
96 action_list_x: self.border
97 action_list_y: self.border
98
99 play_list_height: self.action_list_height
100 play_list_width: self.width - self.action_list_width - 3* self.border
101 play_list_y: self.border
102 play_list_x: self.action_list_width + self.key_list_width + 3 * self.border
103
104 min_height: min(mock_symbola.height, mock_ubuntu_regular.height, mock_ubuntu_bold.height)
105 symbola_line_height: self.min_height / max(mock_symbola.height,1)
106 ubuntu_regular_line_height: self.min_height / max(mock_ubuntu_regular.height,1)
107 ubuntu_bold_line_height: self.min_height / max(mock_ubuntu_bold.height,1)
108 Label:
109 id: mock_symbola
110 font_name: h.path() + "fonts/Symbola.ttf"
111 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
112 color: 0, 0, 0, 0
113 text: "A"
114 text_size: None, None
115 size_hint: None, None
116 size: self.texture_size
117 Label:
118 id: mock_ubuntu_regular
119 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
120 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
121 color: 0, 0, 0, 0
122 text: "A"
123 text_size: None, None
124 size_hint: None, None
125 size: self.texture_size
126 Label:
127 id: mock_ubuntu_bold
128 font_name: h.path() + "fonts/Ubuntu-B.ttf"
129 font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
130 color: 0, 0, 0, 0
131 text: "A"
132 text_size: None, None
133 size_hint: None, None
134 size: self.texture_size
135
136 Mapping:
137 id: Mapping
138 pos: self.parent.mapping_x, self.parent.mapping_y
139 size: self.parent.mapping_width, self.parent.mapping_height
140
141 key_size: self.parent.key_size
142 key_sep: self.parent.key_sep
143 key_pad_sep: self.parent.key_pad_sep
144 pad_x: self.key_size * 15 + 14 * self.key_sep + self.key_pad_sep
145 ActionList:
146 id: ActionList
147 pos: self.parent.action_list_x, self.parent.action_list_y
148 size: self.parent.action_list_width, self.parent.action_list_height
149 KeyList:
150 id: KeyList
151 pos: self.parent.key_list_x, self.parent.key_list_y
152 size: self.parent.key_list_width, self.parent.key_list_height
153 PlayList:
154 id: PlayList
155 pos: self.parent.play_list_x, self.parent.play_list_y
156 size: self.parent.play_list_width, self.parent.play_list_height
157
158 <KeyList>:
159 size_hint: None, None
160 canvas:
161 Color:
162 rgba: 250./255, 250./255, 250./255, 1
163 Rectangle:
164 pos: 0, 0
165 size: self.width, self.height
166 Label:
167 id: key_list_first
168 font_name: h.path() + "fonts/Ubuntu-B.ttf"
169 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
170 color: 0, 0, 0, 1
171 text: self.parent.first_key
172 text_size: None, None
173 valign: "top"
174 size_hint: None, None
175 size: self.parent.width, self.texture_size[1]
176 pos: 0, self.parent.height - self.height
177 Label:
178 id: key_list_second
179 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
180 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
181 color: 0, 0, 0, 1
182 text: self.parent.second_key
183 text_size: None, None
184 valign: "top"
185 size_hint: None, None
186 size: self.parent.width, self.texture_size[1]
187 pos: 0, self.parent.height - key_list_first.height - self.height
188 Label:
189 id: key_list_third
190 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
191 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
192 color: 0, 0, 0, 0.75
193 text: self.parent.third_key
194 text_size: None, None
195 valign: "top"
196 size_hint: None, None
197 size: self.parent.width, self.texture_size[1]
198 pos: 0, self.parent.height - key_list_first.height - key_list_second.height - self.height
199 Label:
200 id: key_list_rest
201 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
202 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
203 color: 0, 0, 0, 0.5
204 text: "\n".join(self.parent.keylist[3:])
205 text_size: None, None
206 valign: "top"
207 size_hint: None, None
208 size: self.parent.width, self.texture_size[1]
209 pos: 0, self.parent.height - key_list_first.height - key_list_second.height - key_list_third.height - self.height
210
211 <ActionList>:
212 size_hint: None, None
213 canvas:
214 Color:
215 rgba: 250./255, 250./255, 250./255, 1
216 Rectangle:
217 pos: 0, 0
218 size: self.width, self.height
219
220 Label:
221 id: action_list_title
222 font_name: h.path() + "fonts/Ubuntu-B.ttf"
223 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
224 color: 0, 0, 0, 1
225 text: self.parent.action_title
226 text_size: None, self.parent.height
227 halign: "left"
228 valign: "top"
229 size_hint: None, None
230 size: self.texture_size[0], self.parent.height
231 Label:
232 id: action_list_icons
233 font_name: h.path() + "fonts/Symbola.ttf"
234 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
235 line_height: self.parent.parent.symbola_line_height or 1
236 color: 0, 0, 0, 1
237 text: "\n".join(map(lambda x: x[0], self.parent.action_list))
238 text_size: None, self.parent.height
239 halign: "left"
240 valign: "top"
241 size_hint: None, None
242 size: self.texture_size[0], self.parent.height - 3 * self.line_height * self.font_size
243 Label:
244 id: action_list_names
245 font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
246 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
247 line_height: self.parent.parent.ubuntu_regular_line_height or 1
248 color: 0, 0, 0, 1
249 text: "\n".join(map(lambda x: x[1], self.parent.action_list))
250 text_size: None, self.parent.height
251 halign: "left"
252 valign: "top"
253 size_hint: None, None
254 pos: 15, self.y
255 size: self.texture_size[0], self.parent.height - 3 * self.line_height * self.font_size
256
257 <PlayList>:
258 size_hint: None, None
259 canvas:
260 Color:
261 rgba: 250./255, 250./255, 250./255, 1
262 Rectangle:
263 pos: 0, 0
264 size: self.width, self.height
265
266 Label:
267 id: playlist_icons
268 font_name: h.path() + "fonts/Symbola.ttf"
269 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
270 line_height: self.parent.parent.symbola_line_height or 1
271 color: 0, 0, 0, 1
272 text: "\n".join(map(lambda x: x[0], self.parent.playlist))
273 text_size: None, self.parent.height
274 halign: "left"
275 valign: "top"
276 size_hint: None, None
277 size: self.texture_size[0], self.parent.height
278 Label:
279 id: playlist_names
280 font_name: h.path() + "fonts/Ubuntu-Regular.ttf" # FIXME: Mettre en gras quand c'est en cours
281 line_height: self.parent.parent.ubuntu_regular_line_height or 1
282 font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
283 color: 0, 0, 0, 1
284 text: "\n".join(map(lambda x: x[1], self.parent.playlist))
285 text_size: None, self.parent.height
286 halign: "left"
287 valign: "top"
288 size_hint: None, None
289 pos: 15, self.y
290 size: self.texture_size[0], self.parent.height
291
292 <Mapping>:
293 size_hint: None, None
294 key_size: 48
295 key_sep: 2
296 key_pad_sep: 7
297 pad_x: 755
298 canvas:
299 Color:
300 rgba: 250./255, 250./255, 250./255, 1
301 Rectangle:
302 pos: 0, 0
303 size: self.width, self.height
304 Key:
305 id: Key_27
306 key_code: 27
307 key_sym: "ESC"
308 row: 1
309 col: 1
310 Key:
311 id: Key_282
312 key_code: 282
313 key_sym: "F1"
314 row: 1
315 col: 3
316 Key:
317 id: Key_283
318 key_code: 283
319 key_sym: "F2"
320 row: 1
321 col: 4
322 Key:
323 id: Key_284
324 key_code: 284
325 key_sym: "F3"
326 row: 1
327 col: 5
328 Key:
329 id: Key_285
330 key_code: 285
331 key_sym: "F4"
332 row: 1
333 col: 6
334
335 Key:
336 id: Key_286
337 key_code: 286
338 key_sym: "F5"
339 row: 1
340 col: 7.5
341 Key:
342 id: Key_287
343 key_code: 287
344 key_sym: "F6"
345 row: 1
346 col: 8.5
347 Key:
348 id: Key_288
349 key_code: 288
350 key_sym: "F7"
351 row: 1
352 col: 9.5
353 Key:
354 id: Key_289
355 key_code: 289
356 key_sym: "F8"
357 row: 1
358 col: 10.5
359
360 Key:
361 id: Key_290
362 key_code: 290
363 key_sym: "F9"
364 row: 1
365 col: 12
366 Key:
367 id: Key_291
368 key_code: 291
369 key_sym: "F10"
370 row: 1
371 col: 13
372 Key:
373 id: Key_292
374 key_code: 292
375 key_sym: "F11"
376 row: 1
377 col: 14
378 Key:
379 id: Key_293
380 key_code: 293
381 key_sym: "F12"
382 row: 1
383 col: 15
384
385 Key:
386 id: Key_178
387 key_code: 178
388 key_sym: "ยฒ"
389 row: 2
390 col: 1
391 Key:
392 id: Key_38
393 key_code: 38
394 key_sym: "&"
395 row: 2
396 col: 2
397 Key:
398 id: Key_233
399 key_code: 233
400 key_sym: "รฉ"
401 row: 2
402 col: 3
403 Key:
404 id: Key_34
405 key_code: 34
406 key_sym: '"'
407 row: 2
408 col: 4
409 Key:
410 id: Key_39
411 key_code: 39
412 key_sym: "'"
413 row: 2
414 col: 5
415 Key:
416 id: Key_40
417 key_code: 40
418 key_sym: "("
419 row: 2
420 col: 6
421 Key:
422 id: Key_45
423 key_code: 45
424 key_sym: "-"
425 row: 2
426 col: 7
427 Key:
428 id: Key_232
429 key_code: 232
430 key_sym: "รจ"
431 row: 2
432 col: 8
433 Key:
434 id: Key_95
435 key_code: 95
436 key_sym: "_"
437 row: 2
438 col: 9
439 Key:
440 id: Key_231
441 key_code: 231
442 key_sym: "รง"
443 row: 2
444 col: 10
445 Key:
446 id: Key_224
447 key_code: 224
448 key_sym: "ร "
449 row: 2
450 col: 11
451 Key:
452 id: Key_41
453 key_code: 41
454 key_sym: ")"
455 row: 2
456 col: 12
457 Key:
458 id: Key_61
459 key_code: 61
460 key_sym: "="
461 row: 2
462 col: 13
463 Key:
464 id: Key_8
465 key_code: 8
466 key_sym: "<-"
467 row: 2
468 col: 14
469 key_width: 2
470 Key:
471 id: Key_9
472 key_code: 9
473 key_sym: "tab"
474 row: 3
475 col: 1
476 key_width: 1.48
477 Key:
478 id: Key_97
479 key_code: 97
480 key_sym: "a"
481 row: 3
482 col: 2.5
483 Key:
484 id: Key_122
485 key_code: 122
486 key_sym: "z"
487 row: 3
488 col: 3.5
489 Key:
490 id: Key_101
491 key_code: 101
492 key_sym: "e"
493 row: 3
494 col: 4.5
495 Key:
496 id: Key_114
497 key_code: 114
498 key_sym: "r"
499 row: 3
500 col: 5.5
501 Key:
502 id: Key_116
503 key_code: 116
504 key_sym: "t"
505 row: 3
506 col: 6.5
507 Key:
508 id: Key_121
509 key_code: 121
510 key_sym: "y"
511 row: 3
512 col: 7.5
513 Key:
514 id: Key_117
515 key_code: 117
516 key_sym: "u"
517 row: 3
518 col: 8.5
519 Key:
520 id: Key_105
521 key_code: 105
522 key_sym: "i"
523 row: 3
524 col: 9.5
525 Key:
526 id: Key_111
527 key_code: 111
528 key_sym: "o"
529 row: 3
530 col: 10.5
531 Key:
532 id: Key_112
533 key_code: 112
534 key_sym: "p"
535 row: 3
536 col: 11.5
537 Key:
538 id: Key_94
539 key_code: 94
540 key_sym: "^"
541 row: 3
542 col: 12.5
543 Key:
544 id: Key_36
545 key_code: 36
546 key_sym: "$"
547 row: 3
548 col: 13.5
549 Key:
550 id: Key_13
551 key_code: 13
552 key_sym: "Enter"
553 row: 4
554 col: 14.8
555 key_width: 1.23
556 key_height: 2
557 Key:
558 id: Key_301
559 key_code: 301
560 key_sym: "CAPS"
561 row: 4
562 col: 1
563 key_width: 1.75
564 line_width: 1
565 enabled: False
566
567 Key:
568 id: Key_113
569 key_code: 113
570 key_sym: "q"
571 row: 4
572 col: 2.8
573 Key:
574 id: Key_115
575 key_code: 115
576 key_sym: "s"
577 row: 4
578 col: 3.8
579 Key:
580 id: Key_100
581 key_code: 100
582 key_sym: "d"
583 row: 4
584 col: 4.8
585 Key:
586 id: Key_102
587 key_code: 102
588 key_sym: "f"
589 row: 4
590 col: 5.8
591 Key:
592 id: Key_103
593 key_code: 103
594 key_sym: "g"
595 row: 4
596 col: 6.8
597 Key:
598 id: Key_104
599 key_code: 104
600 key_sym: "h"
601 row: 4
602 col: 7.8
603 Key:
604 id: Key_106
605 key_code: 106
606 key_sym: "j"
607 row: 4
608 col: 8.8
609 Key:
610 id: Key_107
611 key_code: 107
612 key_sym: "k"
613 row: 4
614 col: 9.8
615 Key:
616 id: Key_108
617 key_code: 108
618 key_sym: "l"
619 row: 4
620 col: 10.8
621 Key:
622 id: Key_109
623 key_code: 109
624 key_sym: "m"
625 row: 4
626 col: 11.8
627 Key:
628 id: Key_249
629 key_code: 249
630 key_sym: "รน"
631 row: 4
632 col: 12.8
633 Key:
634 id: Key_42
635 key_code: 42
636 key_sym: "*"
637 row: 4
638 col: 13.8
639 Key:
640 id: Key_304
641 key_code: 304
642 key_sym: "LShift"
643 row: 5
644 col: 1
645 key_width: 1.3
646 line_width: 1
647 enabled: False
648 Key:
649 id: Key_60
650 key_code: 60
651 key_sym: "<"
652 row: 5
653 col: 2.3
654 Key:
655 id: Key_119
656 key_code: 119
657 key_sym: "w"
658 row: 5
659 col: 3.3
660 Key:
661 id: Key_120
662 key_code: 120
663 key_sym: "x"
664 row: 5
665 col: 4.3
666 Key:
667 id: Key_99
668 key_code: 99
669 key_sym: "c"
670 row: 5
671 col: 5.3
672 Key:
673 id: Key_118
674 key_code: 118
675 key_sym: "v"
676 row: 5
677 col: 6.3
678 Key:
679 id: Key_98
680 key_code: 98
681 key_sym: "b"
682 row: 5
683 col: 7.3
684 Key:
685 id: Key_110
686 key_code: 110
687 key_sym: "n"
688 row: 5
689 col: 8.3
690 Key:
691 id: Key_44
692 key_code: 44
693 key_sym: ","
694 row: 5
695 col: 9.3
696 Key:
697 id: Key_59
698 key_code: 59
699 key_sym: ";"
700 row: 5
701 col: 10.3
702 Key:
703 id: Key_58
704 key_code: 58
705 key_sym: ":"
706 row: 5
707 col: 11.3
708 Key:
709 id: Key_33
710 key_code: 33
711 key_sym: "!"
712 row: 5
713 col: 12.3
714 Key:
715 id: Key_303
716 key_code: 303
717 key_sym: "RShift"
718 row: 5
719 col: 13.3
720 key_width: 2.7
721 line_width: 1
722 enabled: False
723 Key:
724 id: Key_306
725 key_code: 306
726 key_sym: "LCtrl"
727 row: 6
728 col: 1
729 key_width: 1.3
730 line_width: 1
731 enabled: False
732 Key:
733 id: Key_311
734 key_code: 311
735 key_sym: "LSuper"
736 row: 6
737 col: 3.3
738 line_width: 1
739 enabled: False
740 Key:
741 id: Key_308
742 key_code: 308
743 key_sym: "LAlt"
744 row: 6
745 col: 4.3
746 line_width: 1
747 enabled: False
748 Key:
749 id: Key_32
750 key_code: 32
751 key_sym: "Espace"
752 row: 6
753 col: 5.3
754 key_width: 5
755 Key:
756 id: Key_313
757 key_code: 313
758 key_sym: "AltGr"
759 row: 6
760 col: 10.3
761 line_width: 1
762 enabled: False
763 Key:
764 id: Key_314
765 key_code: 314
766 key_sym: "Compose"
767 row: 6
768 col: 11.3
769 line_width: 1
770 enabled: False
771 Key:
772 id: Key_305
773 key_code: 305
774 key_sym: "RCtrl"
775 row: 6
776 col: 12.3
777 key_width: 1.3
778 line_width: 1
779 enabled: False
780
781
782 Key:
783 id: Key_277
784 key_code: 277
785 key_sym: "ins"
786 row: 2
787 col: 1
788 pad_cols: True
789 Key:
790 id: Key_278
791 key_code: 278
792 key_sym: "home"
793 row: 2
794 col: 2
795 pad_cols: True
796 Key:
797 id: Key_280
798 key_code: 280
799 key_sym: "pg_u"
800 row: 2
801 col: 3
802 pad_cols: True
803 Key:
804 id: Key_127
805 key_code: 127
806 key_sym: "del"
807 row: 3
808 col: 1
809 pad_cols: True
810 Key:
811 id: Key_279
812 key_code: 279
813 key_sym: "end"
814 row: 3
815 col: 2
816 pad_cols: True
817 Key:
818 id: Key_281
819 key_code: 281
820 key_sym: "pg_d"
821 row: 3
822 col: 3
823 pad_cols: True
824 Key:
825 id: Key_273
826 key_code: 273
827 key_sym: "up"
828 row: 5
829 col: 2
830 pad_cols: True
831 Key:
832 id: Key_274
833 key_code: 274
834 key_sym: "down"
835 row: 6
836 col: 2
837 pad_cols: True
838 Key:
839 id: Key_276
840 key_code: 276
841 key_sym: "left"
842 row: 6
843 col: 1
844 pad_cols: True
845 Key:
846 id: Key_275
847 key_code: 275
848 key_sym: "right"
849 row: 6
850 col: 3
851 pad_cols: True