X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=music_sampler%2Fkey.py;h=bdae5bdacf495d29576af27555923808e0fff72b;hb=b3e624bb95f21a70e9b76f2eb19f82d984f9e032;hp=66e792d514ed2ac31a10a273dc95605ff2d5b8ac;hpb=63ba5a8dc2aa4ec3e6f203b0ba4db249ecf0b00e;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git diff --git a/music_sampler/key.py b/music_sampler/key.py index 66e792d..bdae5bd 100644 --- a/music_sampler/key.py +++ b/music_sampler/key.py @@ -4,7 +4,7 @@ from kivy.properties import AliasProperty, BooleanProperty, \ from kivy.uix.behaviors import ButtonBehavior from .action import Action -from . import debug_print +from .helpers import debug_print import time import threading from transitions.extensions import HierarchicalMachine as Machine @@ -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))