From dd99cc03fb578ae515772c7275e849bad7ab948a Mon Sep 17 00:00:00 2001 From: jneilliii Date: Tue, 26 May 2020 21:24:12 -0400 Subject: [PATCH] fix clearing data issue --- octoprint_customControl/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/octoprint_customControl/__init__.py b/octoprint_customControl/__init__.py index 57bb561..f1643bf 100644 --- a/octoprint_customControl/__init__.py +++ b/octoprint_customControl/__init__.py @@ -4,14 +4,13 @@ from __future__ import absolute_import __author__ = "Marc Hannappel " __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' -from octoprint.settings import settings - import octoprint.plugin class CustomControlPlugin(octoprint.plugin.SettingsPlugin, octoprint.plugin.TemplatePlugin, octoprint.plugin.AssetPlugin): + def get_template_configs(self): if "editorcollection" in self._plugin_manager.enabled_plugins: return [ @@ -25,11 +24,13 @@ class CustomControlPlugin(octoprint.plugin.SettingsPlugin, def on_settings_load(self): return dict( - controls=settings().get(["controls"]) + controls=self._settings.global_get(["controls"]) ) def on_settings_save(self, data): - settings().set(["controls"], data["controls"]) + if len(data["controls"]) > 0: + self._logger.info("settings changed...saving global value") + self._settings.global_set(["controls"], data["controls"]) def get_assets(self): return dict(