feature: add option to enable cancel_print button permanently

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej
2021-03-08 23:54:20 +01:00
parent 42c353df20
commit 0825d85000
3 changed files with 46 additions and 15 deletions

View File

@@ -7,13 +7,33 @@
</v-toolbar-title>
</v-toolbar>
<v-card-text class="pt-2 pb-0">
<v-text-field
v-model="printerName"
label="Printer Name"
></v-text-field>
<v-row>
<v-col class="text-center mt-0">
<v-btn @click="dialogResetMainsail=true" >reset mainsail</v-btn>
<v-col>
<v-text-field
v-model="printerName"
label="Printer Name"
hide-details
></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col class="py-2">
<v-switch v-model="displayCancelPrint" hide-details class="mt-0">
<template v-slot:label>
Display CANCEL_PRINT
<v-tooltip right>
<template v-slot:activator="{ on, attrs }">
<v-icon class="text--secondary ml-2" v-bind="attrs" v-on="on">mdi mdi-information</v-icon>
</template>
<span>Shows the CANCEL_PRINT button permanently - no second layer confirmation needed.</span>
</v-tooltip>
</template>
</v-switch>
</v-col>
</v-row>
<v-row>
<v-col class="text-center">
<v-btn @click="dialogResetMainsail=true" >factory reset</v-btn>
</v-col>
</v-row>
</v-card-text>
@@ -23,7 +43,7 @@
<v-toolbar flat dense color="primary">
<v-toolbar-title>
<span class="subheading">
<v-icon class="mdi mdi-help-circle" left></v-icon> Reset Mainsail
<v-icon class="mdi mdi-help-circle" left></v-icon> Factory reset
</span>
</v-toolbar-title>
<v-spacer></v-spacer>
@@ -74,6 +94,14 @@
return this.$store.dispatch('gui/setSettings', { general: { printername: newName } })
}
},
displayCancelPrint: {
get() {
return this.$store.state.gui.general.displayCancelPrint;
},
set(displayCancelPrint) {
return this.$store.dispatch('gui/setSettings', { general: { displayCancelPrint: displayCancelPrint } });
}
},
},
methods: {
resetMainsail() {

View File

@@ -30,14 +30,6 @@
<span>Pause print</span>
</v-tooltip>
</v-btn>
<v-btn small class="px-2 minwidth-0" color="red" v-if="(printer_state === 'paused')" :loading="loadings.includes('statusPrintCancel')" @click="btnCancelJob">
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-icon v-bind="attrs" v-on="on" small>mdi-stop</v-icon>
</template>
<span>Cancel print</span>
</v-tooltip>
</v-btn>
<v-btn small class="px-2 minwidth-0" color="orange" v-if="(printer_state === 'paused')" :loading="loadings.includes('statusPrintResume')" @click="btnResumeJob">
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
@@ -46,6 +38,14 @@
<span>Resume print</span>
</v-tooltip>
</v-btn>
<v-btn small class="px-2 minwidth-0" color="red" v-if="(printer_state === 'paused' || (displayCancelPrint && printer_state === 'printing'))" :loading="loadings.includes('statusPrintCancel')" @click="btnCancelJob">
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-icon v-bind="attrs" v-on="on" small>mdi-stop</v-icon>
</template>
<span>Cancel print</span>
</v-tooltip>
</v-btn>
<v-btn small class="px-2 minwidth-0" color="primary" v-if="['error', 'complete'].includes(printer_state)" :loading="loadings.includes('statusPrintClear')" @click="btnClearJob">
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
@@ -249,6 +249,8 @@
display_message: state => state.printer.display_status.message,
loadings: state => state.socket.loadings,
displayCancelPrint: state => state.gui.general.displayCancelPrint,
}),
printPercent: {
get() {

View File

@@ -6,6 +6,7 @@ export function getDefaultState() {
return {
general: {
printername: "",
displayCancelPrint: false
},
dashboard: {
boolWebcam: false,