From 2926b5c8d56eca4448f6147210abd95a12cacf2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 30 Sep 2015 14:30:10 +0200 Subject: [PATCH] PMGR: only mark as pending (un)installed if restart is needed --- src/octoprint/plugins/pluginmanager/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index 48a7be6d..069e8aff 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -338,13 +338,13 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, return jsonify(result) self._plugin_manager.reload_plugins() + needs_restart = self._plugin_manager.is_restart_needing_plugin(new_plugin) or new_plugin_key in all_plugins_before or reinstall is not None + needs_refresh = new_plugin.implementation and isinstance(new_plugin.implementation, octoprint.plugin.ReloadNeedingPlugin) + is_reinstall = self._plugin_manager.is_plugin_marked(new_plugin_key, "uninstalled") self._plugin_manager.mark_plugin(new_plugin_key, uninstalled=False, - installed=not is_reinstall) - - needs_restart = self._plugin_manager.is_restart_needing_plugin(new_plugin) or new_plugin_key in all_plugins_before or reinstall is not None - needs_refresh = new_plugin.implementation and isinstance(new_plugin.implementation, octoprint.plugin.ReloadNeedingPlugin) + installed=not is_reinstall and needs_restart) self._plugin_manager.log_all_plugins() @@ -405,7 +405,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, needs_refresh = plugin.implementation and isinstance(plugin.implementation, octoprint.plugin.ReloadNeedingPlugin) was_pending_install = self._plugin_manager.is_plugin_marked(plugin.key, "installed") - self._plugin_manager.mark_plugin(plugin.key, uninstalled=not was_pending_install, installed=False) + self._plugin_manager.mark_plugin(plugin.key, + uninstalled=not was_pending_install and needs_restart, + installed=False) if not needs_restart: try: