X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=helpers%2Fkey.py;h=5eaf481bea86a4d2aa962be2b4bd035a0692bc8e;hb=0deb82a57ae3abefd44509dc88c546f6e5a94d1b;hp=ca73b87a421701661a7f76434dc866da2b860fc1;hpb=ecaf3148af1d9adff1819f9536f483ebf7c85a95;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git diff --git a/helpers/key.py b/helpers/key.py index ca73b87..5eaf481 100644 --- a/helpers/key.py +++ b/helpers/key.py @@ -79,6 +79,9 @@ class Key(ButtonBehavior, Widget): def add_action(self, action_name, **arguments): self.actions.append(Action(action_name, self, **arguments)) + def interrupt_action(self): + self.current_action.interrupt() + def do_actions(self): if not self.enabled: return None @@ -88,10 +91,10 @@ class Key(ButtonBehavior, Widget): start_time = time.time() self.parent.start_running(self, start_time) action_number = 0 - for action in self.actions: + for self.current_action in self.actions: if self.parent.keep_running(self, start_time): self.list_actions(action_number = action_number + 0.5) - action.run() + self.current_action.run() action_number += 1 self.list_actions(action_number = action_number)