aboutsummaryrefslogblamecommitdiff
path: root/music_sampler.kv
blob: 4a44069c03bf1154f023470ad59f2cafbaf3e63d (plain) (tree)
1
2
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
                  
                  
































                                                                                                                                                    
                                              










                                                                              
                                                    









                                                                              
                                                    










                                                                                                      






                                        


















                                                                                     































                                                                                           

























                                                                       
 

                         
                                              









                                                                          
                                             
                                                                          
                                                            








                                                                                          
                                                    
                                                                          
                                                                   
















                                                                                          

        
                      
                                             
                                                                          
                                                            








                                                              
                                                                                                 
                                                                   

























































































































































































































































































































































































































































































































































































                                                                          
#:import math math
#:import h helpers

<Key>:
  pad_col_sep: 0 if not self.pad_cols else self.parent.pad_x
  pad_cols: False

  y: (self.parent.top-self.parent.y) - (self.row) * self.parent.key_size - (self.row - 1) * self.parent.key_sep
  x: (self.col - 1) * self.parent.key_size + int(self.col - 1) * self.parent.key_sep + self.pad_col_sep
  size_hint: None, None
  line_color: 120/255, 120/255, 120/255, 1
  enabled: True
  line_width: 2
  row: 1
  col: 0
  key_code: 0
  key_sym: ""
  key_width: 1
  key_height: 1
  width: self.key_width * (self.parent.key_size + self.parent.key_sep) - self.parent.key_sep
  height: self.key_height * (self.parent.key_size + self.parent.key_sep) - self.parent.key_sep
  canvas.before:
    Color:
      rgba: self.color
    RoundedRectangle:
      pos:  self.x, self.y
      size: self.size
  canvas:
    Color:
      rgba: self.line_color
    Line:
      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
      width: self.line_width
  Label:
    id: key_label
    font_name: h.path() + "fonts/Ubuntu-B.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size))
    color: 0, 0, 0, 1
    text: self.parent.key_sym
    text_size: self.parent.width,self.font_size
    shorten: True
    shorten_from: "right"
    split_str: ""
    center_x: self.parent.x + self.texture_size[0] /2 + 5
    center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5
  Label:
    id: key_description_title
    font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2))
    color: 0, 0, 0, 1
    text: self.parent.description_title
    text_size: self.parent.width - 2*self.parent.line_width, self.font_size
    halign: "right"
    valign: "middle"
    center_x: self.parent.x + self.texture_size[0] /2
    center_y: self.parent.y + self.parent.height - self.texture_size[1] /2 - 5
  Label:
    id: key_description
    font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size / 2))
    color: 0, 0, 0, 1
    text: "\n".join(self.parent.description)
    text_size: 2 * self.parent.width,self.parent.height - key_label.font_size
    halign: "left"
    valign: "middle"
    pos: self.parent.x + 2 * self.parent.line_width + 2, self.parent.y
    size_hint: None, None
    size: 2 * self.parent.width - 2 * self.parent.line_width, self.parent.height - key_label.font_size

<Screen>:
  canvas:
    Color:
      rgba: 229/255, 228/255, 226/255, 1
    Rectangle:
      pos: 0, 0
      size: self.width, self.height

  key_size: int( (3 * self.width - 16) / 56)
  key_sep: int( self.key_size / 24)
  key_pad_sep: int( self.key_size / 7) + 1

  border: (self.width - self.key_size * 18 - self.key_sep * 16 - self.key_pad_sep)/ 2

  mapping_height: self.key_size * 6 + self.key_sep * 5
  mapping_width: self.key_size * 18 + self.key_sep * 16 + self.key_pad_sep
  mapping_x: self.border
  mapping_y: self.top - self.mapping_height - self.border
  action_list_height: self.height - self.mapping_height - 3 * self.border
  action_list_width: 3 * self.width / 4
  action_list_x: self.border
  action_list_y: self.border
  play_list_height: self.action_list_height
  play_list_width: self.width - self.action_list_width - 3* self.border
  play_list_y: self.border
  play_list_x: self.action_list_width + 2 * self.border

  min_height: min(mock_symbola.height, mock_ubuntu_regular.height, mock_ubuntu_bold.height)
  symbola_line_height: self.min_height / max(mock_symbola.height,1)
  ubuntu_regular_line_height: self.min_height / max(mock_ubuntu_regular.height,1)
  ubuntu_bold_line_height: self.min_height / max(mock_ubuntu_bold.height,1)
  Label:
    id: mock_symbola
    font_name: h.path() + "fonts/Symbola.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
    color: 0, 0, 0, 0
    text: "A"
    text_size: None, None
    size_hint: None, None
    size: self.texture_size
  Label:
    id: mock_ubuntu_regular
    font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
    color: 0, 0, 0, 0
    text: "A"
    text_size: None, None
    size_hint: None, None
    size: self.texture_size
  Label:
    id: mock_ubuntu_bold
    font_name: h.path() + "fonts/Ubuntu-B.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.key_size or 10))
    color: 0, 0, 0, 0
    text: "A"
    text_size: None, None
    size_hint: None, None
    size: self.texture_size

  Mapping:
    id: Mapping
    pos: self.parent.mapping_x, self.parent.mapping_y
    size: self.parent.mapping_width, self.parent.mapping_height

    key_size: self.parent.key_size
    key_sep: self.parent.key_sep
    key_pad_sep: self.parent.key_pad_sep
    pad_x: self.key_size * 15 + 14 * self.key_sep + self.key_pad_sep
  ActionList:
    id: ActionList
    pos: self.parent.action_list_x, self.parent.action_list_y
    size: self.parent.action_list_width, self.parent.action_list_height
  PlayList:
    id: PlayList
    pos: self.parent.play_list_x, self.parent.play_list_y
    size: self.parent.play_list_width, self.parent.play_list_height

