From 894e7b64cba90a09334e9ef58c791fb624d406fe Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Wed, 27 Mar 2024 15:27:00 +0530 Subject: [PATCH] gcodes box, naming conventions, --- src/js/control-view.js | 19 +++++++++++-------- src/js/macros.js | 12 ++++++------ src/pug/templates/control-view.pug | 18 ++++++++++++++++++ src/pug/templates/macros.pug | 4 ++-- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/js/control-view.js b/src/js/control-view.js index b3b5890..d45d72f 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -44,6 +44,7 @@ module.exports = { showGcodeMessage: false, showNoGcodeMessage: false, macrosLoading: false, + show_gcodes: false, }; }, @@ -413,7 +414,7 @@ module.exports = { const folderName = files[0].webkitRelativePath.split("/")[0]; console.log(files); for (let file of files) { - console.log(file); + console.log(file.name); const extension = file.name.split(".").pop(); switch (extension.toLowerCase()) { case "nc": @@ -453,13 +454,15 @@ module.exports = { alert("Restore failed"); } - SvelteComponents.showDialog("Upload", { - file, - onComplete: () => { - this.last_file_time = undefined; // Force reload - this.$broadcast("gcode-reload", file.name); - }, - }); + setImmediate(() => + SvelteComponents.showDialog("Upload", { + file, + onComplete: () => { + this.last_file_time = undefined; // Force reload + this.$broadcast("gcode-reload", file.name); + }, + }), + ); } }, diff --git a/src/js/macros.js b/src/js/macros.js index 0ba47a1..49f8a16 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -377,11 +377,11 @@ module.exports = { } this.deleteSelected = false; }, - }, - print_config: function () { - console.log(this.config); - }, - print_state: function () { - console.log(this.state); + print_config: function () { + console.log(this.config); + }, + print_state: function () { + console.log(this.state); + }, }, }; diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index 6657161..a7a1075 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -270,7 +270,25 @@ script#control-view-template(type="text/x-template") :disabled="(!is_ready && !is_holding) || !state.selected", v-if="false", style="height:100px;width:100px;font-weight:normal") .fa.fa-step-forward + + message(:show.sync="show_gcodes") + h3(slot="header") Select G-Code + div(slot="body") + details + summary + | folder name + ul.folder-list + li one + li two + + div(slot="footer") + button.pure-button(@click="show_gcodes=false") Cancel + button.pure-button.pure-button-primary(@click="show_gcodes=false") Select + button.pure-button(title="Open Title", @click="show_gcodes=true", + :disabled="!is_ready",style="height:100px;width:100px;font-weight:normal") + .fa.fa-folder + button.pure-button(title="Upload a new GCode program.", @click="open_file", :disabled="!is_ready",style="height:100px;width:100px;font-weight:normal") .fa.fa-folder-open diff --git a/src/pug/templates/macros.pug b/src/pug/templates/macros.pug index 3070505..487f377 100644 --- a/src/pug/templates/macros.pug +++ b/src/pug/templates/macros.pug @@ -110,5 +110,5 @@ script#macros-template(type="text/x-template") button.submit-macros.button-success(title="Save Macros",@click="confirmSave=true",:disabled="!edited") Save button.submit-macros(title="Cancel Macros",@click="clear_macro",style="margin-left:5px;background-color:#fafafa;",:disabled="initial_tab") Cancel - button.submit-macros(title="Cancel Macros",@click="print_config",style="margin-left:5px;background-color:#fafafa;",:disabled="initial_tab") CONFIG - button.submit-macros(title="Cancel Macros",@click="print_state",style="margin-left:5px;background-color:#fafafa;",:disabled="initial_tab") STATE + button.submit-macros(title="Cancel Macros",@click="print_config",style="margin-left:5px;background-color:#fafafa;") CONFIG + button.submit-macros(title="Cancel Macros",@click="print_state",style="margin-left:5px;background-color:#fafafa;") STATE