testing macros state
This commit is contained in:
@@ -114,6 +114,7 @@ module.exports = new Vue({
|
|||||||
full_version: "<loading>",
|
full_version: "<loading>",
|
||||||
ip: "<>",
|
ip: "<>",
|
||||||
wifiName: "not connected",
|
wifiName: "not connected",
|
||||||
|
macros:[]
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
messages: [],
|
messages: [],
|
||||||
|
|||||||
@@ -201,6 +201,12 @@ module.exports = {
|
|||||||
|
|
||||||
const p = this.plan_time / this.toolpath.time;
|
const p = this.plan_time / this.toolpath.time;
|
||||||
return Math.min(1, p);
|
return Math.min(1, p);
|
||||||
|
},
|
||||||
|
isMacrosPresent: function(){
|
||||||
|
if(this.config.macros!=undefined){
|
||||||
|
return this.config.macros.length!=0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -493,6 +499,24 @@ module.exports = {
|
|||||||
|
|
||||||
showProbeDialog: function(probeType) {
|
showProbeDialog: function(probeType) {
|
||||||
SvelteComponents.showDialog("Probe", { probeType });
|
SvelteComponents.showDialog("Probe", { probeType });
|
||||||
|
},
|
||||||
|
|
||||||
|
runMacros: function(id){
|
||||||
|
if(id==null || id == undefined ){
|
||||||
|
console.log("id null/undefined");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.config.macros!=undefined && this.config.macros.length!=0){
|
||||||
|
this.config.macros.find(el=>{
|
||||||
|
if(el.id==id){
|
||||||
|
console.log(el);
|
||||||
|
}else{
|
||||||
|
console.log("error in finding macros");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
console.log("No macros found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -58,5 +58,15 @@ module.exports = {
|
|||||||
this.toolpath_progress = 0;
|
this.toolpath_progress = 0;
|
||||||
this.load_toolpath(file, file_time);
|
this.load_toolpath(file, file_time);
|
||||||
},
|
},
|
||||||
|
saveMacros: function(){
|
||||||
|
var macrosName = document.getElementById("macros-name").value;
|
||||||
|
var macrosColor = document.getElementById("macros-color").value;
|
||||||
|
if(this.config.macros == undefined) return;
|
||||||
|
this.config.macros.push({
|
||||||
|
id:Math.random(),
|
||||||
|
name:macrosName,
|
||||||
|
color:macrosColor
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,6 +207,11 @@ script#control-view-template(type="text/x-template")
|
|||||||
label {{(progress || 0) | percent}}
|
label {{(progress || 0) | percent}}
|
||||||
.bar(:style="'width:' + (progress || 0) * 100 + '%'")
|
.bar(:style="'width:' + (progress || 0) * 100 + '%'")
|
||||||
|
|
||||||
|
.macros-buttons(v-if="isMacrosPresent")
|
||||||
|
each macros in this.config.macros
|
||||||
|
button.macros-button(title="{{macros.id}}",@click="runMacros(macros.id)",
|
||||||
|
style="height:30px;width:40px;background-color:macros.color")macros.name
|
||||||
|
|
||||||
.tabs
|
.tabs
|
||||||
|
|
||||||
input#tab1(type="radio", name="tabs",checked="" @click="tab = 'auto'")
|
input#tab1(type="radio", name="tabs",checked="" @click="tab = 'auto'")
|
||||||
|
|||||||
@@ -2,19 +2,18 @@ script#macros-template(type="text/x-template")
|
|||||||
#macros
|
#macros
|
||||||
h1 Macros Configuration
|
h1 Macros Configuration
|
||||||
.macros-form
|
.macros-form
|
||||||
.input-field
|
p.title Enter Macros Name
|
||||||
h4 Enter Macros Name
|
input.input-name(type="text",id="macros-name")
|
||||||
input.input-name(type="text",id="macros-name",value="e.g Macros 1 ")
|
p.title Select Your Macros Color
|
||||||
.input-field
|
|
||||||
h4 Select Your Macros Color
|
|
||||||
input.input-color(type="color",id="macros-color",value="#ffffff")
|
input.input-color(type="color",id="macros-color",value="#ffffff")
|
||||||
.input-field
|
p.title Select/Upload G-Code
|
||||||
h3 Select/Upload G-Code
|
button.pure-button(title="Upload a new GCode program.", @click="open",
|
||||||
button.pure-button(title="Upload a new GCode program.", @click="open",
|
|
||||||
:disabled="!is_ready",style="height:100px;width:100px;font-weight:normal")
|
:disabled="!is_ready",style="height:100px;width:100px;font-weight:normal")
|
||||||
.fa.fa-folder-open
|
.fa.fa-folder-open
|
||||||
select(title="Select previously uploaded GCode programs.",
|
select(title="Select previously uploaded GCode programs.",
|
||||||
v-model="state.selected", @change="load", :disabled="!is_ready",
|
v-model="state.selected", @change="load", :disabled="!is_ready",
|
||||||
style="max-width:100%")
|
style="max-width:100%")
|
||||||
option(v-for="file in state.files", :value="file") {{file}}
|
option(v-for="file in state.files", :value="file") {{file}}
|
||||||
|
button.submit-macros(title="Save Macros",@click="saveMacros",style="height:100px;width:100px;font-weight:normal")
|
||||||
|
|
||||||
gcode-viewer
|
gcode-viewer
|
||||||
|
|||||||
@@ -611,6 +611,9 @@ span.unit
|
|||||||
margin 0 0.5em
|
margin 0 0.5em
|
||||||
vertical-align middle
|
vertical-align middle
|
||||||
|
|
||||||
|
.macros-buttons
|
||||||
|
padding 40px
|
||||||
|
|
||||||
.path-viewer
|
.path-viewer
|
||||||
table
|
table
|
||||||
margin 0.25em
|
margin 0.25em
|
||||||
|
|||||||
Reference in New Issue
Block a user