aboutsummaryrefslogtreecommitdiff
path: root/music_sampler/mapping.py
diff options
context:
space:
mode:
Diffstat (limited to 'music_sampler/mapping.py')
-rw-r--r--music_sampler/mapping.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/music_sampler/mapping.py b/music_sampler/mapping.py
index 74feec8..e589ac0 100644
--- a/music_sampler/mapping.py
+++ b/music_sampler/mapping.py
@@ -124,22 +124,24 @@ class Mapping(RelativeLayout):
124 threading.Thread(name="MSKeyAction", target=key.run, 124 threading.Thread(name="MSKeyAction", target=key.run,
125 args=['-'.join(modifiers)]).start() 125 args=['-'.join(modifiers)]).start()
126 elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'): 126 elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'):
127 self.keyboard.unbind(on_key_down=self.on_keyboard_down) 127 self.leave_application()
128 self.stop_all_running()
129 for music in self.open_files.values():
130 music.stop()
131 for thread in threading.enumerate():
132 if thread.getName()[0:2] == "MS":
133 thread.join()
134 elif thread.__class__ == threading.Timer:
135 thread.cancel()
136 thread.join()
137
138 sys.exit() 128 sys.exit()
139 elif 'ctrl' in modifiers and keycode[0] == 114: 129 elif 'ctrl' in modifiers and keycode[0] == 114:
140 threading.Thread(name="MSReload", target=self.reload).start() 130 threading.Thread(name="MSReload", target=self.reload).start()
141 return True 131 return True
142 132
133 def leave_application(self):
134 self.keyboard.unbind(on_key_down=self.on_keyboard_down)
135 self.stop_all_running()
136 for music in self.open_files.values():
137 music.stop()
138 for thread in threading.enumerate():
139 if thread.getName()[0:2] == "MS":
140 thread.join()
141 elif thread.__class__ == threading.Timer:
142 thread.cancel()
143 thread.join()
144
143 # Helpers 145 # Helpers
144 def allowed_modifiers(self, modifiers): 146 def allowed_modifiers(self, modifiers):
145 allowed = [] 147 allowed = []