Fixed the issue where the UI becomes unresponsive on the first file upload
This commit is contained in:
@@ -511,15 +511,23 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
load_toolpath: function (file, file_time) {
|
load_toolpath: async function (file, file_time) {
|
||||||
this.toolpath = {};
|
this.toolpath = {};
|
||||||
|
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
api.get('path/' + file).done(function (toolpath) {
|
|
||||||
if (this.last_file_time != file_time) return;
|
if (this.last_file_time != file_time) return;
|
||||||
|
|
||||||
|
this.showGcodeMessage = true;
|
||||||
|
|
||||||
|
let done;
|
||||||
|
while (!done) {
|
||||||
|
const toolpath = await api.get(`path/${file}`);
|
||||||
|
|
||||||
|
console.log("toolpath progress: ", toolpath.progress);
|
||||||
|
|
||||||
if (typeof toolpath.progress == 'undefined') {
|
if (typeof toolpath.progress == 'undefined') {
|
||||||
|
console.log("done loading toolpath");
|
||||||
|
done = true;
|
||||||
toolpath.filename = file;
|
toolpath.filename = file;
|
||||||
this.toolpath_progress = 1;
|
this.toolpath_progress = 1;
|
||||||
this.showGcodeMessage = false;
|
this.showGcodeMessage = false;
|
||||||
@@ -531,13 +539,11 @@ module.exports = {
|
|||||||
Vue.set(state, 'path_min_' + axis, bounds.min[axis]);
|
Vue.set(state, 'path_min_' + axis, bounds.min[axis]);
|
||||||
Vue.set(state, 'path_max_' + axis, bounds.max[axis]);
|
Vue.set(state, 'path_max_' + axis, bounds.max[axis]);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.showGcodeMessage = true;
|
console.log("Still loading toolpath");
|
||||||
this.toolpath_progress = toolpath.progress;
|
this.toolpath_progress = toolpath.progress;
|
||||||
this.load_toolpath(file, file_time); // Try again
|
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,54 @@
|
|||||||
|
|
||||||
script#control-view-template(type="text/x-template")
|
script#control-view-template(type="text/x-template")
|
||||||
#control
|
#control
|
||||||
|
message(:show.sync="showGcodeMessage")
|
||||||
|
h3(slot="header") Processing New File
|
||||||
|
|
||||||
|
div(slot="body")
|
||||||
|
h3 Please wait..
|
||||||
|
p Simulating GCode to check for errors, calculate ETA and generate 3D view.
|
||||||
|
|
||||||
|
div(slot="footer")
|
||||||
|
label Simulating {{(toolpath_progress || 0) | percent}}
|
||||||
|
|
||||||
|
message(:show.sync=`ask_home_msg`)
|
||||||
|
h3(slot="header") Home Machine
|
||||||
|
|
||||||
|
div(slot="body")
|
||||||
|
p Home the machine?
|
||||||
|
|
||||||
|
div(slot="footer")
|
||||||
|
button.pure-button(@click="home()")
|
||||||
|
| OK
|
||||||
|
|
||||||
|
button.pure-button(@click='ask_home_msg = false; ask_home = false')
|
||||||
|
| Cancel
|
||||||
|
|
||||||
|
message(:show.sync=`ask_zero_xy_msg`)
|
||||||
|
h3(slot="header") XY Origin
|
||||||
|
|
||||||
|
div(slot="body")
|
||||||
|
p Move to XY origin?
|
||||||
|
|
||||||
|
div(slot="footer")
|
||||||
|
button.pure-button(@click="goto_zero(1,1,0,0)")
|
||||||
|
| Confirm
|
||||||
|
|
||||||
|
button.pure-button(@click='ask_zero_xy_msg = false')
|
||||||
|
| Cancel
|
||||||
|
|
||||||
|
message(:show.sync=`ask_zero_z_msg`)
|
||||||
|
h3(slot="header") Z Origin
|
||||||
|
|
||||||
|
div(slot="body")
|
||||||
|
p Move to Z origin?
|
||||||
|
|
||||||
|
div(slot="footer")
|
||||||
|
button.pure-button(@click="goto_zero(0,0,1,0)")
|
||||||
|
| Confirm
|
||||||
|
|
||||||
|
button.pure-button(@click='ask_zero_z_msg = false')
|
||||||
|
| Cancel
|
||||||
|
|
||||||
table(width="99%")
|
table(width="99%")
|
||||||
tr
|
tr
|
||||||
@@ -114,56 +162,6 @@ script#control-view-template(type="text/x-template")
|
|||||||
button.pure-button(@click=`toolpath_msg['${axis}'] = false`)
|
button.pure-button(@click=`toolpath_msg['${axis}'] = false`)
|
||||||
| OK
|
| OK
|
||||||
|
|
||||||
|
|
||||||
message(:show.sync="showGcodeMessage")
|
|
||||||
h3(slot="header") Processing New File
|
|
||||||
|
|
||||||
div(slot="body")
|
|
||||||
h3 Please wait..
|
|
||||||
p Simulating GCode to check for errors, calculate ETA and generate 3D view.
|
|
||||||
|
|
||||||
div(slot="footer")
|
|
||||||
label Simulating {{(toolpath_progress || 0) | percent}}
|
|
||||||
|
|
||||||
message(:show.sync=`ask_home_msg`)
|
|
||||||
h3(slot="header") Home Machine
|
|
||||||
|
|
||||||
div(slot="body")
|
|
||||||
p Home the machine?
|
|
||||||
|
|
||||||
div(slot="footer")
|
|
||||||
button.pure-button(@click="home()")
|
|
||||||
| OK
|
|
||||||
|
|
||||||
button.pure-button(@click='ask_home_msg = false; ask_home = false')
|
|
||||||
| Cancel
|
|
||||||
|
|
||||||
message(:show.sync=`ask_zero_xy_msg`)
|
|
||||||
h3(slot="header") XY Origin
|
|
||||||
|
|
||||||
div(slot="body")
|
|
||||||
p Move to XY origin?
|
|
||||||
|
|
||||||
div(slot="footer")
|
|
||||||
button.pure-button(@click="goto_zero(1,1,0,0)")
|
|
||||||
| Confirm
|
|
||||||
|
|
||||||
button.pure-button(@click='ask_zero_xy_msg = false')
|
|
||||||
| Cancel
|
|
||||||
|
|
||||||
message(:show.sync=`ask_zero_z_msg`)
|
|
||||||
h3(slot="header") Z Origin
|
|
||||||
|
|
||||||
div(slot="body")
|
|
||||||
p Move to Z origin?
|
|
||||||
|
|
||||||
div(slot="footer")
|
|
||||||
button.pure-button(@click="goto_zero(0,0,1,0)")
|
|
||||||
| Confirm
|
|
||||||
|
|
||||||
button.pure-button(@click='ask_zero_z_msg = false')
|
|
||||||
| Cancel
|
|
||||||
|
|
||||||
th.actions
|
th.actions
|
||||||
button.pure-button(:disabled="!can_set_axis",
|
button.pure-button(:disabled="!can_set_axis",
|
||||||
title=`Set {{'${axis}' | upper}} axis position.`,
|
title=`Set {{'${axis}' | upper}} axis position.`,
|
||||||
|
|||||||
Reference in New Issue
Block a user