aboutsummaryrefslogtreecommitdiff
path: root/helpers/mapping.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-06-26 01:20:37 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-06-26 01:20:37 +0200
commitb68b4e8fd7e0769e6c33f68f6b6d9db190a41b54 (patch)
tree04b319313d9a199e09aa663cfc6febe0ad03e7f7 /helpers/mapping.py
parentd8046b94a52262d1453104de2df138a952cb4548 (diff)
downloadMusicSampler-b68b4e8fd7e0769e6c33f68f6b6d9db190a41b54.tar.gz
MusicSampler-b68b4e8fd7e0769e6c33f68f6b6d9db190a41b54.tar.zst
MusicSampler-b68b4e8fd7e0769e6c33f68f6b6d9db190a41b54.zip
Add exit key
Diffstat (limited to 'helpers/mapping.py')
-rw-r--r--helpers/mapping.py11
1 files changed, 10 insertions, 1 deletions
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
5import threading 5import threading
6import pygame 6import pygame
7import yaml 7import yaml
8import sys
8 9
9from .lock import * 10from .lock import *
10from .music_file import * 11from .music_file import *
@@ -29,8 +30,16 @@ class Mapping(RelativeLayout):
29 30
30 def _on_keyboard_down(self, keyboard, keycode, text, modifiers): 31 def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
31 key = self.find_by_key_code(keycode) 32 key = self.find_by_key_code(keycode)
32 if key is not None: 33 if len(modifiers) == 0 and key is not None:
33 threading.Thread(name = "MSKeyAction", target=key.do_actions).start() 34 threading.Thread(name = "MSKeyAction", target=key.do_actions).start()
35 elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'):
36 for thread in threading.enumerate():
37 if thread.getName()[0:2] != "MS":
38 continue
39 thread.join()
40
41 pygame.quit()
42 sys.exit()
34 return True 43 return True
35 44
36 def find_by_key_code(self, key_code): 45 def find_by_key_code(self, key_code):