X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=music_sampler%2Fkey.py;h=bdae5bdacf495d29576af27555923808e0fff72b;hb=b3e624bb95f21a70e9b76f2eb19f82d984f9e032;hp=b05de4cbeef381a33602b848870ea3fb50540120;hpb=6ebe62478a49df22c55ef6a2b1200473500a7f80;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git 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))