aboutsummaryrefslogtreecommitdiff
path: root/music_sampler/key.py
diff options
context:
space:
mode:
Diffstat (limited to 'music_sampler/key.py')
-rw-r--r--music_sampler/key.py12
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))