From 045a1b6343dc1a1ec4b27f5ae11856b8a422c9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 13 Aug 2016 23:09:12 +0200 Subject: Fix configuring not resetting the key --- music_sampler/key.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/music_sampler/key.py b/music_sampler/key.py index ce2f45b..68e6f04 100644 --- a/music_sampler/key.py +++ b/music_sampler/key.py @@ -119,21 +119,20 @@ class KeyMachine(Widget): return self.is_loaded_no_config() or self.is_loaded_no_actions() def on_enter_configuring(self): + self.destroy_actions() + self.key.unset_description() + self.key.unset_color() + if self.key.key_sym in self.key.parent.key_config: self.key.config = self.key.parent.key_config[self.key.key_sym] - self.key.actions = [] for key_action in self.key.config['actions']: self.key.add_action(key_action[0], **key_action[1]) if 'description' in self.key.config['properties']: self.key.set_description(self.key.config['properties']['description']) - else: - self.key.unset_description() if 'color' in self.key.config['properties']: self.key.set_color(self.key.config['properties']['color']) - else: - self.key.unset_color() self.success() else: self.no_config() @@ -145,6 +144,11 @@ class KeyMachine(Widget): else: self.no_actions() + def destroy_actions(self): + for action in self.key.actions: + action.destroy() + self.key.actions = [] + def run_actions(self, modifiers): self.key.parent.parent.ids['KeyList'].append(self.key.key_sym) debug_print("running actions for {}".format(self.key.key_sym)) -- cgit v1.2.3