]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/commitdiff
Add cross when key is not usable
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 27 Jul 2016 10:22:59 +0000 (12:22 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 27 Jul 2016 10:22:59 +0000 (12:22 +0200)
helpers/key.py
music_sampler.kv

index 113cf8e94801fdaa15ba529f6d94509e5edc7d5b..2b9d1520e8549a5f6f4f6aa43a369f45df078d20 100644 (file)
@@ -107,6 +107,20 @@ class Key(ButtonBehavior, Widget):
     description = ListProperty([])
     state = StringProperty("")
 
     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]
     def get_alias_line_color(self):
         if self.is_loaded_running():
             return [0, 0, 0, 1]
index 882112d1c12a366326d67137d106f20442d3fd67..fa3862724bd73c6e7a642d32be0048cfa545d1a3 100644 (file)
     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
     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"
   Label:
     id: key_label
     font_name: h.path() + "fonts/Ubuntu-B.ttf"