X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git;a=blobdiff_plain;f=music_sampler%2Fkey.py;h=b73a29cf1b8b83a8ecef8587c628791d014e5daf;hb=814c30c6835b25d06977af1dd2d1e565c45121cc;hpb=ba21932596c3b6d1a2ce1e1a22b6417e1c509865 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))