From 21ffec315b8fa8a6b46351021da915236148a7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 12 Aug 2016 14:51:32 +0200 Subject: 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 --- music_sampler/actions/interrupt_wait.py | 5 ++++- music_sampler/actions/wait.py | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'music_sampler/actions') 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): action.mapping.interrupt_wait(wait_id) def description(action, wait_id=None, **kwargs): - return _("interrupt wait with id {}").format(wait_id) + if wait_id is None: + return _("interrupt all waits") + else: + 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 @@ import threading def run(action, duration=0, music=None, set_wait_id=None, **kwargs): - if set_wait_id is not None: - action.mapping.add_wait_id(set_wait_id, action) + action.mapping.add_wait(action, wait_id=set_wait_id) action.sleep_event = threading.Event() action.sleep_event_timer = threading.Timer( -- cgit v1.2.3