<ActionList>:
  size_hint: None, None
  canvas:
    Color:
      rgba: 250./255, 250./255, 250./255, 1
    Rectangle:
      pos:  0, 0
      size: self.width, self.height

  Label:
    id: action_list_title
    font_name: h.path() + "fonts/Ubuntu-B.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
    color: 0, 0, 0, 1
    text: self.parent.action_title
    text_size: None, self.parent.height
    halign: "left"
    valign: "top"
    size_hint: None, None
    size: self.texture_size[0], self.parent.height
  Label:
    id: action_list_icons
    font_name: h.path() + "fonts/Symbola.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
    line_height: self.parent.parent.symbola_line_height or 1
    color: 0, 0, 0, 1
    text: "\n".join(map(lambda x: x[0], self.parent.action_list))
    text_size: None, self.parent.height
    halign: "left"
    valign: "top"
    size_hint: None, None
    size: self.texture_size[0], self.parent.height - 3 * self.line_height * self.font_size
  Label:
    id: action_list_names
    font_name: h.path() + "fonts/Ubuntu-Regular.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
    line_height: self.parent.parent.ubuntu_regular_line_height or 1
    color: 0, 0, 0, 1
    text: "\n".join(map(lambda x: x[1], self.parent.action_list))
    text_size: None, self.parent.height
    halign: "left"
    valign: "top"
    size_hint: None, None
    pos: 15, self.y
    size: self.texture_size[0], self.parent.height - 3 * self.line_height * self.font_size
  
<PlayList>:
  size_hint: None, None
  canvas:
    Color:
      rgba: 250./255, 250./255, 250./255, 1
    Rectangle:
      pos:  0, 0
      size: self.width, self.height

  Label:
    id: playlist_icons
    font_name: h.path() + "fonts/Symbola.ttf"
    font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
    line_height: self.parent.parent.symbola_line_height or 1
    color: 0, 0, 0, 1
    text: "\n".join(map(lambda x: x[0], self.parent.playlist))
    text_size: None, self.parent.height
    halign: "left"
    valign: "top"
    size_hint: None, None
    size: self.texture_size[0], self.parent.height
  Label:
    id: playlist_names
    font_name: h.path() + "fonts/Ubuntu-Regular.ttf" # FIXME: Mettre en gras quand c'est en cours
    line_height: self.parent.parent.ubuntu_regular_line_height or 1
    font_size: math.ceil(2 * math.sqrt(self.parent.parent.key_size or 10))
    color: 0, 0, 0, 1
    text: "\n".join(map(lambda x: x[1], self.parent.playlist))
    text_size: None, self.parent.height
    halign: "left"
    valign: "top"
    size_hint: None, None
    pos: 15, self.y
    size: self.texture_size[0], self.parent.height
 
