diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-29 03:22:33 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-29 03:34:17 +0200 |
commit | a49f93078f02c611090132ce9cab6edca31a3f9b (patch) | |
tree | 0049e3e5a421595fff55abf825f20b849e9382d4 /music_sampler | |
parent | dd25f8f05f091ba876b784e3fd4ae6df309bd4a1 (diff) | |
download | MusicSampler-a49f93078f02c611090132ce9cab6edca31a3f9b.tar.gz MusicSampler-a49f93078f02c611090132ce9cab6edca31a3f9b.tar.zst MusicSampler-a49f93078f02c611090132ce9cab6edca31a3f9b.zip |
Cancel all timers and stop all musics when exiting1.0.2
Diffstat (limited to 'music_sampler')
-rw-r--r-- | music_sampler/mapping.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/music_sampler/mapping.py b/music_sampler/mapping.py index 0d58d30..74feec8 100644 --- a/music_sampler/mapping.py +++ b/music_sampler/mapping.py | |||
@@ -124,11 +124,16 @@ 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.stop_all_running() | 128 | self.stop_all_running() |
129 | for music in self.open_files.values(): | ||
130 | music.stop() | ||
128 | for thread in threading.enumerate(): | 131 | for thread in threading.enumerate(): |
129 | if thread.getName()[0:2] != "MS": | 132 | if thread.getName()[0:2] == "MS": |
130 | continue | 133 | thread.join() |
131 | thread.join() | 134 | elif thread.__class__ == threading.Timer: |
135 | thread.cancel() | ||
136 | thread.join() | ||
132 | 137 | ||
133 | sys.exit() | 138 | sys.exit() |
134 | elif 'ctrl' in modifiers and keycode[0] == 114: | 139 | elif 'ctrl' in modifiers and keycode[0] == 114: |