From c194cabdcf504a190dd2c9c345da67aeef35d1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 16 Nov 2016 14:12:00 +0100 Subject: [PATCH] Fix for select&print not working for SD files anymore Timing issue, "OctoPrint.job.start()" would be called at a time when the file had not yet been selected on the server. Hence a different approach, calculating printerAfterLoading parameter based on existing information at the time of clicking the load button and using the print parameter on the select file API again, as previously. --- src/octoprint/static/js/app/viewmodels/files.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js index b00d75f9..03ec1473 100644 --- a/src/octoprint/static/js/app/viewmodels/files.js +++ b/src/octoprint/static/js/app/viewmodels/files.js @@ -402,13 +402,10 @@ $(function() { if (!file) { return; } - OctoPrint.files.select(file.origin, file.path) - .done(function() { - var withinPrintDimensions = self.evaluatePrintDimensions(file, true); - if (withinPrintDimensions && printAfterLoad) { - OctoPrint.job.start(); - } - }); + var withinPrintDimensions = self.evaluatePrintDimensions(file, true); + var print = printAfterLoad && withinPrintDimensions; + + OctoPrint.files.select(file.origin, file.path, print); }; self.removeFile = function(file, event) {