X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=helpers%2Fkey.py;h=66e792d514ed2ac31a10a273dc95605ff2d5b8ac;hb=ea97edb3ea6fc9a222d7ec43ff517276a25c7f14;hp=2f941532256ff89d97b688fe0a70582c6e813e35;hpb=6c42e32d98aa2e04d446f31b8e667a280acf4b54;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git diff --git a/helpers/key.py b/helpers/key.py index 2f94153..66e792d 100644 --- a/helpers/key.py +++ b/helpers/key.py @@ -107,6 +107,23 @@ class Key(ButtonBehavior, Widget): description = ListProperty([]) state = StringProperty("") + def get_alias_line_cross_color(self): + if not self.is_failed() and ( + not self.is_loaded(allow_substates=True)\ + or self.is_loaded_running()\ + or self.is_loaded_protecting_repeat()): + return [120/255, 120/255, 120/255, 1] + else: + return [0, 0, 0, 0] + + def set_alias_line_cross_color(self): + pass + + line_cross_color = AliasProperty( + get_alias_line_cross_color, + set_alias_line_cross_color, + bind=['state']) + def get_alias_line_color(self): if self.is_loaded_running(): return [0, 0, 0, 1] @@ -124,6 +141,8 @@ class Key(ButtonBehavior, Widget): return [1, 1, 1, 1] elif self.is_loaded_protecting_repeat(): return [*self.custom_color, 100/255] + elif self.is_loaded_running(): + return [*self.custom_color, 100/255] elif self.is_loaded(allow_substates=True): return [*self.custom_color, 1] elif self.is_failed(): @@ -191,7 +210,7 @@ class Key(ButtonBehavior, Widget): for self.current_action in self.actions: if self.parent.keep_running(self, start_time): self.list_actions() - self.current_action.run() + self.current_action.run(start_time) self.list_actions(last_action_finished=True) self.parent.finished_running(self, start_time)