From da157891a44bc6a6b9cdec87e0e8fb2c0f060dba Mon Sep 17 00:00:00 2001 From: sddev0 <23439221+sddev0@users.noreply.github.com> Date: Mon, 7 Aug 2023 23:43:20 +0200 Subject: [PATCH] feat: hide axis controls during print (#1452) Co-authored-by: Sebastian Duerholt --- src/components/panels/ToolheadControlPanel.vue | 12 ++++++++++-- src/components/settings/SettingsControlTab.vue | 14 ++++++++++++++ src/locales/de.json | 1 + src/locales/en.json | 1 + src/store/gui/index.ts | 1 + src/store/gui/types.ts | 1 + 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/components/panels/ToolheadControlPanel.vue b/src/components/panels/ToolheadControlPanel.vue index 46dd5df0..1a2c3a81 100644 --- a/src/components/panels/ToolheadControlPanel.vue +++ b/src/components/panels/ToolheadControlPanel.vue @@ -94,11 +94,11 @@ - + - + @@ -164,5 +164,13 @@ export default class ToolheadControlPanel extends Mixins(BaseMixin, ControlMixin get speedFactor(): number { return this.$store.state.printer?.gcode_move?.speed_factor ?? 1 } + + get isPrinting() { + return ['printing'].includes(this.printer_state) + } + + get axisControlVisible() { + return !(this.isPrinting && (this.$store.state.gui.control.hideDuringPrint ?? false)) + } } diff --git a/src/components/settings/SettingsControlTab.vue b/src/components/settings/SettingsControlTab.vue index 5a1fe4ca..beb938e5 100644 --- a/src/components/settings/SettingsControlTab.vue +++ b/src/components/settings/SettingsControlTab.vue @@ -35,6 +35,12 @@ + + + + @@ -336,6 +342,14 @@ export default class SettingsControlTab extends Mixins(BaseMixin, ControlMixin) this.$store.dispatch('gui/saveSetting', { name: 'control.style', value: newVal }) } + get hideDuringPrint(): Boolean { + return this.$store.state.gui.control.hideDuringPrint ?? false + } + + set hideDuringPrint(newVal) { + this.$store.dispatch('gui/saveSetting', { name: 'control.hideDuringPrint', value: newVal }) + } + get actionOptions() { let actions = [ { diff --git a/src/locales/de.json b/src/locales/de.json index 0b3e89eb..fa6baa6d 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -795,6 +795,7 @@ "Circle": "Kreis", "Control": "Steuerung", "Cross": "Kreuz", + "HideDuringPrint": "Achsensteuerung während des Drucks ausblenden", "EnableXYHoming": "Aktiviere kombiniertes X & Y homing", "EstimatedExtrusionInfo": "Zeige Info zur geschätzten Extrusion", "EstimatedExtrusionInfoDescription": "Anzeigen/ausblenden der Info zur geschätzten Extrusion, basierend auf Extrusionmenge und Extrusionsgeschwindigkeit", diff --git a/src/locales/en.json b/src/locales/en.json index b397aac5..61efe537 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -796,6 +796,7 @@ "Circle": "Circle", "Control": "Control", "Cross": "Cross", + "HideDuringPrint": "Hide axis controls during print", "EnableXYHoming": "Enable combined X & Y axes homing", "EstimatedExtrusionInfo": "Show estimated extrusion info", "EstimatedExtrusionInfoDescription": "Show / Hide info for estimated extrusions based on extrusion amount and feedrate", diff --git a/src/store/gui/index.ts b/src/store/gui/index.ts index 57d07150..7fddd584 100644 --- a/src/store/gui/index.ts +++ b/src/store/gui/index.ts @@ -30,6 +30,7 @@ export const getDefaultState = (): GuiState => { control: { style: 'bars', actionButton: null, + hideDuringPrint: false, enableXYHoming: false, feedrateXY: 100, stepsXY: [100, 10, 1], diff --git a/src/store/gui/types.ts b/src/store/gui/types.ts index b8bbf4dc..46dd84ff 100644 --- a/src/store/gui/types.ts +++ b/src/store/gui/types.ts @@ -20,6 +20,7 @@ export interface GuiState { console?: GuiConsoleState control: { style: 'bars' | 'circle' | 'cross' + hideDuringPrint: boolean actionButton: null | 'm84' | 'qgl' | 'ztilt' enableXYHoming: boolean feedrateXY: number