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 option to hide TL gcodes in console #451

Merged
merged 1 commit into from
Dec 5, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions src/components/panels/MiniconsolePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
<v-list-item class="minHeight36">
<v-checkbox class="mt-0" v-model="hideWaitTemperatures" hide-details :label="$t('Panels.MiniconsolePanel.HideTemperatures')"></v-checkbox>
</v-list-item>
<v-list-item class="minHeight36" v-if="moonrakerComponents.includes('timelapse')">
<v-checkbox class="mt-0" v-model="hideTlCommands" hide-details :label="$t('Panels.MiniconsolePanel.HideTimelapse')"></v-checkbox>
</v-list-item>
<v-list-item class="minHeight36" v-for="(filter, index) in customFilters" v-bind:key="index">
<v-checkbox class="mt-0" v-model="filter.bool" @change="toggleFilter(filter)" hide-details :label="filter.name"></v-checkbox>
</v-list-item>
Expand Down Expand Up @@ -143,6 +146,14 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'console.hideWaitTemperatures', value: newVal })
}

get hideTlCommands(): boolean {
return this.$store.state.gui.console.hideTlCommands
}

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

get customFilters(): any[] {
return this.$store.state.gui.console.customFilters
}
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"SendCode": "Send code...",
"Empty": "Empty",
"HideTemperatures": "Hide temperatures",
"HideTimelapse": "Hide Timelapse",
"CommandList": "Command list"
},
"Heightmap": {
Expand Down Expand Up @@ -383,6 +384,7 @@
"Headline": "Console",
"SetupConsole": "Setup Console",
"HideTemperatures": "Hide temperatures",
"HideTimelapse": "Hide Timelapse",
"SendCode": "Send code..."
},
"MinSettingsPanel": {
Expand Down
11 changes: 11 additions & 0 deletions src/pages/Console.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<v-list-item class="minHeight36">
<v-checkbox class="mt-0" v-model="hideWaitTemperatures" hide-details :label="$t('Console.HideTemperatures')"></v-checkbox>
</v-list-item>
<v-list-item class="minHeight36" v-if="moonrakerComponents.includes('timelapse')">
<v-checkbox class="mt-0" v-model="hideTlCommands" hide-details :label="$t('Console.HideTimelapse')"></v-checkbox>
</v-list-item>
<v-list-item class="minHeight36" v-for="(filter, index) in customFilters" v-bind:key="index">
<v-checkbox class="mt-0" v-model="filter.bool" @change="toggleFilter(filter)" hide-details :label="filter.name"></v-checkbox>
</v-list-item>
Expand Down Expand Up @@ -131,6 +134,14 @@ export default class PageConsole extends Mixins(BaseMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'console.hideWaitTemperatures', value: newVal })
}

get hideTlCommands(): boolean {
return this.$store.state.gui.console.hideWaitTemperatures
}

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

get rows(): number {
return this.gcode?.split('\n').length ?? 1
}
Expand Down
7 changes: 7 additions & 0 deletions src/store/gui/consolefilters/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ export const getters: GetterTree<GuiConsolefiltersState, any> = {
if (rootState.gui.console.hideWaitTemperatures)
output.push('^(?:ok\\s+)?(B|C|T\\d*):')

if (rootState.gui.console.hideTlCommands) {
output.push('^_TIMELAPSE_NEW_FRAME')
output.push('^TIMELAPSE_TAKE_FRAME')
output.push('^TIMELAPSE_RENDER')
output.push('^_SET_TIMELAPSE_SETUP')
}

Object.keys(state.consolefilters).forEach((id: string) => {
const filter = state.consolefilters[id]
if (filter.bool) {
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 @@ -127,6 +127,7 @@ export const getDefaultState = (): GuiState => {
},
console: {
hideWaitTemperatures: true,
hideTlCommands: true,
direction: 'table',
entryStyle: 'default',
height: 300
Expand Down