From: Ismaƫl Bouya Date: Wed, 27 Jul 2016 10:22:59 +0000 (+0200) Subject: Add cross when key is not usable X-Git-Tag: 1.0.0~8 X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git;a=commitdiff_plain;h=635dea02d27ba499861085f8c7ead14d685bddf6 Add cross when key is not usable --- diff --git a/helpers/key.py b/helpers/key.py index 113cf8e..2b9d152 100644 --- a/helpers/key.py +++ b/helpers/key.py @@ -107,6 +107,20 @@ class Key(ButtonBehavior, Widget): description = ListProperty([]) state = StringProperty("") + def get_alias_line_cross_color(self): + if 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] diff --git a/music_sampler.kv b/music_sampler.kv index 882112d..fa38627 100644 --- a/music_sampler.kv +++ b/music_sampler.kv @@ -30,6 +30,14 @@ Line: rounded_rectangle: self.x + self.line_width, self.y + self.line_width, self.width - 2 * self.line_width, self.height - 2 * self.line_width, 10 width: self.line_width + Color: + rgba: self.line_cross_color + Line: + points: self.x + self.line_width + 3, self.y + self.line_width + 3, self.x + self.width - 2 * self.line_width - 3, self.y + self.height - 2 * self.line_width - 3 + width: self.line_width + Line: + points: self.x + self.line_width + 3, self.y + self.height - 2 * self.line_width - 3, self.x + self.width - 2 * self.line_width - 3, self.y + self.line_width + 3 + width: self.line_width Label: id: key_label font_name: h.path() + "fonts/Ubuntu-B.ttf"