From f90575473a9eb6d37caf230f2feb8fd16749e7e4 Mon Sep 17 00:00:00 2001 From: jurassicplayer Date: Thu, 24 Aug 2023 19:38:22 -0700 Subject: [PATCH] Preserve plugin order when reinstalling/updating --- backend/browser.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/browser.py b/backend/browser.py index 0b0c5b988..ce9b3dd78 100644 --- a/backend/browser.py +++ b/backend/browser.py @@ -139,6 +139,8 @@ async def _install(self, artifact, name, version, hash): # Check if plugin is installed isInstalled = False + # Preserve plugin order before removing plugin (uninstall alters the order and removes the plugin from the list) + current_plugin_order = self.settings.getSetting("pluginOrder")[:] if self.loader.watcher: self.loader.watcher.disabled = True try: @@ -191,9 +193,9 @@ async def _install(self, artifact, name, version, hash): self.loader.plugins[name].stop() self.loader.plugins.pop(name, None) await sleep(1) - - current_plugin_order = self.settings.getSetting("pluginOrder") - current_plugin_order.append(name) + if not isInstalled: + current_plugin_order = self.settings.getSetting("pluginOrder") + current_plugin_order.append(name) self.settings.setSetting("pluginOrder", current_plugin_order) logger.debug("Plugin %s was added to the pluginOrder setting", name) self.loader.import_plugin(path.join(plugin_dir, "main.py"), plugin_folder)