Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve plugin order when reinstalling/updating #530

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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