diff --git a/src/octoprint/filemanager/__init__.py b/src/octoprint/filemanager/__init__.py
index fadcaf88..368a0f20 100644
--- a/src/octoprint/filemanager/__init__.py
+++ b/src/octoprint/filemanager/__init__.py
@@ -184,6 +184,10 @@ class FileManager(object):
end_time = time.time()
eventManager().fire(Events.SLICING_DONE, {"stl": source_path, "gcode": dest_path, "gcode_location": dest_location, "time": end_time - start_time})
+ #absolute_path = self._storage(dest_location).get_absolute_path(dest_path)
+ #with open (absolute_path, "r") as myfile:
+ # print("sliced gcode\n", myfile.readlines())
+
if callback is not None:
if callback_args is None:
callback_args = ()
diff --git a/src/octoprint/plugins/svgtogcode/__init__.py b/src/octoprint/plugins/svgtogcode/__init__.py
index adbaab48..26dd6487 100644
--- a/src/octoprint/plugins/svgtogcode/__init__.py
+++ b/src/octoprint/plugins/svgtogcode/__init__.py
@@ -246,7 +246,6 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin,
on_progress_kwargs = dict()
self._svgtogcode_logger.info("### Slicing %s to %s using profile stored at %s" % (model_path, machinecode_path, profile_path))
- print("### Slicing %s to %s using profile stored at %s" % (model_path, machinecode_path, profile_path))
engine_settings = self._convert_to_engine(profile_path)
@@ -311,13 +310,13 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin,
if p.returncode == 0:
return True, None
else:
- self._logger.warn("Could not slice via Cura, got return code %r" % p.returncode)
+ self._logger.warn("Could not slice, got return code %r" % p.returncode)
return False, "Got returncode %r" % p.returncode
except octoprint.slicing.SlicingCancelled as e:
raise e
except:
- self._logger.exception("Could not slice via Cura, got an unknown error")
+ self._logger.exception("Could not slice, got an unknown error")
return False, "Unknown error, please consult the log file"
finally:
diff --git a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2 b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2
index 5997ff11..03541f3b 100644
--- a/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2
+++ b/src/octoprint/plugins/svgtogcode/templates/override_index.jinja2
@@ -293,8 +293,8 @@ var UI_API_KEY = "{{ uiApiKey }}";
-
-
+
+
diff --git a/src/octoprint/printer.py b/src/octoprint/printer.py
index 3253b946..968383a2 100644
--- a/src/octoprint/printer.py
+++ b/src/octoprint/printer.py
@@ -258,6 +258,7 @@ class Printer():
if self._comm is None or (self._comm.isBusy() or self._comm.isStreaming()):
self._logger.info("Cannot load file: printer not connected or currently busy")
return
+ print("printe.py", "selectFile", filename, sd, printAfterSelect);
self._printAfterSelect = printAfterSelect
self._comm.selectFile(filename, sd)
@@ -281,7 +282,7 @@ class Printer():
return
if self._selectedFile is None:
return
-
+
self._addPositionData(None, None)
self._setCurrentZ(None)
self._comm.startPrint()
diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py
index ce82432e..b5485bcd 100644
--- a/src/octoprint/server/api/files.py
+++ b/src/octoprint/server/api/files.py
@@ -381,7 +381,6 @@ def gcodeConvertCommand():
if command == "convert":
- print("files.py convert", data)
import os
name, _ = os.path.splitext(data['gcode'])
diff --git a/src/octoprint/static/js/app/viewmodels/files.js b/src/octoprint/static/js/app/viewmodels/files.js
index bee1c85d..499463f3 100644
--- a/src/octoprint/static/js/app/viewmodels/files.js
+++ b/src/octoprint/static/js/app/viewmodels/files.js
@@ -117,7 +117,6 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicing
self._otherRequestInProgress = false;
self.requestData = function(filenameToFocus, locationToFocus) {
- console.log("requestData", filenameToFocus, locationToFocus);
if (self._otherRequestInProgress) return;
self._otherRequestInProgress = true;
@@ -126,7 +125,6 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicing
method: "GET",
dataType: "json",
success: function(response) {
- console.log("requestData api/files/response", response);
self.fromResponse(response, filenameToFocus, locationToFocus);
self._otherRequestInProgress = false;
},
@@ -174,6 +172,12 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicing
data: JSON.stringify({command: "select", print: printAfterLoad})
});
};
+
+ self.startGcodeWithSafetyWarning = function(gcodeFile){
+ self.printerState.show_safety_glasses_warning(function(){
+ self.loadFile(gcodeFile, true);
+ });
+ };
self.removeFile = function(file) {
if (!file || !file.refs || !file.refs.hasOwnProperty("resource")) return;
@@ -202,7 +206,6 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicing
self.placeSVG = function(file) {
if (file && file["refs"] && file["refs"]["download"]) {
var url = file.refs.download.replace("downloads", "serve");
- console.log("placeSVG", url);
self.workingArea.placeSVG(url);
}
};
@@ -352,37 +355,49 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel, slicing
};
self.onUpdatedFiles = function(payload) {
- console.log("onUpdatedFiles", payload)
if (payload.type == "gcode") {
self.requestData();
}
};
self.onSlicingDone = function(payload) {
- //self.requestData();
- jQuery('', {
- class: "safety_glasses_heads_up"
- }).appendTo("#confirmation_dialog .confirmation_dialog_message");
- jQuery('', {
- class: "safety_glasses_warning",
- text: gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!")
- }).appendTo("#confirmation_dialog .confirmation_dialog_message");
- //$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!"));
- $("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
- $("#confirmation_dialog .confirmation_dialog_acknowledge").click(
- function(e) {
- e.preventDefault();
- $("#confirmation_dialog").modal("hide");
- var url = API_BASEURL + "files/" + payload.gcode_location + "/" + payload.gcode;
- $.ajax({
- url: url,
- type: "POST",
- dataType: "json",
- contentType: "application/json; charset=UTF-8",
- data: JSON.stringify({command: "select", print: true})
- });
+ var callback = function(e) {
+ e.preventDefault();
+ var url = API_BASEURL + "files/" + payload.gcode_location + "/" + payload.gcode;
+ $.ajax({
+ url: url,
+ type: "POST",
+ dataType: "json",
+ contentType: "application/json; charset=UTF-8",
+ data: JSON.stringify({command: "select", print: true})
});
- $("#confirmation_dialog").modal("show");
+ };
+ self.printerState.show_safety_glasses_warning(callback);
+
+ //self.requestData();
+// jQuery('', {
+// class: "safety_glasses_heads_up"
+// }).appendTo("#confirmation_dialog .confirmation_dialog_message");
+// jQuery('', {
+// class: "safety_glasses_warning",
+// text: gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!")
+// }).appendTo("#confirmation_dialog .confirmation_dialog_message");
+// //$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!"));
+// $("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
+// $("#confirmation_dialog .confirmation_dialog_acknowledge").click(
+// function(e) {
+// e.preventDefault();
+// $("#confirmation_dialog").modal("hide");
+// var url = API_BASEURL + "files/" + payload.gcode_location + "/" + payload.gcode;
+// $.ajax({
+// url: url,
+// type: "POST",
+// dataType: "json",
+// contentType: "application/json; charset=UTF-8",
+// data: JSON.stringify({command: "select", print: true})
+// });
+// });
+// $("#confirmation_dialog").modal("show");
};
self.onMetadataAnalysisFinished = function(payload) {
diff --git a/src/octoprint/static/js/app/viewmodels/printerstate.js b/src/octoprint/static/js/app/viewmodels/printerstate.js
index e600086d..7237b9c0 100644
--- a/src/octoprint/static/js/app/viewmodels/printerstate.js
+++ b/src/octoprint/static/js/app/viewmodels/printerstate.js
@@ -206,16 +206,35 @@ function PrinterStateViewModel(loginStateViewModel, vectorConversionViewModel) {
self.busyFiles(busyFiles);
};
+ self.show_safety_glasses_warning = function(callback){
+
+ jQuery('', {
+ class: "safety_glasses_heads_up"
+ }).appendTo("#confirmation_dialog .confirmation_dialog_message");
+ jQuery('', {
+ class: "safety_glasses_warning",
+ text: gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!")
+ }).appendTo("#confirmation_dialog .confirmation_dialog_message");
+ //$("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!"));
+ $("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
+ $("#confirmation_dialog .confirmation_dialog_acknowledge").click(
+ function(e){
+ if(typeof callback === 'function'){
+ callback(e);
+ $("#confirmation_dialog").modal("hide");
+ $("#confirmation_dialog .confirmation_dialog_message").html('');
+ }
+ });
+ $("#confirmation_dialog").modal("show");
+
+ };
+
self.print_with_safety_glasses_warning = function(){
- $("#confirmation_dialog .confirmation_dialog_message").text(gettext("The laser will now start. Protect yourself and everybody in the room appropriately before proceeding!"));
- $("#confirmation_dialog .confirmation_dialog_acknowledge").unbind("click");
- $("#confirmation_dialog .confirmation_dialog_acknowledge").click(
- function(e) {
- e.preventDefault();
- $("#confirmation_dialog").modal("hide");
- self.print();
- });
- $("#confirmation_dialog").modal("show");
+ var callback = function(e) {
+ e.preventDefault();
+ self.print();
+ };
+ self.show_safety_glasses_warning(callback);
};
self.print = function() {
diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py
index a84ef034..fa3695b9 100644
--- a/src/octoprint/util/comm.py
+++ b/src/octoprint/util/comm.py
@@ -218,6 +218,7 @@ class MachineCom(object):
oldState = self.getStateString()
self._state = newState
+ print('Changing monitoring state from \'%s\' to \'%s\'' % (oldState, self.getStateString()))
self._log('Changing monitoring state from \'%s\' to \'%s\'' % (oldState, self.getStateString()))
self._callback.mcStateChange(newState)
@@ -448,6 +449,7 @@ class MachineCom(object):
"file": self._currentFile.getFilename(),
"origin": self._currentFile.getFileLocation()
})
+ print("comm.py selectFile", filename, self._currentFile)
self._callback.mcFileSelected(filename, self._currentFile.getFilesize(), False)
def unselectFile(self):
@@ -745,7 +747,8 @@ class MachineCom(object):
if("Alarm" in line):
self._changeState(self.STATE_LOCKED)
- if("Idle" in line):
+ if("Idle" in line and self._state == self.STATE_LOCKED):
+ print("### comm.py GRBL pos update", line)
self._changeState(self.STATE_OPERATIONAL)
@@ -938,7 +941,7 @@ class MachineCom(object):
self.close()
### Operational
- elif self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PAUSED or self.STATE_LOCKED:
+ elif self._state == self.STATE_OPERATIONAL or self._state == self.STATE_PAUSED or self._state == self.STATE_LOCKED:
#Request the temperature on comm timeout (every 5 seconds) when we are not printing.
if line == "" or "wait" in line:
if self._resendDelta is not None: