aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--music_sampler/key.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/music_sampler/key.py b/music_sampler/key.py
index b05de4c..bdae5bd 100644
--- a/music_sampler/key.py
+++ b/music_sampler/key.py
@@ -189,8 +189,12 @@ class Key(ButtonBehavior, Widget):
189 189
190 if 'description' in self.config['properties']: 190 if 'description' in self.config['properties']:
191 self.set_description(self.config['properties']['description']) 191 self.set_description(self.config['properties']['description'])
192 else:
193 self.unset_description()
192 if 'color' in self.config['properties']: 194 if 'color' in self.config['properties']:
193 self.set_color(self.config['properties']['color']) 195 self.set_color(self.config['properties']['color'])
196 else:
197 self.unset_color()
194 self.success() 198 self.success()
195 else: 199 else:
196 self.no_config() 200 self.no_config()
@@ -250,10 +254,17 @@ class Key(ButtonBehavior, Widget):
250 else: 254 else:
251 self.description.append(str(desc).replace(" ", " ")) 255 self.description.append(str(desc).replace(" ", " "))
252 256
257 def unset_description(self):
258 self.description_title = ""
259 self.description = []
260
253 def set_color(self, color): 261 def set_color(self, color):
254 color = [x / 255 for x in color] 262 color = [x / 255 for x in color]
255 self.custom_color = color 263 self.custom_color = color
256 264
265 def unset_color(self):
266 self.custom_color = [0, 1, 0]
267
257 # Actions handling 268 # Actions handling
258 def add_action(self, action_name, **arguments): 269 def add_action(self, action_name, **arguments):
259 self.actions.append(Action(action_name, self, **arguments)) 270 self.actions.append(Action(action_name, self, **arguments))