aboutsummaryrefslogtreecommitdiff
path: root/helpers/mapping.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-25 23:50:51 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-07-26 02:05:53 +0200
commite55b29bb38b845c7b9e65a1fbca0198882658e14 (patch)
treea6430f289c909ab355b4f0b51eae9904c0a12c6a /helpers/mapping.py
parentb7ca3fc2b6b05d3aafd44dd0b8e40a4707213ff5 (diff)
downloadMusicSampler-e55b29bb38b845c7b9e65a1fbca0198882658e14.tar.gz
MusicSampler-e55b29bb38b845c7b9e65a1fbca0198882658e14.tar.zst
MusicSampler-e55b29bb38b845c7b9e65a1fbca0198882658e14.zip
Use machine for key handling
Diffstat (limited to 'helpers/mapping.py')
-rw-r--r--helpers/mapping.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/helpers/mapping.py b/helpers/mapping.py
index b71f3fe..ba2c340 100644
--- a/helpers/mapping.py
+++ b/helpers/mapping.py
@@ -7,7 +7,7 @@ import threading
7import yaml 7import yaml
8import sys 8import sys
9 9
10from .music_file import * 10from .music_file import MusicFile
11from .mixer import Mixer 11from .mixer import Mixer
12from . import Config, gain, error_print 12from . import Config, gain, error_print
13from .action import Action 13from .action import Action
@@ -67,7 +67,7 @@ class Mapping(RelativeLayout):
67 def _on_keyboard_down(self, keyboard, keycode, text, modifiers): 67 def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
68 key = self.find_by_key_code(keycode) 68 key = self.find_by_key_code(keycode)
69 if len(modifiers) == 0 and key is not None: 69 if len(modifiers) == 0 and key is not None:
70 threading.Thread(name="MSKeyAction", target=key.do_actions).start() 70 threading.Thread(name="MSKeyAction", target=key.run).start()
71 elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'): 71 elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'):
72 for thread in threading.enumerate(): 72 for thread in threading.enumerate():
73 if thread.getName()[0:2] != "MS": 73 if thread.getName()[0:2] != "MS":
@@ -86,7 +86,7 @@ class Mapping(RelativeLayout):
86 for key in self.children: 86 for key in self.children:
87 if not type(key).__name__ == "Key": 87 if not type(key).__name__ == "Key":
88 continue 88 continue
89 if not key.is_key_ready: 89 if not key.is_loaded_or_failed():
90 return True 90 return True
91 self.ready_color = [0, 1, 0, 1] 91 self.ready_color = [0, 1, 0, 1]
92 return False 92 return False
@@ -95,7 +95,7 @@ class Mapping(RelativeLayout):
95 running = self.running 95 running = self.running
96 self.running = [] 96 self.running = []
97 for (key, start_time) in running: 97 for (key, start_time) in running:
98 key.interrupt_action() 98 key.interrupt()
99 99
100 def start_running(self, key, start_time): 100 def start_running(self, key, start_time):
101 self.running.append((key, start_time)) 101 self.running.append((key, start_time))