<Mapping>:
  size_hint: None, None
  key_size: 48
  key_sep: 2
  key_pad_sep: 7
  pad_x: 755
  canvas:
    Color:
      rgba: 250./255, 250./255, 250./255, 1
    Rectangle:
      pos:  0, 0
      size: self.width, self.height
  Key:
    id: Key_27
    key_code: 27
    key_sym: "ESC"
    row: 1
    col: 1
  Key:
    id: Key_282
    key_code: 282
    key_sym: "F1"
    row: 1
    col: 3
  Key:
    id: Key_283
    key_code: 283
    key_sym: "F2"
    row: 1
    col: 4
  Key:
    id: Key_284
    key_code: 284
    key_sym: "F3"
    row: 1
    col: 5
  Key:
    id: Key_285
    key_code: 285
    key_sym: "F4"
    row: 1
    col: 6

  Key:
    id: Key_286
    key_code: 286
    key_sym: "F5"
    row: 1
    col: 7.5
  Key:
    id: Key_287
    key_code: 287
    key_sym: "F6"
    row: 1
    col: 8.5
  Key:
    id: Key_288
    key_code: 288
    key_sym: "F7"
    row: 1
    col: 9.5
  Key:
    id: Key_289
    key_code: 289
    key_sym: "F8"
    row: 1
    col: 10.5

  Key:
    id: Key_290
    key_code: 290
    key_sym: "F9"
    row: 1
    col: 12
  Key:
    id: Key_291
    key_code: 291
    key_sym: "F10"
    row: 1
    col: 13
  Key:
    id: Key_292
    key_code: 292
    key_sym: "F11"
    row: 1
    col: 14
  Key:
    id: Key_293
    key_code: 293
    key_sym: "F12"
    row: 1
    col: 15

  Key:
    id: Key_178
    key_code: 178
    key_sym: "²"
    row: 2
    col: 1
  Key:
    id: Key_38
    key_code: 38
    key_sym: "&"
    row: 2
    col: 2
  Key:
    id: Key_233
    key_code: 233
    key_sym: "é"
    row: 2
    col: 3
  Key:
    id: Key_34
    key_code: 34
    key_sym: '"'
    row: 2
    col: 4
  Key:
    id: Key_39
    key_code: 39
    key_sym: "'"
    row: 2
    col: 5
  Key:
    id: Key_40
    key_code: 40
    key_sym: "("
    row: 2
    col: 6
  Key:
    id: Key_45
    key_code: 45
    key_sym: "-"
    row: 2
    col: 7
  Key:
    id: Key_232
    key_code: 232
    key_sym: "è"
    row: 2
    col: 8
  Key:
    id: Key_95
    key_code: 95
    key_sym: "_"
    row: 2
    col: 9
  Key:
    id: Key_231
    key_code: 231
    key_sym: "ç"
    row: 2
    col: 10
  Key:
    id: Key_224
    key_code: 224
    key_sym: "à"
    row: 2
    col: 11
  Key:
    id: Key_41
    key_code: 41
    key_sym: ")"
    row: 2
    col: 12
  Key:
    id: Key_61
    key_code: 61
    key_sym: "="
    row: 2
    col: 13
  Key:
    id: Key_8
    key_code: 8
    key_sym: "<-"
    row: 2
    col: 14
    key_width: 2
  Key:
    id: Key_9
    key_code: 9
    key_sym: "tab"
    row: 3
    col: 1
    key_width: 1.48
  Key:
    id: Key_97
    key_code: 97
    key_sym: "a"
    row: 3
    col: 2.5
  Key:
    id: Key_122
    key_code: 122
    key_sym: "z"
    row: 3
    col: 3.5
  Key:
    id: Key_101
    key_code: 101
    key_sym: "e"
    row: 3
    col: 4.5
  Key:
    id: Key_114
    key_code: 114
    key_sym: "r"
    row: 3
    col: 5.5
  Key:
    id: Key_116
    key_code: 116
    key_sym: "t"
    row: 3
    col: 6.5
  Key:
    id: Key_121
    key_code: 121
    key_sym: "y"
    row: 3
    col: 7.5
  Key:
    id: Key_117
    key_code: 117
    key_sym: "u"
    row: 3
    col: 8.5
  Key:
    id: Key_105
    key_code: 105
    key_sym: "i"
    row: 3
    col: 9.5
  Key:
    id: Key_111
    key_code: 111
    key_sym: "o"
    row: 3
    col: 10.5
  Key:
    id: Key_112
    key_code: 112
    key_sym: "p"
    row: 3
    col: 11.5
  Key:
    id: Key_94
    key_code: 94
    key_sym: "^"
    row: 3
    col: 12.5
  Key:
    id: Key_36
    key_code: 36
    key_sym: "$"
    row: 3
    col: 13.5
  Key:
    id: Key_13
    key_code: 13
    key_sym: "Enter"
    row: 4
    col: 14.8
    key_width: 1.23
    key_height: 2
  Key:
    id: Key_301
    key_code: 301
    key_sym: "CAPS"
    row: 4
    col: 1
    key_width: 1.75
    line_width: 1
    enabled: False

  Key:
    id: Key_113
    key_code: 113
    key_sym: "q"
    row: 4
    col: 2.8
  Key:
    id: Key_115
    key_code: 115
    key_sym: "s"
    row: 4
    col: 3.8
  Key:
    id: Key_100
    key_code: 100
    key_sym: "d"
    row: 4
    col: 4.8
  Key:
    id: Key_102
    key_code: 102
    key_sym: "f"
    row: 4
    col: 5.8
  Key:
    id: Key_103
    key_code: 103
    key_sym: "g"
    row: 4
    col: 6.8
  Key:
    id: Key_104
    key_code: 104
    key_sym: "h"
    row: 4
    col: 7.8
  Key:
    id: Key_106
    key_code: 106
    key_sym: "j"
    row: 4
    col: 8.8
  Key:
    id: Key_107
    key_code: 107
    key_sym: "k"
    row: 4
    col: 9.8
  Key:
    id: Key_108
    key_code: 108
    key_sym: "l"
    row: 4
    col: 10.8
  Key:
    id: Key_109
    key_code: 109
    key_sym: "m"
    row: 4
    col: 11.8
  Key:
    id: Key_249
    key_code: 249
    key_sym: "ù"
    row: 4
    col: 12.8
  Key:
    id: Key_42
    key_code: 42
    key_sym: "*"
    row: 4
    col: 13.8
  Key:
    id: Key_304
    key_code: 304
    key_sym: "LShift"
    row: 5
    col: 1
    key_width: 1.3
    line_width: 1
    enabled: False
  Key:
    id: Key_60
    key_code: 60
    key_sym: "<"
    row: 5
    col: 2.3
  Key:
    id: Key_119
    key_code: 119
    key_sym: "w"
    row: 5
    col: 3.3
  Key:
    id: Key_120
    key_code: 120
    key_sym: "x"
    row: 5
    col: 4.3
  Key:
    id: Key_99
    key_code: 99
    key_sym: "c"
    row: 5
    col: 5.3
  Key:
    id: Key_118
    key_code: 118
    key_sym: "v"
    row: 5
    col: 6.3
  Key:
    id: Key_98
    key_code: 98
    key_sym: "b"
    row: 5
    col: 7.3
  Key:
    id: Key_110
    key_code: 110
    key_sym: "n"
    row: 5
    col: 8.3
  Key:
    id: Key_44
    key_code: 44
    key_sym: ","
    row: 5
    col: 9.3
  Key:
    id: Key_59
    key_code: 59
    key_sym: ";"
    row: 5
    col: 10.3
  Key:
    id: Key_58
    key_code: 58
    key_sym: ":"
    row: 5
    col: 11.3
  Key:
    id: Key_33
    key_code: 33
    key_sym: "!"
    row: 5
    col: 12.3
  Key:
    id: Key_303
    key_code: 303
    key_sym: "RShift"
    row: 5
    col: 13.3
    key_width: 2.7
    line_width: 1
    enabled: False
  Key:
    id: Key_306
    key_code: 306
    key_sym: "LCtrl"
    row: 6
    col: 1
    key_width: 1.3
    line_width: 1
    enabled: False
  Key:
    id: Key_311
    key_code: 311
    key_sym: "LSuper"
    row: 6
    col: 3.3
    line_width: 1
    enabled: False
  Key:
    id: Key_308
    key_code: 308
    key_sym: "LAlt"
    row: 6
    col: 4.3
    line_width: 1
    enabled: False
  Key:
    id: Key_32
    key_code: 32
    key_sym: "Espace"
    row: 6
    col: 5.3
    key_width: 5
  Key:
    id: Key_313
    key_code: 313
    key_sym: "AltGr"
    row: 6
    col: 10.3
    line_width: 1
    enabled: False
  Key:
    id: Key_314
    key_code: 314
    key_sym: "Compose"
    row: 6
    col: 11.3
    line_width: 1
    enabled: False
  Key:
    id: Key_305
    key_code: 305
    key_sym: "RCtrl"
    row: 6
    col: 12.3
    key_width: 1.3
    line_width: 1
    enabled: False


  Key:
    id: Key_277
    key_code: 277
    key_sym: "ins"
    row: 2
    col: 1
    pad_cols: True
  Key:
    id: Key_278
    key_code: 278
    key_sym: "home"
    row: 2
    col: 2
    pad_cols: True
  Key:
    id: Key_280
    key_code: 280
    key_sym: "pg_u"
    row: 2
    col: 3
    pad_cols: True
  Key:
    id: Key_127
    key_code: 127
    key_sym: "del"
    row: 3
    col: 1
    pad_cols: True
  Key:
    id: Key_279
    key_code: 279
    key_sym: "end"
    row: 3
    col: 2
    pad_cols: True
  Key:
    id: Key_281
    key_code: 281
    key_sym: "pg_d"
    row: 3
    col: 3
    pad_cols: True
  Key:
    id: Key_273
    key_code: 273
    key_sym: "up"
    row: 5
    col: 2
    pad_cols: True
  Key:
    id: Key_274
    key_code: 274
    key_sym: "down"
    row: 6
    col: 2
    pad_cols: True
  Key:
    id: Key_276
    key_code: 276
    key_sym: "left"
    row: 6
    col: 1
    pad_cols: True
  Key:
    id: Key_275
    key_code: 275
    key_sym: "right"
    row: 6
    col: 3
    pad_cols: True