From f974372cbebde56733947b20d155b6d93413ed63 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 20 Feb 2022 12:42:17 +0100 Subject: [PATCH] feat: add profile name field to calibrate bed_mesh dialog (#664) --- src/locales/en.json | 1 - src/pages/Heightmap.vue | 44 ++++++++++++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 76016f195..6f17b710e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -249,7 +249,6 @@ "Rename": "rename", "BedMeshRemove": "Bed Mesh Remove", "BedMeshCalibrate": "Bed Mesh Calibrate", - "DoYouReallyWantToCalibrate": "Do you really want to start the bed calibration?", "DeleteBedMeshProfile": "Delete Bed Mesh Profile", "DoYouReallyWantToDelete": "Do you really want to delete the profile \"{name}\"?", "RemoveSaveDescription": "The bed_mesh profile has been registered as deleted. Click on SAVE_CONFIG to remove it from the printer.cfg and restart Klipper.", diff --git a/src/pages/Heightmap.vue b/src/pages/Heightmap.vue index 97c794e25..9685dcbe5 100644 --- a/src/pages/Heightmap.vue +++ b/src/pages/Heightmap.vue @@ -58,7 +58,7 @@ :loading="loadings.includes('bedMeshCalibrate')" :disabled="printerIsPrinting" :title="$t('Heightmap.TitleCalibrate')" - @click="calibrateDialog = true"> + @click="openCalibrateMesh"> {{ $t('Heightmap.Calibrate') }} @@ -317,23 +317,32 @@ - + -

{{ $t('Heightmap.DoYouReallyWantToCalibrate') }}

+
- {{ $t('Heightmap.Abort') }} + {{ $t('Heightmap.Abort') }} {{ $t('Heightmap.Calibrate') }}
@@ -435,13 +444,20 @@ export default class PageHeightmap extends Mixins(BaseMixin, ControlMixin) { // eslint-disable-next-line heightmap: any inputDialogRenameHeightmapName: HTMLInputElement + inputFieldCalibrateBedMeshName: HTMLInputElement } private renameDialog = false private removeDialogProfile = '' private removeDialog = false private saveConfigDialog = false - private calibrateDialog = false + private calibrateDialog: { + boolShow: boolean + name: string + } = { + boolShow: false, + name: 'default', + } private newName = '' private oldName = '' @@ -1064,10 +1080,20 @@ export default class PageHeightmap extends Mixins(BaseMixin, ControlMixin) { this.$socket.emit('printer.gcode.script', { script: 'BED_MESH_CLEAR' }, { loading: 'bedMeshClear' }) } + openCalibrateMesh() { + this.calibrateDialog.name = 'default' + this.calibrateDialog.boolShow = true + + setTimeout(() => { + this.$refs.inputFieldCalibrateBedMeshName?.focus() + }, 200) + } + calibrateMesh(): void { - this.calibrateDialog = false - this.$store.dispatch('server/addEvent', { message: 'BED_MESH_CALIBRATE', type: 'command' }) - this.$socket.emit('printer.gcode.script', { script: 'BED_MESH_CALIBRATE' }, { loading: 'bedMeshCalibrate' }) + this.calibrateDialog.boolShow = false + const gcode = 'BED_MESH_CALIBRATE PROFILE="' + this.calibrateDialog.name + '"' + this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' }) + this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'bedMeshCalibrate' }) } saveConfig() {