From c4a0b63a87e01a2b588202f0dd57e529b069512c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 28 Jun 2016 14:47:17 +0200 Subject: [PATCH] Add flag to disable model size detection & check Also marked feature as beta --- src/octoprint/server/api/settings.py | 4 +++- src/octoprint/settings.py | 3 ++- src/octoprint/static/js/app/viewmodels/files.js | 11 +++++++++++ src/octoprint/static/js/app/viewmodels/settings.js | 1 + .../templates/dialogs/settings/features.jinja2 | 9 ++++++++- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index a67dc2a4..ba08fc24 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -73,7 +73,8 @@ def getSettings(): "externalHeatupDetection": s.getBoolean(["feature", "externalHeatupDetection"]), "keyboardControl": s.getBoolean(["feature", "keyboardControl"]), "pollWatched": s.getBoolean(["feature", "pollWatched"]), - "ignoreIdenticalResends": s.getBoolean(["feature", "ignoreIdenticalResends"]) + "ignoreIdenticalResends": s.getBoolean(["feature", "ignoreIdenticalResends"]), + "modelSizeDetection": s.getBoolean(["feature", "modelSizeDetection"]) }, "serial": { "port": connectionOptions["portPreference"], @@ -235,6 +236,7 @@ def _saveSettings(data): if "keyboardControl" in data["feature"].keys(): s.setBoolean(["feature", "keyboardControl"], data["feature"]["keyboardControl"]) if "pollWatched" in data["feature"]: s.setBoolean(["feature", "pollWatched"], data["feature"]["pollWatched"]) if "ignoreIdenticalResends" in data["feature"]: s.setBoolean(["feature", "ignoreIdenticalResends"], data["feature"]["ignoreIdenticalResends"]) + if "modelSizeDetection" in data["feature"]: s.setBoolean(["feature", "modelSizeDetection"], data["feature"]["modelSizeDetection"]) if "serial" in data.keys(): if "autoconnect" in data["serial"].keys(): s.setBoolean(["serial", "autoconnect"], data["serial"]["autoconnect"]) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 7fd62e95..fed93526 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -181,7 +181,8 @@ default_settings = { "pollWatched": False, "ignoreIdenticalResends": False, "identicalResendsCountdown": 7, - "supportFAsCommand": False + "supportFAsCommand": False, + "modelSizeDetection": True }, "folder": { "uploads": None, diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index c20bda06..8789405f 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -447,6 +447,15 @@ $(function() { }; self.evaluatePrintDimensions = function(data, notify) { + if (!self.settingsViewModel.feature_modelSizeDetection()) { + return true; + } + + var analysis = data["gcodeAnalysis"]; + if (!analysis) { + return true; + } + var printingArea = data["gcodeAnalysis"]["printingArea"]; if (!printingArea) { return true; @@ -507,6 +516,8 @@ $(function() { warning += pnotifyAdditionalInfo(info); + warning += "

You can disable this check via Settings > Features > \"Enable model size detection [...]\"

"; + new PNotify({ title: gettext("Object doesn't fit print volume"), text: warning, diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index d13b0708..eb7aacd5 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -131,6 +131,7 @@ $(function() { self.feature_keyboardControl = ko.observable(undefined); self.feature_pollWatched = ko.observable(undefined); self.feature_ignoreIdenticalResends = ko.observable(undefined); + self.feature_modelSizeDetection = ko.observable(undefined); self.serial_port = ko.observable(); self.serial_baudrate = ko.observable(); diff --git a/src/octoprint/templates/dialogs/settings/features.jinja2 b/src/octoprint/templates/dialogs/settings/features.jinja2 index ad13738c..c00e9343 100644 --- a/src/octoprint/templates/dialogs/settings/features.jinja2 +++ b/src/octoprint/templates/dialogs/settings/features.jinja2 @@ -8,7 +8,14 @@
-
+
+
+
+