added method for upload gcode and ui fix in macros and checking the func in control-view

This commit is contained in:
sanjayk03-dev
2023-12-30 18:57:16 +05:30
parent 9b8e52edaf
commit e3ca0ba3a3
3 changed files with 35 additions and 2 deletions

View File

@@ -53,6 +53,34 @@ module.exports = {
this.toolpath_progress = 0;
this.load_toolpath(file, file_time);
},
upload: function(e) {
const files = e.target.files || e.dataTransfer.files;
if (!files.length) {
return;
}
const file = files[0];
const extension = file.name.split(".").pop();
switch (extension.toLowerCase()) {
case "nc":
case "ngc":
case "gcode":
case "gc":
break;
default:
alert(`Unsupported file type: ${extension}`);
return;
}
SvelteComponents.showDialog("Upload", {
file,
onComplete: () => {
this.last_file_time = undefined; // Force reload
this.$broadcast("gcode-reload", file.name);
}
});
},
saveMacros: function(){
var macrosName = document.getElementById("macros-name").value;
var macrosColor = document.getElementById("macros-color").value;