From 814c30c6835b25d06977af1dd2d1e565c45121cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Thu, 11 Aug 2016 18:41:31 +0200 Subject: Add protect_delay message when available Fixes https://git.immae.eu/mantisbt/view.php?id=18 --- music_sampler/app_blocks/actionlist.py | 10 +++++++++- music_sampler/key.py | 12 ++++++++++-- music_sampler/locales/fr/LC_MESSAGES/music_sampler.po | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'music_sampler') 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): action_list = ListProperty([]) def update_list(self, key, action_descriptions): - self.action_title = _("actions linked to key {}:").format(key.key_sym) + if key.repeat_delay > 0: + self.action_title = _( + "actions linked to key {} (repeat protection {}s):" + ).format(key.key_sym, key.repeat_delay) + else: + self.action_title = _( + "actions linked to key {}:" + ).format(key.key_sym) + action_list = [] 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): self.key.parent.finished_running(self, start_time) def on_enter_loaded_protecting_repeat(self, modifiers): - if 'repeat_delay' in self.key.config['properties']: + if self.key.repeat_delay > 0: self.key.protecting_repeat_timer = threading.Timer( - self.key.config['properties']['repeat_delay'], + self.key.repeat_delay, self.key.repeat_protection_finished) self.key.protecting_repeat_timer.start() else: @@ -287,6 +287,14 @@ class Key(ButtonBehavior, Widget): def unset_color(self): self.custom_color = [0, 1, 0] + # Helpers + @property + def repeat_delay(self): + if 'repeat_delay' in self.key.config['properties']: + return self.key.config['properties']['repeat_delay'] + else: + return 0 + # Actions handling def add_action(self, action_name, **arguments): 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 @@ -419,6 +419,10 @@ msgstr "attend la fin de « {} » (définit l'identifiant {})" msgid "waiting the end of « {} » + {}s (setting id = {})" msgstr "attend la fin de « {} » + {}s (définit l'identifiant {})" +#: music_sampler/app_blocks/actionlist.py:18 +msgid "actions linked to key {} (repeat protection {}s):" +msgstr "actions liées à la touche {} (protection de {}s contre les répétitions) :" + #: music_sampler/app_blocks/actionlist.py:18 msgid "actions linked to key {}:" msgstr "actions liées à la touche {} :" -- cgit v1.2.3