diff --git a/src/js/control-view.js b/src/js/control-view.js index 6e0383c..7a5f6c2 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -43,6 +43,7 @@ module.exports = { ask_home: true, showGcodeMessage: false, showNoGcodeMessage: false, + macrosLoading: false, }; }, @@ -292,6 +293,8 @@ module.exports = { this.last_file = file; this.last_file_time = file_time; + console.log("loading file: ", file); + this.$broadcast("gcode-load", file); this.$broadcast("gcode-line", this.state.line); this.toolpath_progress = 0; @@ -545,7 +548,7 @@ module.exports = { SvelteComponents.showDialog("Probe", { probeType }); }, runMacros: function (id) { - console.log("index",id); + console.log("index", id); if (this.config.macros[id].file_name == "default") { this.showNoGcodeMessage = true; } else { @@ -554,7 +557,8 @@ module.exports = { } try { this.load(); - this.start_pause(); + this.macrosLoading = true; + // this.start_pause(); } catch (error) { console.warn("Error running program: ", error); } diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index 03509da..0aa0148 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -18,6 +18,15 @@ script#control-view-template(type="text/x-template") div(slot="footer") button.pure-button(@click="showNoGcodeMessage=false") OK + message(:show.sync="macrosLoading") + h3(slot="header") Run Macros? + div(slot="body") + p The selected macros is being loaded. + + div(slot="footer") + button.pure-button(@click="macrosLoading=false") Cancel + button.pure-button.pure-button-primary(@click="start_pause") Run + table(style="table-layout: fixed; width: 100%;") tr(style="height: fit-content;") td(style="white-space: nowrap; width: 410px;", rowspan="2") diff --git a/src/py/bbctrl/State.py b/src/py/bbctrl/State.py index dd4494c..d29c27e 100644 --- a/src/py/bbctrl/State.py +++ b/src/py/bbctrl/State.py @@ -169,7 +169,7 @@ class State(object): self.set('files', files) if self.get('selected', filename) == filename: - if len(files): self.select_file(files[0]) + if len(files): self.select_file('') else: self.select_file('')