]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/commitdiff
Cancel all timers and stop all musics when exiting tags/1.0.2 1.0.2
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 29 Jul 2016 01:22:33 +0000 (03:22 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 29 Jul 2016 01:34:17 +0000 (03:34 +0200)
music_sampler/mapping.py

index 0d58d3024fc51fb731ce7f39a4bc0432cd410ad3..74feec886f6f37b623b484314ac0012b927abafb 100644 (file)
@@ -124,11 +124,16 @@ class Mapping(RelativeLayout):
             threading.Thread(name="MSKeyAction", target=key.run,
                     args=['-'.join(modifiers)]).start()
         elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'):
+            self.keyboard.unbind(on_key_down=self.on_keyboard_down)
             self.stop_all_running()
+            for music in self.open_files.values():
+                music.stop()
             for thread in threading.enumerate():
-                if thread.getName()[0:2] != "MS":
-                    continue
-                thread.join()
+                if thread.getName()[0:2] == "MS":
+                    thread.join()
+                elif thread.__class__ == threading.Timer:
+                    thread.cancel()
+                    thread.join()
 
             sys.exit()
         elif 'ctrl' in modifiers and keycode[0] == 114: