Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add button to hide SAVE_CONFIG button for pending bed_mesh #1255

Merged
merged 5 commits into from
Feb 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/components/TheTopbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
style="display: none"
@change="uploadAndStart" />
<v-btn
v-if="klippyIsConnected && saveConfigPending"
v-if="showSaveConfigButton"
tile
:icon="$vuetify.breakpoint.smAndDown"
:text="$vuetify.breakpoint.mdAndUp"
Expand Down Expand Up @@ -196,6 +196,20 @@ export default class TheTopbar extends Mixins(BaseMixin) {
return this.$store.state.printer.configfile?.save_config_pending ?? false
}

get hideSaveConfigForBedMash() {
return this.$store.state.gui.uiSettings.hideSaveConfigForBedMash ?? false
}

get showSaveConfigButton() {
if (!this.klipperReadyForGui) return false
if (!this.hideSaveConfigForBedMash) return this.saveConfigPending

let pendingKeys = Object.keys(this.$store.state.printer.configfile?.save_config_pending_items ?? {})
pendingKeys = pendingKeys.filter((key: string) => !key.startsWith('bed_mesh '))

return pendingKeys.length > 0
}

get printerName(): string {
if (this.$store.state.gui.general.printername.length) return this.$store.state.gui.general.printername

Expand Down
15 changes: 15 additions & 0 deletions src/components/settings/SettingsUiSettingsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@
outlined
dense />
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row
:title="$t('Settings.UiSettingsTab.HideSaveConfigButtonForBedMesh').toString()"
:sub-title="$t('Settings.UiSettingsTab.HideSaveConfigButtonForBedMeshDescription').toString()"
:dynamic-slot-width="true">
<v-switch v-model="hideSaveConfigForBedMash" hide-details class="mt-0" />
</settings-row>
</v-card-text>
</v-card>
</div>
Expand Down Expand Up @@ -318,6 +325,14 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
return items
}

get hideSaveConfigForBedMash() {
return this.$store.state.gui.uiSettings.hideSaveConfigForBedMash ?? false
}

set hideSaveConfigForBedMash(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.hideSaveConfigForBedMash', value: newVal })
}

clearColorObject(color: any): string {
if (typeof color === 'object' && 'hex' in color) color = color.hex
if (color.length > 7) color = color.substr(0, 7)
Expand Down
2 changes: 2 additions & 0 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,8 @@
"GcodeThumbnails": "G-Code Vorschaubilder",
"GcodeThumbnailsDescription": "Klicke auf die Schaltfläche um zum Leitfaden zu gelangen.",
"Guide": "Leitfaden",
"HideSaveConfigButtonForBedMesh": "SAVE_CONFIG Schaltfläche ausblenden für bed_mesh",
meteyou marked this conversation as resolved.
Show resolved Hide resolved
"HideSaveConfigButtonForBedMeshDescription": "Die SAVE_CONFIG Schaltfläche nicht anzeigen, wenn nur ein bed_mesh ausständig ist in Klipper.",
dw-0 marked this conversation as resolved.
Show resolved Hide resolved
"LockSliders": "Sperre Schieberegler auf Touchscreen Geräten",
"LockSlidersDelay": "Verzögerung der Sperre für Schieberegler",
"LockSlidersDelayDescription": "Schieberegler werden nach einer bestimmten Verzögerung gesperrt. Wenn 0 oder leer, dann sperren Schieberegler nur nach wechseln/neuladen der Seite.",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,8 @@
"GcodeThumbnails": "G-Code thumbnails",
"GcodeThumbnailsDescription": "Click on the button to get to the instructions.",
"Guide": "Guide",
"HideSaveConfigButtonForBedMesh": "Hide SAVE_CONFIG button for bed_mesh",
meteyou marked this conversation as resolved.
Show resolved Hide resolved
"HideSaveConfigButtonForBedMeshDescription": "Don't show the SAVE_CONFIG button, if only a bed_mesh is pending in Klipper.",
meteyou marked this conversation as resolved.
Show resolved Hide resolved
"LockSliders": "Lock sliders on touchscreen devices",
"LockSlidersDelay": "Slider lock delay",
"LockSlidersDelayDescription": "Sliders will lock after a given delay. If set to 0 or left blank, sliders will only lock on page change/reload.",
Expand Down
1 change: 1 addition & 0 deletions src/store/gui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export const getDefaultState = (): GuiState => {
boolWebcamNavi: false,
navigationStyle: 'iconsAndText',
powerDeviceName: null,
hideSaveConfigForBedMash: false,
},
view: {
blockFileUpload: false,
Expand Down
1 change: 1 addition & 0 deletions src/store/gui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export interface GuiState {
boolWebcamNavi: boolean
navigationStyle: 'iconsAndText' | 'iconsOnly'
powerDeviceName: string | null
hideSaveConfigForBedMash: boolean
}
view: {
blockFileUpload: boolean
Expand Down