From cffbcb524f515655fc41a3ca8bcc8acb8b1c3b00 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Tue, 9 Jan 2024 23:22:11 +0530 Subject: [PATCH] disabled button on running --- src/js/macros.js | 3 +++ src/pug/templates/control-view.pug | 16 ++++++++-------- src/pug/templates/macros.pug | 11 +++++++++++ src/py/bbctrl/Config.py | 2 +- src/stylus/style.styl | 5 +++-- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/js/macros.js b/src/js/macros.js index 2296919..ed46eb6 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -11,6 +11,7 @@ module.exports = { return { tab: "1", confirmReset: false, + confirmSave: false, }; }, components: { @@ -73,6 +74,8 @@ module.exports = { var macrosName = document.getElementById(`macros-name-${id}`).value; var macrosColor = document.getElementById(`macros-color-${id}`).value; + console.log(this.tab); + this.config.macros[id].name = macrosName; this.config.macros[id].color = macrosColor; this.config.macros[id].gcode_file_name = this.state.selected; diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index b8552ab..f37867d 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -209,21 +209,21 @@ script#control-view-template(type="text/x-template") .macros-div(class="present") button.macros-buttons(title="Click to run Macros 1", @click="runMacros(0)", - :disabled="!true",v-bind:style="{ backgroundColor: config.macros[0].color }") {{config.macros[0].name}} + :disabled="!is_ready",v-bind:style="{ backgroundColor: config.macros[0].color }") {{config.macros[0].name}} button.macros-buttons(title="Click to run Macros 2", @click="runMacros(1)", - :disabled="!true",v-bind:style="{ backgroundColor: config.macros[1].color }") {{config.macros[1].name}} + :disabled="!is_ready",v-bind:style="{ backgroundColor: config.macros[1].color }") {{config.macros[1].name}} button.macros-buttons(title="Click to run Macros 3", @click="runMacros(2)", - :disabled="!true",v-bind:style="{ backgroundColor: config.macros[2].color }") {{config.macros[2].name}} + :disabled="!is_ready",v-bind:style="{ backgroundColor: config.macros[2].color }") {{config.macros[2].name}} button.macros-buttons(title="Click to run Macros 4", @click="runMacros(3)", - :disabled="!true",v-bind:style="{ backgroundColor: config.macros[3].color }") {{config.macros[3].name}} + :disabled="!is_ready",v-bind:style="{ backgroundColor: config.macros[3].color }") {{config.macros[3].name}} button.macros-buttons(title="Click to run Macros 5", @click="runMacros(4)", - :disabled="!true",v-bind:style="{ backgroundColor: config.macros[4].color }") {{config.macros[4].name}} + :disabled="!is_ready",v-bind:style="{ backgroundColor: config.macros[4].color }") {{config.macros[4].name}} button.macros-buttons(title="Click to run Macros 6", @click="runMacros(5)", - :disabled="!true",v-bind:style="{ backgroundColor: config.macros[5].color }") {{config.macros[5].name}} + :disabled="!is_ready",v-bind:style="{ backgroundColor: config.macros[5].color }") {{config.macros[5].name}} button.macros-buttons(title="Click to run Macros 7", @click="runMacros(6)", - :disabled="!true",v-bind:style="{ backgroundColor: config.macros[6].color }") {{config.macros[6].name}} + :disabled="!is_ready",v-bind:style="{ backgroundColor: config.macros[6].color }") {{config.macros[6].name}} button.macros-buttons(title="Click to run Macros 8", @click="runMacros(7)", - :disabled="!true",v-bind:style="{ backgroundColor: config.macros[7].color }") {{config.macros[7].name}} + :disabled="!is_ready",v-bind:style="{ backgroundColor: config.macros[7].color }") {{config.macros[7].name}} .tabs diff --git a/src/pug/templates/macros.pug b/src/pug/templates/macros.pug index e21ce21..a6a6352 100644 --- a/src/pug/templates/macros.pug +++ b/src/pug/templates/macros.pug @@ -9,6 +9,17 @@ script#macros-template(type="text/x-template") button.pure-button(@click="confirmReset=false") Cancel button.pure-button.pure-button-primary(@click="resetConfig") | Reset + + message(:show.sync="confirmSave") + h3(slot="header") Confirm Save? + div(slot="body") + p Are you sure you want to save the current settings? + + div(slot="footer") + button.pure-button(@click="confirmSave=false") Cancel + button.pure-button.pure-button-primary(@click="resetConfig") + | Confirm + h1 Macros Configuration button.pure-button(title="Reset Macros", @click="confirmReset=true", style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around") Reset Macros diff --git a/src/py/bbctrl/Config.py b/src/py/bbctrl/Config.py index 18e148f..92725d4 100644 --- a/src/py/bbctrl/Config.py +++ b/src/py/bbctrl/Config.py @@ -43,7 +43,7 @@ class Config(object): self.values = {} try: - self.version = "1.4.0 Alpha 1" + self.version = "1.4.0" # Load config template with open(get_resource('http/config-template.json'), 'r', diff --git a/src/stylus/style.styl b/src/stylus/style.styl index f3eabb4..c4b4afa 100644 --- a/src/stylus/style.styl +++ b/src/stylus/style.styl @@ -648,8 +648,9 @@ span.unit display flex flex-direction row - .tabs - margin-top 5px +.tabs + margin-top 5px + width 105% .submit-macros height 50px