Skip to content

Commit

Permalink
Preserve plugin order when reinstalling/updating (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
jurassicplayer authored Aug 28, 2023
1 parent caf4d75 commit 22d5795
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions backend/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 22d5795

Please sign in to comment.