X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=helpers%2Fmapping.py;h=66d860d9bcf58b7ca747e4102a4b37f1838abebc;hb=b68b4e8fd7e0769e6c33f68f6b6d9db190a41b54;hp=4a1cd980e67546395267044206e0ca415090afe1;hpb=d8046b94a52262d1453104de2df138a952cb4548;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git diff --git a/helpers/mapping.py b/helpers/mapping.py index 4a1cd98..66d860d 100644 --- a/helpers/mapping.py +++ b/helpers/mapping.py @@ -5,6 +5,7 @@ from kivy.core.window import Window import threading import pygame import yaml +import sys from .lock import * from .music_file import * @@ -29,8 +30,16 @@ class Mapping(RelativeLayout): def _on_keyboard_down(self, keyboard, keycode, text, modifiers): key = self.find_by_key_code(keycode) - if key is not None: + if len(modifiers) == 0 and key is not None: threading.Thread(name = "MSKeyAction", target=key.do_actions).start() + elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'): + for thread in threading.enumerate(): + if thread.getName()[0:2] != "MS": + continue + thread.join() + + pygame.quit() + sys.exit() return True def find_by_key_code(self, key_code):