Skip to content

Commit

Permalink
feat: add option to hide TL gcodes in console (#451)
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou authored Dec 5, 2021
1 parent d3ee2f9 commit dd3c897
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
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

0 comments on commit dd3c897

Please sign in to comment.