From 86276dadc1b742a1b442b833ff05dedf80a73e6a Mon Sep 17 00:00:00 2001 From: Sebastian Duerholt Date: Sat, 1 Jul 2023 12:09:06 +0200 Subject: [PATCH] feat: hide axis controls during print Signed-off-by: Sebastian Duerholt --- src/components/panels/ToolheadControlPanel.vue | 11 ++++++++++- 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(+), 1 deletion(-) diff --git a/src/components/panels/ToolheadControlPanel.vue b/src/components/panels/ToolheadControlPanel.vue index 46dd5df02..0c7017e0c 100644 --- a/src/components/panels/ToolheadControlPanel.vue +++ b/src/components/panels/ToolheadControlPanel.vue @@ -94,9 +94,10 @@ - + + @@ -164,5 +165,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 5a1fe4ca3..beb938e53 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 c1bd8396f..405ad5a66 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -770,6 +770,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 f5ec4852b..6c8a60e27 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -770,6 +770,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 74fa10046..a5b659150 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 d818af047..73cd19e64 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