From b3e624bb95f21a70e9b76f2eb19f82d984f9e032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Thu, 11 Aug 2016 12:59:29 +0200 Subject: Unset description / color when they are removed --- music_sampler/key.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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): if 'description' in self.config['properties']: self.set_description(self.config['properties']['description']) + else: + self.unset_description() if 'color' in self.config['properties']: self.set_color(self.config['properties']['color']) + else: + self.unset_color() self.success() else: self.no_config() @@ -250,10 +254,17 @@ class Key(ButtonBehavior, Widget): else: self.description.append(str(desc).replace(" ", " ")) + def unset_description(self): + self.description_title = "" + self.description = [] + def set_color(self, color): color = [x / 255 for x in color] self.custom_color = color + def unset_color(self): + self.custom_color = [0, 1, 0] + # Actions handling def add_action(self, action_name, **arguments): self.actions.append(Action(action_name, self, **arguments)) -- cgit v1.2.3