wrote func for event handling for save button
This commit is contained in:
@@ -48,19 +48,16 @@ module.exports = {
|
|||||||
const file = this.state.selected;
|
const file = this.state.selected;
|
||||||
this.$broadcast("gcode-load", file);
|
this.$broadcast("gcode-load", file);
|
||||||
this.$broadcast("gcode-line", this.state.line);
|
this.$broadcast("gcode-line", this.state.line);
|
||||||
this.newGCode[this.tab-1] = "";
|
this.newGCode[this.currentTab] = "";
|
||||||
},
|
},
|
||||||
upload: function (e) {
|
upload: function (e) {
|
||||||
console.log('54');
|
|
||||||
const files = e.target.files || e.dataTransfer.files;
|
const files = e.target.files || e.dataTransfer.files;
|
||||||
if (!files.length) {
|
if (!files.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const file = files[0];
|
const file = files[0];
|
||||||
console.log(file);
|
|
||||||
const extension = file.name.split(".").pop();
|
const extension = file.name.split(".").pop();
|
||||||
console.log(extension);
|
|
||||||
switch (extension.toLowerCase()) {
|
switch (extension.toLowerCase()) {
|
||||||
case "nc":
|
case "nc":
|
||||||
case "ngc":
|
case "ngc":
|
||||||
@@ -72,7 +69,6 @@ module.exports = {
|
|||||||
alert(`Unsupported file type: ${extension}`);
|
alert(`Unsupported file type: ${extension}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("file: ",file);
|
|
||||||
SvelteComponents.showDialog("Upload", {
|
SvelteComponents.showDialog("Upload", {
|
||||||
file,
|
file,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",v-on:click="currentTab=0;confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="()=>{currentTab=0; confirmSave=true}",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||||
@@ -107,7 +107,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",v-on:click="currentTab=1;confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="()=>{currentTab=1; confirmSave=true}",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||||
@@ -137,7 +137,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",v-on:click="currentTab=2;confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="()=>{currentTab=2; confirmSave=true}",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||||
@@ -167,7 +167,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",v-on:click="currentTab=3;confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="()=>{currentTab=3; confirmSave=true}",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||||
@@ -197,7 +197,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",v-on:click="currentTab=4;confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="()=>{currentTab=4; confirmSave=true}",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||||
@@ -227,7 +227,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",v-on:click="currentTab=5;confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="()=>{currentTab=5; confirmSave=true}",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||||
@@ -257,7 +257,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",v-on:click="currentTab=6;confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="()=>{currentTab=6; confirmSave=true}",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||||
@@ -287,7 +287,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",v-on:click="currentTab=7;confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="()=>{currentTab=7; confirmSave=true}",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||||
|
|||||||
Reference in New Issue
Block a user