]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/commitdiff
Add protect_delay message when available tags/1.2.1 1.2.1
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 11 Aug 2016 16:41:31 +0000 (18:41 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 11 Aug 2016 16:43:24 +0000 (18:43 +0200)
Fixes https://git.immae.eu/mantisbt/view.php?id=18

music_sampler/app_blocks/actionlist.py
music_sampler/key.py
music_sampler/locales/fr/LC_MESSAGES/music_sampler.po

index 8c4c5e9c3d2ab9171660fcc783fb743179146c53..f48072f92962d34deb5ebc1549c843ad0a86af97 100644 (file)
@@ -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:
index 534a3db565671128ac066d191f862c412c79783d..b73a29cf1b8b83a8ecef8587c628791d014e5daf 100644 (file)
@@ -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))
index daa0dfbbb75cd953fb06c4a88fd1eb70c58fa3d9..f603a3d80edc76aa508699f53ce13b9dadb0791a 100644 (file)
@@ -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 {} :"