aboutsummaryrefslogtreecommitdiff
path: root/music_sampler/actions
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-12 14:51:32 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-12 14:51:32 +0200
commit21ffec315b8fa8a6b46351021da915236148a7b1 (patch)
tree52951646c8f9d1ea453c58aa37c92e64ff0dd9a1 /music_sampler/actions
parent4094ae4ebff7997e8c5e0fd84a1434b1b86632b1 (diff)
downloadMusicSampler-21ffec315b8fa8a6b46351021da915236148a7b1.tar.gz
MusicSampler-21ffec315b8fa8a6b46351021da915236148a7b1.tar.zst
MusicSampler-21ffec315b8fa8a6b46351021da915236148a7b1.zip
Make 'interrupt_wait' able to interrupt all waits
If 'wait_id' is not specified, interrupt_wait will now stop all wait events. This fixes https://git.immae.eu/mantisbt/view.php?id=4
Diffstat (limited to 'music_sampler/actions')
-rw-r--r--music_sampler/actions/interrupt_wait.py5
-rw-r--r--music_sampler/actions/wait.py3
2 files changed, 5 insertions, 3 deletions
diff --git a/music_sampler/actions/interrupt_wait.py b/music_sampler/actions/interrupt_wait.py
index f85a3c4..b367628 100644
--- a/music_sampler/actions/interrupt_wait.py
+++ b/music_sampler/actions/interrupt_wait.py
@@ -2,4 +2,7 @@ def run(action, wait_id=None, **kwargs):
2 action.mapping.interrupt_wait(wait_id) 2 action.mapping.interrupt_wait(wait_id)
3 3
4def description(action, wait_id=None, **kwargs): 4def description(action, wait_id=None, **kwargs):
5 return _("interrupt wait with id {}").format(wait_id) 5 if wait_id is None:
6 return _("interrupt all waits")
7 else:
8 return _("interrupt wait with id {}").format(wait_id)
diff --git a/music_sampler/actions/wait.py b/music_sampler/actions/wait.py
index e6d07f2..bcee649 100644
--- a/music_sampler/actions/wait.py
+++ b/music_sampler/actions/wait.py
@@ -1,8 +1,7 @@
1import threading 1import threading
2 2
3def run(action, duration=0, music=None, set_wait_id=None, **kwargs): 3def run(action, duration=0, music=None, set_wait_id=None, **kwargs):
4 if set_wait_id is not None: 4 action.mapping.add_wait(action, wait_id=set_wait_id)
5 action.mapping.add_wait_id(set_wait_id, action)
6 5
7 action.sleep_event = threading.Event() 6 action.sleep_event = threading.Event()
8 action.sleep_event_timer = threading.Timer( 7 action.sleep_event_timer = threading.Timer(