]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - helpers/mapping.py
Use machine for key handling
[perso/Immae/Projets/Python/MusicSampler.git] / helpers / mapping.py
index b71f3fe5869cf550d8df5fc12d9e3b455465cc20..ba2c3401cb3966278c6fd07e9093f5a8c23e980d 100644 (file)
@@ -7,7 +7,7 @@ import threading
 import yaml
 import sys
 
-from .music_file import *
+from .music_file import MusicFile
 from .mixer import Mixer
 from . import Config, gain, error_print
 from .action import Action
@@ -67,7 +67,7 @@ class Mapping(RelativeLayout):
     def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
         key = self.find_by_key_code(keycode)
         if len(modifiers) == 0 and key is not None:
-            threading.Thread(name="MSKeyAction", target=key.do_actions).start()
+            threading.Thread(name="MSKeyAction", target=key.run).start()
         elif 'ctrl' in modifiers and (keycode[0] == 113 or keycode[0] == '99'):
             for thread in threading.enumerate():
                 if thread.getName()[0:2] != "MS":
@@ -86,7 +86,7 @@ class Mapping(RelativeLayout):
         for key in self.children:
             if not type(key).__name__ == "Key":
                 continue
-            if not key.is_key_ready:
+            if not key.is_loaded_or_failed():
                 return True
         self.ready_color = [0, 1, 0, 1]
         return False
@@ -95,7 +95,7 @@ class Mapping(RelativeLayout):
         running = self.running
         self.running = []
         for (key, start_time) in running:
-            key.interrupt_action()
+            key.interrupt()
 
     def start_running(self, key, start_time):
         self.running.append((key, start_time))