From b68b4e8fd7e0769e6c33f68f6b6d9db190a41b54 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 26 Jun 2016 01:20:37 +0200 Subject: [PATCH] Add exit key --- helpers/mapping.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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): -- 2.41.0