diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-11 12:59:29 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-11 12:59:29 +0200 |
commit | b3e624bb95f21a70e9b76f2eb19f82d984f9e032 (patch) | |
tree | 131dbdb5704b6783c8a0c97e1d4c8f6786c4b2a6 /music_sampler/key.py | |
parent | ca3264c828e5220e9d729152572de7a4600149b4 (diff) | |
download | MusicSampler-b3e624bb95f21a70e9b76f2eb19f82d984f9e032.tar.gz MusicSampler-b3e624bb95f21a70e9b76f2eb19f82d984f9e032.tar.zst MusicSampler-b3e624bb95f21a70e9b76f2eb19f82d984f9e032.zip |
Unset description / color when they are removed
Diffstat (limited to 'music_sampler/key.py')
-rw-r--r-- | music_sampler/key.py | 11 |
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)) |