diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-11 18:41:31 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-11 18:43:24 +0200 |
commit | 814c30c6835b25d06977af1dd2d1e565c45121cc (patch) | |
tree | e8f4951e847ee94783a78ef6e83fab4233987492 /music_sampler/key.py | |
parent | ba21932596c3b6d1a2ce1e1a22b6417e1c509865 (diff) | |
download | MusicSampler-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
Diffstat (limited to 'music_sampler/key.py')
-rw-r--r-- | music_sampler/key.py | 12 |
1 files changed, 10 insertions, 2 deletions
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)) |