diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-13 23:09:12 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-09-19 13:57:11 +0200 |
commit | 045a1b6343dc1a1ec4b27f5ae11856b8a422c9db (patch) | |
tree | 0a69a549b0d27dd028858017f472fa1d5d0263a4 /music_sampler | |
parent | d4217fda2ff3991eb1ee9a9bec6acff751798507 (diff) | |
download | MusicSampler-045a1b6343dc1a1ec4b27f5ae11856b8a422c9db.tar.gz MusicSampler-045a1b6343dc1a1ec4b27f5ae11856b8a422c9db.tar.zst MusicSampler-045a1b6343dc1a1ec4b27f5ae11856b8a422c9db.zip |
Fix configuring not resetting the key
Diffstat (limited to 'music_sampler')
-rw-r--r-- | music_sampler/key.py | 14 |
1 files 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): | |||
119 | return self.is_loaded_no_config() or self.is_loaded_no_actions() | 119 | return self.is_loaded_no_config() or self.is_loaded_no_actions() |
120 | 120 | ||
121 | def on_enter_configuring(self): | 121 | def on_enter_configuring(self): |
122 | self.destroy_actions() | ||
123 | self.key.unset_description() | ||
124 | self.key.unset_color() | ||
125 | |||
122 | if self.key.key_sym in self.key.parent.key_config: | 126 | if self.key.key_sym in self.key.parent.key_config: |
123 | self.key.config = self.key.parent.key_config[self.key.key_sym] | 127 | self.key.config = self.key.parent.key_config[self.key.key_sym] |
124 | 128 | ||
125 | self.key.actions = [] | ||
126 | for key_action in self.key.config['actions']: | 129 | for key_action in self.key.config['actions']: |
127 | self.key.add_action(key_action[0], **key_action[1]) | 130 | self.key.add_action(key_action[0], **key_action[1]) |
128 | 131 | ||
129 | if 'description' in self.key.config['properties']: | 132 | if 'description' in self.key.config['properties']: |
130 | self.key.set_description(self.key.config['properties']['description']) | 133 | self.key.set_description(self.key.config['properties']['description']) |
131 | else: | ||
132 | self.key.unset_description() | ||
133 | if 'color' in self.key.config['properties']: | 134 | if 'color' in self.key.config['properties']: |
134 | self.key.set_color(self.key.config['properties']['color']) | 135 | self.key.set_color(self.key.config['properties']['color']) |
135 | else: | ||
136 | self.key.unset_color() | ||
137 | self.success() | 136 | self.success() |
138 | else: | 137 | else: |
139 | self.no_config() | 138 | self.no_config() |
@@ -145,6 +144,11 @@ class KeyMachine(Widget): | |||
145 | else: | 144 | else: |
146 | self.no_actions() | 145 | self.no_actions() |
147 | 146 | ||
147 | def destroy_actions(self): | ||
148 | for action in self.key.actions: | ||
149 | action.destroy() | ||
150 | self.key.actions = [] | ||
151 | |||
148 | def run_actions(self, modifiers): | 152 | def run_actions(self, modifiers): |
149 | self.key.parent.parent.ids['KeyList'].append(self.key.key_sym) | 153 | self.key.parent.parent.ids['KeyList'].append(self.key.key_sym) |
150 | debug_print("running actions for {}".format(self.key.key_sym)) | 154 | debug_print("running actions for {}".format(self.key.key_sym)) |