diff --git a/octoprint_customControl/__init__.py b/octoprint_customControl/__init__.py index 4656358..473647d 100644 --- a/octoprint_customControl/__init__.py +++ b/octoprint_customControl/__init__.py @@ -23,13 +23,14 @@ class CustomControlPlugin(octoprint.plugin.SettingsPlugin, s.set(["controls"], data["controls"]) def get_assets(self): - return { - "js": [ + return dict( + js=[ "js/customControl.js", "js/containerDialog.js", ], - "css": ["css/customControls.css"] - } + css=["css/customControls.css"], + less=["less/customControls.css"] + ) # If you want your plugin to be registered within OctoPrint under a different name than what you defined in setup.py # ("OctoPrint-PluginSkeleton"), you may define that here. Same goes for the other metadata derived from setup.py that diff --git a/octoprint_customControl/static/css/customControls.css b/octoprint_customControl/static/css/customControls.css index a6a57c2..11c2a81 100644 --- a/octoprint_customControl/static/css/customControls.css +++ b/octoprint_customControl/static/css/customControls.css @@ -1,3 +1 @@ -#customControls .custom_section_horizontal{display:inline-block} -#customControls .custom_section_vertical_section{min-width:15px; min-height:15px; margin: 8px 8px; padding: 8px 8px; border:1px dashed #000000} -#customControls .custom_section_horizontal_section{float:left; min-width:15px; min-height:15px; margin: 8px 8px; padding: 8px 8px; border:1px dashed #000000} \ No newline at end of file +#customControls .custom_section_horizontal{display:inline-block}#customControls .custom_section_vertical_section{min-width:15px;min-height:15px;margin:8px;padding:8px;border:1px dashed #000}#customControls .custom_section_horizontal_section{float:left;min-width:15px;min-height:15px;margin:8px;padding:8px;border:1px dashed #000} \ No newline at end of file diff --git a/octoprint_customControl/static/js/customControl.js b/octoprint_customControl/static/js/customControl.js index 7ece91a..0ae690c 100644 --- a/octoprint_customControl/static/js/customControl.js +++ b/octoprint_customControl/static/js/customControl.js @@ -51,6 +51,9 @@ }; self.rerenderControls = function () { + + // TODO: Brainstorming about how to handle additionalControls... + self.staticID = 0; self.controls(self._processControls(undefined, self.controlsFromServer)) }; @@ -305,8 +308,8 @@ self.recursiveDeleteProperties(self.controlsFromServer); self.settingsViewModel.settings.plugins.octoprint_customControl.controls = self.controlsFromServer; } - self.onSettingsAfterSave = function () { - self.controlViewModel.requestData(); + + self.onEventSettingsUpdated = function (payload) { self.requestData(); } } diff --git a/octoprint_customControl/static/less/customControls.less b/octoprint_customControl/static/less/customControls.less new file mode 100644 index 0000000..35fbe52 --- /dev/null +++ b/octoprint_customControl/static/less/customControls.less @@ -0,0 +1,19 @@ +#customControls { + .custom_section_horizontal { + display:inline-block; + } + .custom_section_vertical_section { + min-width:15px; + min-height:15px; + + margin: 8px 8px; + padding: 8px 8px; + + border:1px dashed #000000; + } + .custom_section_horizontal_section { + float:left; + + .custom_section_vertical_section(); + } +} \ No newline at end of file