aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-11 18:41:31 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-11 18:43:24 +0200
commit814c30c6835b25d06977af1dd2d1e565c45121cc (patch)
treee8f4951e847ee94783a78ef6e83fab4233987492
parentba21932596c3b6d1a2ce1e1a22b6417e1c509865 (diff)
downloadMusicSampler-814c30c6835b25d06977af1dd2d1e565c45121cc.tar.gz
MusicSampler-814c30c6835b25d06977af1dd2d1e565c45121cc.tar.zst
MusicSampler-814c30c6835b25d06977af1dd2d1e565c45121cc.zip
Add protect_delay message when available1.2.1
Fixes https://git.immae.eu/mantisbt/view.php?id=18
-rw-r--r--music_sampler/app_blocks/actionlist.py10
-rw-r--r--music_sampler/key.py12
-rw-r--r--music_sampler/locales/fr/LC_MESSAGES/music_sampler.po4
3 files changed, 23 insertions, 3 deletions
diff --git a/music_sampler/app_blocks/actionlist.py b/music_sampler/app_blocks/actionlist.py
index 8c4c5e9..f48072f 100644
--- a/music_sampler/app_blocks/actionlist.py
+++ b/music_sampler/app_blocks/actionlist.py
@@ -15,7 +15,15 @@ class ActionList(RelativeLayout):
15 action_list = ListProperty([]) 15 action_list = ListProperty([])
16 16
17 def update_list(self, key, action_descriptions): 17 def update_list(self, key, action_descriptions):
18 self.action_title = _("actions linked to key {}:").format(key.key_sym) 18 if key.repeat_delay > 0:
19 self.action_title = _(
20 "actions linked to key {} (repeat protection {}s):"
21 ).format(key.key_sym, key.repeat_delay)
22 else:
23 self.action_title = _(
24 "actions linked to key {}:"
25 ).format(key.key_sym)
26
19 action_list = [] 27 action_list = []
20 28
21 for [action, status] in action_descriptions: 29 for [action, status] in action_descriptions:
diff --git a/music_sampler/key.py b/music_sampler/key.py
index 534a3db..b73a29c 100644
--- a/music_sampler/key.py
+++ b/music_sampler/key.py
@@ -159,9 +159,9 @@ class KeyMachine(Widget):
159 self.key.parent.finished_running(self, start_time) 159 self.key.parent.finished_running(self, start_time)
160 160
161 def on_enter_loaded_protecting_repeat(self, modifiers): 161 def on_enter_loaded_protecting_repeat(self, modifiers):
162 if 'repeat_delay' in self.key.config['properties']: 162 if self.key.repeat_delay > 0:
163 self.key.protecting_repeat_timer = threading.Timer( 163 self.key.protecting_repeat_timer = threading.Timer(
164 self.key.config['properties']['repeat_delay'], 164 self.key.repeat_delay,
165 self.key.repeat_protection_finished) 165 self.key.repeat_protection_finished)
166 self.key.protecting_repeat_timer.start() 166 self.key.protecting_repeat_timer.start()
167 else: 167 else:
@@ -287,6 +287,14 @@ class Key(ButtonBehavior, Widget):
287 def unset_color(self): 287 def unset_color(self):
288 self.custom_color = [0, 1, 0] 288 self.custom_color = [0, 1, 0]
289 289
290 # Helpers
291 @property
292 def repeat_delay(self):
293 if 'repeat_delay' in self.key.config['properties']:
294 return self.key.config['properties']['repeat_delay']
295 else:
296 return 0
297
290 # Actions handling 298 # Actions handling
291 def add_action(self, action_name, **arguments): 299 def add_action(self, action_name, **arguments):
292 self.actions.append(Action(action_name, self, **arguments)) 300 self.actions.append(Action(action_name, self, **arguments))
diff --git a/music_sampler/locales/fr/LC_MESSAGES/music_sampler.po b/music_sampler/locales/fr/LC_MESSAGES/music_sampler.po
index daa0dfb..f603a3d 100644
--- a/music_sampler/locales/fr/LC_MESSAGES/music_sampler.po
+++ b/music_sampler/locales/fr/LC_MESSAGES/music_sampler.po
@@ -420,6 +420,10 @@ msgid "waiting the end of « {} » + {}s (setting id = {})"
420msgstr "attend la fin de « {} » + {}s (définit l'identifiant {})" 420msgstr "attend la fin de « {} » + {}s (définit l'identifiant {})"
421 421
422#: music_sampler/app_blocks/actionlist.py:18 422#: music_sampler/app_blocks/actionlist.py:18
423msgid "actions linked to key {} (repeat protection {}s):"
424msgstr "actions liées à la touche {} (protection de {}s contre les répétitions) :"
425
426#: music_sampler/app_blocks/actionlist.py:18
423msgid "actions linked to key {}:" 427msgid "actions linked to key {}:"
424msgstr "actions liées à la touche {} :" 428msgstr "actions liées à la touche {} :"
425 429