diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-27 12:22:59 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-27 12:22:59 +0200 |
commit | 635dea02d27ba499861085f8c7ead14d685bddf6 (patch) | |
tree | f8baccfb5549a9c4cb50df582b9dd9c274291376 | |
parent | 70cfb266c677c77675def8ac26babf7c8ac7d0f8 (diff) | |
download | MusicSampler-635dea02d27ba499861085f8c7ead14d685bddf6.tar.gz MusicSampler-635dea02d27ba499861085f8c7ead14d685bddf6.tar.zst MusicSampler-635dea02d27ba499861085f8c7ead14d685bddf6.zip |
Add cross when key is not usable
-rw-r--r-- | helpers/key.py | 14 | ||||
-rw-r--r-- | music_sampler.kv | 8 |
2 files changed, 22 insertions, 0 deletions
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): | |||
107 | description = ListProperty([]) | 107 | description = ListProperty([]) |
108 | state = StringProperty("") | 108 | state = StringProperty("") |
109 | 109 | ||
110 | def get_alias_line_cross_color(self): | ||
111 | if self.is_loaded_running() or self.is_loaded_protecting_repeat(): | ||
112 | return [120/255, 120/255, 120/255, 1] | ||
113 | else: | ||
114 | return [0, 0, 0, 0] | ||
115 | |||
116 | def set_alias_line_cross_color(self): | ||
117 | pass | ||
118 | |||
119 | line_cross_color = AliasProperty( | ||
120 | get_alias_line_cross_color, | ||
121 | set_alias_line_cross_color, | ||
122 | bind=['state']) | ||
123 | |||
110 | def get_alias_line_color(self): | 124 | def get_alias_line_color(self): |
111 | if self.is_loaded_running(): | 125 | if self.is_loaded_running(): |
112 | return [0, 0, 0, 1] | 126 | 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 @@ | |||
30 | Line: | 30 | Line: |
31 | 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 | 31 | 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 |
32 | width: self.line_width | 32 | width: self.line_width |
33 | Color: | ||
34 | rgba: self.line_cross_color | ||
35 | Line: | ||
36 | 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 | ||
37 | width: self.line_width | ||
38 | Line: | ||
39 | 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 | ||
40 | width: self.line_width | ||
33 | Label: | 41 | Label: |
34 | id: key_label | 42 | id: key_label |
35 | font_name: h.path() + "fonts/Ubuntu-B.ttf" | 43 | font_name: h.path() + "fonts/Ubuntu-B.ttf" |