From 3e0abf1b2074b8beb05694d988e7f0d2a47f4b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 21 Aug 2013 20:33:55 +0200 Subject: [PATCH] New custom control type "feedback" Like "feedback_command", but without the button --- octoprint/settings.py | 2 +- octoprint/static/js/app/viewmodels/control.js | 4 +++- octoprint/templates/index.jinja2 | 5 +++++ octoprint/util/comm.py | 14 ++++++++++++-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/octoprint/settings.py b/octoprint/settings.py index b1e67ce8..2d05f9b1 100644 --- a/octoprint/settings.py +++ b/octoprint/settings.py @@ -248,7 +248,7 @@ class Settings(object): return feedbackControls def _getFeedbackControls(self, control=None): - if control["type"] == "feedback_command": + if control["type"] == "feedback_command" or control["type"] == "feedback": pattern = control["regex"] try: matcher = re.compile(pattern) diff --git a/octoprint/static/js/app/viewmodels/control.js b/octoprint/static/js/app/viewmodels/control.js index bfab9e03..3f89d570 100644 --- a/octoprint/static/js/app/viewmodels/control.js +++ b/octoprint/static/js/app/viewmodels/control.js @@ -68,7 +68,7 @@ function ControlViewModel(loginStateViewModel, settingsViewModel) { for (var i = 0; i < control.input.length; i++) { control.input[i].value = control.input[i].default; } - } else if (control.type == "feedback_command") { + } else if (control.type == "feedback_command" || control.type == "feedback") { control.output = ko.observable(""); self.feedbackControlLookup[control.name] = control.output; } else if (control.type == "section") { @@ -162,6 +162,8 @@ function ControlViewModel(loginStateViewModel, settingsViewModel) { return "customControls_parametricCommandTemplate"; case "feedback_command": return "customControls_feedbackCommandTemplate"; + case "feedback": + return "customControls_feedbackTemplate"; default: return "customControls_emptyTemplate"; } diff --git a/octoprint/templates/index.jinja2 b/octoprint/templates/index.jinja2 index 6d077eef..1d8883eb 100644 --- a/octoprint/templates/index.jinja2 +++ b/octoprint/templates/index.jinja2 @@ -402,6 +402,11 @@ +