aboutsummaryrefslogtreecommitdiff
path: root/music_sampler/actions
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-29 18:15:03 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-29 18:44:42 +0200
commit6a3271735186a2b4d3c500f4f60c0c03a12bdd2f (patch)
treee5ceaf01ba400b1ef552fbeec92919826200cd30 /music_sampler/actions
parent7d6df771f603e9642047264f967525422ef09e99 (diff)
downloadMusicSampler-6a3271735186a2b4d3c500f4f60c0c03a12bdd2f.tar.gz
MusicSampler-6a3271735186a2b4d3c500f4f60c0c03a12bdd2f.tar.zst
MusicSampler-6a3271735186a2b4d3c500f4f60c0c03a12bdd2f.zip
Make music_sampler multilingual1.2.0
Diffstat (limited to 'music_sampler/actions')
-rw-r--r--music_sampler/actions/interrupt_wait.py2
-rw-r--r--music_sampler/actions/pause.py4
-rw-r--r--music_sampler/actions/play.py18
-rw-r--r--music_sampler/actions/run_command.py6
-rw-r--r--music_sampler/actions/seek.py8
-rw-r--r--music_sampler/actions/stop.py13
-rw-r--r--music_sampler/actions/stop_all_actions.py2
-rw-r--r--music_sampler/actions/unpause.py4
-rw-r--r--music_sampler/actions/volume.py24
-rw-r--r--music_sampler/actions/wait.py19
10 files changed, 59 insertions, 41 deletions
diff --git a/music_sampler/actions/interrupt_wait.py b/music_sampler/actions/interrupt_wait.py
index 8f465f0..f85a3c4 100644
--- a/music_sampler/actions/interrupt_wait.py
+++ b/music_sampler/actions/interrupt_wait.py
@@ -2,4 +2,4 @@ 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 return _("interrupt wait with id {}").format(wait_id)
diff --git a/music_sampler/actions/pause.py b/music_sampler/actions/pause.py
index bb27734..4575f32 100644
--- a/music_sampler/actions/pause.py
+++ b/music_sampler/actions/pause.py
@@ -5,6 +5,6 @@ def run(action, music=None, **kwargs):
5 5
6def description(action, music=None, **kwargs): 6def description(action, music=None, **kwargs):
7 if music is not None: 7 if music is not None:
8 return "pausing « {} »".format(music.name) 8 return _("pausing « {} »").format(music.name)
9 else: 9 else:
10 return "pausing all musics" 10 return _("pausing all musics")
diff --git a/music_sampler/actions/play.py b/music_sampler/actions/play.py
index fdba95b..f6057ad 100644
--- a/music_sampler/actions/play.py
+++ b/music_sampler/actions/play.py
@@ -19,26 +19,32 @@ def run(action, music=None, fade_in=0, start_at=0,
19 19
20def description(action, music=None, fade_in=0, start_at=0, 20def description(action, music=None, fade_in=0, start_at=0,
21 restart_if_running=False, volume=100, loop=0, **kwargs): 21 restart_if_running=False, volume=100, loop=0, **kwargs):
22 formats = []
22 message = "starting " 23 message = "starting "
23 if music is not None: 24 if music is not None:
24 message += "« {} »".format(music.name) 25 message += "« {} »"
26 formats.append(music.name)
25 else: 27 else:
26 message += "all musics" 28 message += "all musics"
27 29
28 if start_at != 0: 30 if start_at != 0:
29 message += " at {}s".format(start_at) 31 message += " at {}s"
32 formats.append(start_at)
30 33
31 if fade_in != 0: 34 if fade_in != 0:
32 message += " with {}s fade_in".format(fade_in) 35 message += " with {}s fade_in"
36 formats.append(fade_in)
33 37
34 message += " at volume {}%".format(volume) 38 message += " at volume {}%"
39 formats.append(volume)
35 40
36 if loop > 0: 41 if loop > 0:
37 message += " {} times".format(loop + 1) 42 message += " {} times"
43 formats.append(loop + 1)
38 elif loop < 0: 44 elif loop < 0:
39 message += " in loop" 45 message += " in loop"
40 46
41 if restart_if_running: 47 if restart_if_running:
42 message += " (restarting if already running)" 48 message += " (restarting if already running)"
43 49
44 return message 50 return _(message).format(*formats)
diff --git a/music_sampler/actions/run_command.py b/music_sampler/actions/run_command.py
index 1e80c1e..df23056 100644
--- a/music_sampler/actions/run_command.py
+++ b/music_sampler/actions/run_command.py
@@ -6,8 +6,10 @@ def run(action, command="", wait=False, **kwargs):
6 action.process.wait() 6 action.process.wait()
7 7
8def description(action, command="", wait=False, **kwargs): 8def description(action, command="", wait=False, **kwargs):
9 message = "running command {}".format(command) 9 formats = []
10 message = "running command {}"
11 formats.append(command)
10 if wait: 12 if wait:
11 message += " (waiting for its execution to finish)" 13 message += " (waiting for its execution to finish)"
12 14
13 return message 15 return _(message).format(*formats)
diff --git a/music_sampler/actions/seek.py b/music_sampler/actions/seek.py
index 467af7d..9f19798 100644
--- a/music_sampler/actions/seek.py
+++ b/music_sampler/actions/seek.py
@@ -5,15 +5,15 @@ def run(action, music=None, value=0, delta=False, **kwargs):
5def description(action, music=None, value=0, delta=False, **kwargs): 5def description(action, music=None, value=0, delta=False, **kwargs):
6 if delta: 6 if delta:
7 if music is not None: 7 if music is not None:
8 return "moving music « {} » by {:+d}s" \ 8 return _("moving music « {} » by {:+d}s") \
9 .format(music.name, value) 9 .format(music.name, value)
10 else: 10 else:
11 return "moving all musics by {:+d}s" \ 11 return _("moving all musics by {:+d}s") \
12 .format(value) 12 .format(value)
13 else: 13 else:
14 if music is not None: 14 if music is not None:
15 return "moving music « {} » to position {}s" \ 15 return _("moving music « {} » to position {}s") \
16 .format(music.name, value) 16 .format(music.name, value)
17 else: 17 else:
18 return "moving all musics to position {}s" \ 18 return _("moving all musics to position {}s") \
19 .format(value) 19 .format(value)
diff --git a/music_sampler/actions/stop.py b/music_sampler/actions/stop.py
index 88cc66d..769c312 100644
--- a/music_sampler/actions/stop.py
+++ b/music_sampler/actions/stop.py
@@ -19,22 +19,25 @@ def run(action, music=None, fade_out=0, wait=False,
19def description(action, music=None, fade_out=0, wait=False, 19def description(action, music=None, fade_out=0, wait=False,
20 set_wait_id=None, **kwargs): 20 set_wait_id=None, **kwargs):
21 21
22 formats = []
22 message = "stopping " 23 message = "stopping "
23 if music is not None: 24 if music is not None:
24 message += "music « {} »".format(music.name) 25 message += "music « {} »"
26 formats.append(music.name)
25 else: 27 else:
26 message += "all musics" 28 message += "all musics"
27 29
28 if fade_out > 0: 30 if fade_out > 0:
29 message += " with {}s fadeout".format(fade_out) 31 message += " with {}s fadeout"
32 formats.append(fade_out)
30 if wait: 33 if wait:
31 if set_wait_id is not None: 34 if set_wait_id is not None:
32 message += " (waiting the end of fadeout, with id {})"\ 35 message += " (waiting the end of fadeout, with id {})"
33 .format(set_wait_id) 36 formats.append(set_wait_id)
34 else: 37 else:
35 message += " (waiting the end of fadeout)" 38 message += " (waiting the end of fadeout)"
36 39
37 return message 40 return _(message).format(*formats)
38 41
39def interrupt(action, music=None, fade_out=0, wait=False, 42def interrupt(action, music=None, fade_out=0, wait=False,
40 set_wait_id=None, **kwargs): 43 set_wait_id=None, **kwargs):
diff --git a/music_sampler/actions/stop_all_actions.py b/music_sampler/actions/stop_all_actions.py
index 4ea875a..14a1a94 100644
--- a/music_sampler/actions/stop_all_actions.py
+++ b/music_sampler/actions/stop_all_actions.py
@@ -11,4 +11,4 @@ def description(action, other_only=False, **kwargs):
11 if other_only: 11 if other_only:
12 message += " except this key" 12 message += " except this key"
13 13
14 return message 14 return _(message)
diff --git a/music_sampler/actions/unpause.py b/music_sampler/actions/unpause.py
index 5fa88c3..6505ab8 100644
--- a/music_sampler/actions/unpause.py
+++ b/music_sampler/actions/unpause.py
@@ -5,6 +5,6 @@ def run(action, music=None, **kwargs):
5 5
6def description(action, music=None, **kwargs): 6def description(action, music=None, **kwargs):
7 if music is not None: 7 if music is not None:
8 return "unpausing « {} »".format(music.name) 8 return _("unpausing « {} »").format(music.name)
9 else: 9 else:
10 return "unpausing all musics" 10 return _("unpausing all musics")
diff --git a/music_sampler/actions/volume.py b/music_sampler/actions/volume.py
index 7dda3c1..e02cdfa 100644
--- a/music_sampler/actions/volume.py
+++ b/music_sampler/actions/volume.py
@@ -6,23 +6,27 @@ def run(action, music=None, value=100, fade=0, delta=False, **kwargs):
6 6
7def description(action, music=None, 7def description(action, music=None,
8 value=100, delta=False, fade=0, **kwargs): 8 value=100, delta=False, fade=0, **kwargs):
9 formats = []
9 message = "" 10 message = ""
10 if delta: 11 if delta:
11 if music is not None: 12 if music is not None:
12 message += "{:+d}% to volume of « {} »" \ 13 message += "{:+d}% to volume of « {} »"
13 .format(value, music.name) 14 formats.append(value)
15 formats.append(music.name)
14 else: 16 else:
15 message += "{:+d}% to volume" \ 17 message += "{:+d}% to volume"
16 .format(value) 18 formats.append(value)
17 else: 19 else:
18 if music is not None: 20 if music is not None:
19 message += "setting volume of « {} » to {}%" \ 21 message += "setting volume of « {} » to {}%"
20 .format(music.name, value) 22 formats.append(music.name)
23 formats.append(value)
21 else: 24 else:
22 message += "setting volume to {}%" \ 25 message += "setting volume to {}%"
23 .format(value) 26 formats.append(value)
24 27
25 if fade > 0: 28 if fade > 0:
26 message += " with {}s fade".format(fade) 29 message += " with {}s fade"
30 formats.append(fade)
27 31
28 return message 32 return _(message).format(*formats)
diff --git a/music_sampler/actions/wait.py b/music_sampler/actions/wait.py
index ea42408..e6d07f2 100644
--- a/music_sampler/actions/wait.py
+++ b/music_sampler/actions/wait.py
@@ -16,21 +16,24 @@ def run(action, duration=0, music=None, set_wait_id=None, **kwargs):
16 action.sleep_event.wait() 16 action.sleep_event.wait()
17 17
18def description(action, duration=0, music=None, set_wait_id=None, **kwargs): 18def description(action, duration=0, music=None, set_wait_id=None, **kwargs):
19 formats = []
19 message = "" 20 message = ""
20 if music is None: 21 if music is None:
21 message += "waiting {}s" \ 22 message += "waiting {}s"
22 .format(duration) 23 formats.append(duration)
23 elif duration == 0: 24 elif duration == 0:
24 message += "waiting the end of « {} »" \ 25 message += "waiting the end of « {} »"
25 .format(music.name) 26 formats.append(music.name)
26 else: 27 else:
27 message += "waiting the end of « {} » + {}s" \ 28 message += "waiting the end of « {} » + {}s"
28 .format(music.name, duration) 29 formats.append(music.name)
30 formats.append(duration)
29 31
30 if set_wait_id is not None: 32 if set_wait_id is not None:
31 message += " (setting id = {})".format(set_wait_id) 33 message += " (setting id = {})"
34 formats.append(set_wait_id)
32 35
33 return message 36 return _(message).format(*formats)
34 37
35def interrupt(action, duration=0, music=None, **kwargs): 38def interrupt(action, duration=0, music=None, **kwargs):
36 if action.sleep_event is not None: 39 if action.sleep_event is not None: