changed gcode viewer in macros
This commit is contained in:
@@ -15,11 +15,6 @@ module.exports = {
|
|||||||
newGcode: ["", "", "", "", "", "", "", ""],
|
newGcode: ["", "", "", "", "", "", "", ""],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
"axis-control": require("./axis-control"),
|
|
||||||
"path-viewer": require("./path-viewer"),
|
|
||||||
"gcode-viewer": require("./gcode-viewer"),
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
mach_state: function () {
|
mach_state: function () {
|
||||||
const cycle = this.state.cycle;
|
const cycle = this.state.cycle;
|
||||||
@@ -42,11 +37,15 @@ module.exports = {
|
|||||||
open: function () {
|
open: function () {
|
||||||
utils.clickFileInput("gcode-file-input");
|
utils.clickFileInput("gcode-file-input");
|
||||||
},
|
},
|
||||||
load: function () {
|
load: async function () {
|
||||||
const file = this.state.selected;
|
const file = this.state.selected;
|
||||||
this.$broadcast("gcode-load", file);
|
const response = await fetch(`/api/file/${file}`, { cache: "no-cache" });
|
||||||
this.$broadcast("gcode-line", this.state.line);
|
const text = await response.text();
|
||||||
this.newGcode[this.tab - 1] = "";
|
if (text.length > 20e6) {
|
||||||
|
this.newGcode[this.tab - 1] = "File is large - gcode view disabled";
|
||||||
|
} else {
|
||||||
|
this.newGcode[this.tab - 1] = text;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
upload: function (e) {
|
upload: function (e) {
|
||||||
const files = e.target.files || e.dataTransfer.files;
|
const files = e.target.files || e.dataTransfer.files;
|
||||||
@@ -72,11 +71,10 @@ module.exports = {
|
|||||||
file,
|
file,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.last_file_time = undefined; // Force reload
|
this.last_file_time = undefined; // Force reload
|
||||||
this.$broadcast("gcode-reload", file.name);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
uploadGCode: function (filename,file) {
|
uploadGCode: function (filename, file) {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
xhr.onload = function () {
|
xhr.onload = function () {
|
||||||
@@ -112,12 +110,13 @@ module.exports = {
|
|||||||
|
|
||||||
if (this.state.selected == "default") {
|
if (this.state.selected == "default") {
|
||||||
var file = this.newGcode[this.tab - 1];
|
var file = this.newGcode[this.tab - 1];
|
||||||
this.uploadGCode(macrosName,file);
|
this.uploadGCode(macrosName, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.config.macros[this.tab - 1].name = macrosName;
|
this.config.macros[this.tab - 1].name = macrosName;
|
||||||
this.config.macros[this.tab - 1].color = macrosColor;
|
this.config.macros[this.tab - 1].color = macrosColor;
|
||||||
this.config.macros[this.tab - 1].gcode_file_name = this.state.selected == 'default' ? macrosName : this.state.selected;
|
this.config.macros[this.tab - 1].gcode_file_name =
|
||||||
|
this.state.selected == "default" ? macrosName : this.state.selected;
|
||||||
this.config.macros[this.tab - 1].gcode_file_time =
|
this.config.macros[this.tab - 1].gcode_file_time =
|
||||||
this.state.selected_time;
|
this.state.selected_time;
|
||||||
this.cancelMacros(this.tab - 1);
|
this.cancelMacros(this.tab - 1);
|
||||||
@@ -135,7 +134,7 @@ module.exports = {
|
|||||||
document.getElementById(`macros-name-${this.tab - 1}`).value = "";
|
document.getElementById(`macros-name-${this.tab - 1}`).value = "";
|
||||||
document.getElementById(`macros-color-${this.tab - 1}`).value = "#ffffff";
|
document.getElementById(`macros-color-${this.tab - 1}`).value = "#ffffff";
|
||||||
document.getElementById(`gcodeSelect-${this.tab - 1}`).value = "default";
|
document.getElementById(`gcodeSelect-${this.tab - 1}`).value = "default";
|
||||||
this.$broadcast("gcode-clear");
|
this.newGcode[this.tab-1] = '';
|
||||||
},
|
},
|
||||||
resetConfig: async function () {
|
resetConfig: async function () {
|
||||||
this.config.macros = [
|
this.config.macros = [
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ script#macros-template(type="text/x-template")
|
|||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
br
|
br
|
||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( :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",@click="confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="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",
|
||||||
@@ -105,8 +105,8 @@ script#macros-template(type="text/x-template")
|
|||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
br
|
br
|
||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( :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",@click="confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="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",
|
||||||
@@ -135,8 +135,8 @@ script#macros-template(type="text/x-template")
|
|||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
br
|
br
|
||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( :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",@click="confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="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",
|
||||||
@@ -165,8 +165,8 @@ script#macros-template(type="text/x-template")
|
|||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
br
|
br
|
||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( :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",@click="confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="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",
|
||||||
@@ -195,8 +195,8 @@ script#macros-template(type="text/x-template")
|
|||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
br
|
br
|
||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( :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",@click="confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="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",
|
||||||
@@ -225,8 +225,8 @@ script#macros-template(type="text/x-template")
|
|||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
br
|
br
|
||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( :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",@click="confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="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",
|
||||||
@@ -255,8 +255,8 @@ script#macros-template(type="text/x-template")
|
|||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
br
|
br
|
||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( :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",@click="confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="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",
|
||||||
@@ -285,9 +285,12 @@ script#macros-template(type="text/x-template")
|
|||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
br
|
br
|
||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( :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",@click="confirmSave=true",
|
button.submit-macros(title="Save Macros",@click="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
|
||||||
|
|
||||||
|
button.submit-macros(title="Cancel Macros",@click="printState",
|
||||||
|
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Print State
|
||||||
|
|||||||
@@ -146,6 +146,10 @@ class State(object):
|
|||||||
files.append(filename)
|
files.append(filename)
|
||||||
files.sort()
|
files.sort()
|
||||||
self.set('files', files)
|
self.set('files', files)
|
||||||
|
self.log.info('===================')
|
||||||
|
for i in files:
|
||||||
|
self.log.info(i)
|
||||||
|
self.log.info('===================')
|
||||||
|
|
||||||
self.select_file(filename)
|
self.select_file(filename)
|
||||||
|
|
||||||
|
|||||||
@@ -628,8 +628,11 @@ span.unit
|
|||||||
width 140px
|
width 140px
|
||||||
font-weight normal
|
font-weight normal
|
||||||
border-radius 10px
|
border-radius 10px
|
||||||
|
margin-left 1rem
|
||||||
border 0
|
border 0
|
||||||
color #fff
|
color #fff
|
||||||
|
box-shadow rgba(0, 0, 0, 0.3) 0px 0px 5px
|
||||||
|
text-shadow: rgba(0, 0, 0, 0.8) 0px 0px 3px
|
||||||
|
|
||||||
#macros
|
#macros
|
||||||
width 104%
|
width 104%
|
||||||
|
|||||||
Reference in New Issue
Block a user