diff --git a/data_centre/data.py b/data_centre/data.py index 913ebb6..80f3a4d 100644 --- a/data_centre/data.py +++ b/data_centre/data.py @@ -33,7 +33,7 @@ class Data(object): BANK_DATA_JSON = 'display_data.json' SHADER_BANK_DATA_JSON = 'shader_bank_data.json' SETTINGS_JSON = 'settings.json' - ACTIVE_PLUGINS = 'active_plugins.json' + ACTIVE_PLUGINS_JSON = 'active_plugins.json' DEFAULT_SETTINGS_JSON = 'settings_default.json' KEYPAD_MAPPING_JSON = 'keypad_action_mapping.json' OSC_MAPPING_JSON = 'osc_action_mapping.json' @@ -87,8 +87,8 @@ class Data(object): self.bank_data = self._read_json(self.BANK_DATA_JSON) self.active_plugins = {} - if os.path.isfile(self.PATH_TO_DATA_OBJECTS + self.ACTIVE_PLUGINS): - self.bank_data = self._read_json(self.ACTIVE_PLUGINS) + if os.path.isfile(self.PATH_TO_DATA_OBJECTS + self.ACTIVE_PLUGINS_JSON): + self.active_plugins = self._read_json(self.ACTIVE_PLUGINS_JSON) self.shader_bank_data = [self.create_empty_shader_bank() for i in range(3)] if os.path.isfile(self.PATH_TO_DATA_OBJECTS + self.SHADER_BANK_DATA_JSON): @@ -131,6 +131,9 @@ class Data(object): if self.settings['system']['USE_PLUGINS']['value'] == 'disabled': self.active_plugins = {x:False for x in self.active_plugins} + def update_active_plugins(self, key, value): + self.active_plugins[key] = value + self._update_json(self.ACTIVE_PLUGINS_JSON, self.active_plugins) def load_midi_mapping_for_device(self, device_name): # check if custom config file exists on disk for this device name diff --git a/display_centre/menu.py b/display_centre/menu.py index 2ddeaf9..f0a99d8 100644 --- a/display_centre/menu.py +++ b/display_centre/menu.py @@ -114,6 +114,7 @@ class BrowserMenu(Menu): ######## used for displaying the mappings in browser view ######## for bank_index, bank in enumerate(self.data.bank_data): for slot_index, slot in enumerate(bank): + print('&&&&&&&&&&&&', slot) if file_name == slot['name']: return True, '{}-{}'.format(bank_index,slot_index) return False, '' @@ -206,7 +207,8 @@ class PluginsMenu(Menu): def enter_on_plugins_selection(self): selected_item = sorted(self.data.active_plugins)[self.selected_list_index] - self.data.active_plugins[selected_item] = not self.data.active_plugins[selected_item] + state = self.data.active_plugins[selected_item] + self.data.update_active_plugins(selected_item, not state) class ShadersMenu(Menu): diff --git a/json_objects/active_plugins.json b/json_objects/active_plugins.json new file mode 100644 index 0000000..bdf7d9c --- /dev/null +++ b/json_objects/active_plugins.json @@ -0,0 +1,9 @@ +{ + "LFOModulationPlugin": false, + "ManipulatePlugin": true, + "MidiFeedbackAPCKey25Plugin": true, + "MidiFeedbackLaunchpadPlugin": false, + "ShaderLoopRecordPlugin": false, + "ShaderQuickPresetPlugin": true, + "WJSendPlugin": false +} \ No newline at end of file