Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Stefan Dej committed 2021-10-27 22:53:13 +02:00
commit 86d75bce77
44 files changed
+1791 -248

No files matched your search

+1
View File
@@ -2,3 +2,4 @@ name,short_note,author,repo
Dracula,,steadyjaw,dracula-mainsail-theme
Cyberpunk,,Dario-Ciceri,cp2077-mainsail-theme
Mainsail x Voron Toolhead,Various toolhead images inside the theme folder can be renamed to 'sidebar-background.png',eriroh,Mainsail-x-Voron-Toolhead-Theme
Rat Rig (unofficial), includes various sidebar images which can be renamed to ‘sidebar-background.png’,Raabi91,ratrig-mainsail-theme
1 name short_note author repo
2 Dracula steadyjaw dracula-mainsail-theme
3 Cyberpunk Dario-Ciceri cp2077-mainsail-theme
4 Mainsail x Voron Toolhead Various toolhead images inside the theme folder can be renamed to 'sidebar-background.png' eriroh Mainsail-x-Voron-Toolhead-Theme
5 Rat Rig (unofficial) includes various sidebar images which can be renamed to ‘sidebar-background.png’ Raabi91 ratrig-mainsail-theme
+13
View File
@@ -0,0 +1,13 @@
---
layout: default
title: FAQ
nav_order: 110
has_children: true
permalink: /faq/
has_toc: false
---
# Frequently Askes Questions
We are still gathering some "frequently asked questions" and will publish them here soon.
The primary reason why this section already exists, is because of the Klipper warnings in the subcategory, that needed to be fixed fast.
@@ -0,0 +1,95 @@
---
layout: default
title: Deprecated Options
parent: Klipper Warnings
grand_parent: FAQ
nav_order: 20
has_children: false
permalink: /faq/klipper_warnings/deprecated_option
has_toc: false
---
# Deprecated Options
###### default_parameter
## Removal of `default_parameter_` for gcode macros.
In the past, default parameters for gcode macros were defined like so:
```yaml
[gcode_macro PRINT_START]
default_parameter_EXTRUDER: 230
gcode:
...
```
This would define a macro called `PRINT_START` that can be called with an `EXTRUDER` parameter like so: `PRINT_START EXTRUDER=200`. If no value is passed for `EXTRUDER` the default value of 230 is used. This style of default parameters has been deprecated. Instead, define your macro like so:
{% raw %}
```yaml
[gcode_macro PRINT_START]
gcode:
{% set EXTRUDER_TEMP = params.EXTRUDER|default(10)|int %}
```
{% endraw %}
Take note of the following important aspects:
- Parameters passed to gcode macros are stored in the `params` object. So if your macro is called with `VALUE=50`, `params.VALUE` will contain the value 50. After the deprecation, only the `params` object will contain these values.
- Make sure to name your "set variable" something else as the name of the variable in the `params` object (see how I used `EXTRUDER_TEMP` for the "set variable" and `EXTRUDER` for the actual macro parameter above) to avoid confusion and possible parsing errors.
- If you want to pass a default, add `|default(<default value>)` to the end of the params variable (see above, where my default value is 10).
- To ensure that `EXTRUDER_TEMP` will have an integer value, add `|int` to the end of the command, to turn passed parameters (if they exist) and the default into an integer. Depending on what kind of parameter you're passing, there are `|int` `|float` `|bool` or `|string` converters available. Make sure that you convert to int if you want to compare the values in your gcode macro.
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
{: .info}
###### step_distance
## Removal of `step_distance`
`step_distance` describes the distance covered by a certain axis with 1 stepper (micro-)step. The downside of this parameter (and one of the reasons for its removal, is that if one were to change the microstepping of a stepper, the step_distance changes as well. Klipper therefore removed the `step_distance` parameter in favor of `rotation_distance` and `full_steps_per_rotation`. These two parameters are unaffected by microstepping, and can be easily determined by inspecting the used hardware.
Perform the following steps to convert your config:
- comment out the old `step_distance` parameter
- add three new parameters:
- `full_steps_per_rotation` this is 400 for 0.9 degree stepper motors and 200 for 1.8 degree stepper motors.
- `rotation_distance` this can be determined either according to hardware, or by converting the old `step_distance` using math.
- `gear_ratio` can additionally be used to describe an axis that uses a reduction gear (like the Voron-2 Z axis)
- The easiest way to obtain the correct values for `rotation_distance` and `gear_ratio` is to check the official Voron printer github repositories. All example configs have been updated to include the correct values for the new parameters. Keep in mind that you'll still have to calibrate your extruder steps/mm if you choose to copy the values for the extruder. Instructions on how to convert and recalibrate the extruder values can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#extruder).
- The formulas to convert `step_distance` to `rotation distance` can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#obtaining-rotation_distance-from-steps_per_mm-or-step_distance)
- Guidance on how to inspect your hardware to determine your conversion distance can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#obtaining-rotation_distance-by-inspecting-the-hardware). Make sure to also consider any reduction gearing, if applicable, by checking [this section](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#using-a-gear_ratio) as well.
- For every stepper, except your extruder, you should end up with even numbers (e.g. 40 instead of 39.9683).
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
{: .info}
###### pin_map
## Removal of `pin_map`
For Voron printers, this is only relevant if you're running an arduino based controller board and use pins named similar to `ar19` etc. These pin declarations are no longer valid and need to be replaced with their hardware pin identifiers. To find the appropriate hardware pin identifier perform a google image search for your board plus `pinout`. E.g.:
`arduino mega 2560 pinout`
which will yield images such as this one:
![image](https://user-images.githubusercontent.com/4352664/138724260-5813281d-d62d-4b0c-87ee-1f64d301c15f.png)
There, find the pin you're trying to replace. The old pin maps use the digital number of the pin. For example, if your old pin was `ar10`, looking at the image you will find that the `D10` pin corresponds to `PB4`. Replace all pins in your config accordingly, and finally remove the `pin_map:` configuration parameter from your `mcu` section.
Alternatively, you can copy an appropriate `[board_pins]` block from [this location](https://github.com/Klipper3d/klipper/blob/master/config/sample-aliases.cfg) to your config. If you're using multiple arduinos, make sure to add the appropriate mcu to each block like so:
```yaml
[board_pins arduino-mega]
mcu: mcu
```
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
{: .info}
###### pid_integral_max
## Removal of `pid_integral_max`
Remove any instances of `pid_integral_max` from your config.
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
{: .info}
@@ -0,0 +1,21 @@
---
layout: default
title: Deprecated Values
parent: Klipper Warnings
grand_parent: FAQ
nav_order: 10
has_children: false
permalink: /faq/klipper_warnings/deprecated_value
has_toc: false
---
# Deprecated Values
###### rpi_temperature
## Removal of `rpi_temperature` sensor alias.
Replace `sensor_type: rpi_temperature` by `sensor_type: temperature_host` everywhere in your config.
The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot!
[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}.
{: .info}
+9
View File
@@ -0,0 +1,9 @@
---
layout: default
title: Klipper Warnings
parent: FAQ
nav_order: 10
has_children: true
permalink: /faq/klipper_warnings
has_toc: false
---
+75 -10
View File
@@ -27,6 +27,7 @@
"object-assign-deep": "^0.4.0",
"sass-loader": "^10.2.0",
"semver": "^7.3.5",
"uuid": "^8.3.2",
"vue": "^2.6.14",
"vue-class-component": "^7.2.6",
"vue-context": "^6.0.0",
@@ -47,6 +48,7 @@
"devDependencies": {
"@mdi/font": "^6.2.95",
"@types/semver": "^7.3.8",
"@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.29.3",
"@vue/cli-plugin-babel": "^4.5.13",
@@ -2238,6 +2240,12 @@
"node": ">=0.10.0"
}
},
"node_modules/@types/uuid": {
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz",
"integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==",
"dev": true
},
"node_modules/@types/webpack": {
"version": "4.41.29",
"resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.29.tgz",
@@ -15133,6 +15141,16 @@
"node": ">= 6"
}
},
"node_modules/request/node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"devOptional": true,
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@@ -16149,6 +16167,16 @@
"ms": "^2.1.1"
}
},
"node_modules/sockjs/node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"dev": true,
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/sort-keys": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",
@@ -18037,13 +18065,11 @@
}
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"devOptional": true,
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "bin/uuid"
"uuid": "dist/bin/uuid"
}
},
"node_modules/v8-compile-cache": {
@@ -19471,6 +19497,16 @@
"node": ">= 6"
}
},
"node_modules/webpack-log/node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"dev": true,
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/webpack-merge": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz",
@@ -22045,6 +22081,12 @@
}
}
},
"@types/uuid": {
"version": "8.3.1",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz",
"integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==",
"dev": true
},
"@types/webpack": {
"version": "4.41.29",
"resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.29.tgz",
@@ -32185,6 +32227,14 @@
"tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"devOptional": true
}
}
},
"require-directory": {
@@ -32988,6 +33038,14 @@
"faye-websocket": "^0.11.3",
"uuid": "^3.4.0",
"websocket-driver": "^0.7.4"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"sockjs-client": {
@@ -34522,10 +34580,9 @@
"dev": true
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"devOptional": true
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
},
"v8-compile-cache": {
"version": "2.3.0",
@@ -35677,6 +35734,14 @@
"requires": {
"ansi-colors": "^3.0.0",
"uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
}
},
"webpack-merge": {
+3
View File
@@ -22,6 +22,7 @@
"@codemirror/state": "^0.19.1",
"@codemirror/stream-parser": "^0.19.1",
"@codemirror/view": "^0.19.1",
"@codemirror/search": "^0.19.2",
"@sindarius/gcodeviewer": "^2.1.13",
"axios": "^0.21.1",
"core-js": "^3.16.0",
@@ -33,6 +34,7 @@
"object-assign-deep": "^0.4.0",
"sass-loader": "^10.2.0",
"semver": "^7.3.5",
"uuid": "^8.3.2",
"vue": "^2.6.14",
"vue-class-component": "^7.2.6",
"vue-context": "^6.0.0",
@@ -53,6 +55,7 @@
"devDependencies": {
"@mdi/font": "^6.2.95",
"@types/semver": "^7.3.8",
"@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.29.3",
"@vue/cli-plugin-babel": "^4.5.13",
Binary file not shown.
+8
View File
@@ -45,4 +45,12 @@
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(/fonts/roboto-black.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin */
@font-face {
font-family: 'Roboto Mono';
font-style: normal;
font-weight: 400;
src: local('Roboto Mono'), local('Roboto-Mono'), url(/fonts/robotoMono-regular.woff) format('woff');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
+74 -3
View File
@@ -6,19 +6,19 @@
<template>
<div>
<v-dialog v-model="show"
<v-dialog persistent v-model="show"
fullscreen
hide-overlay
:transition="false"
@close="close"
@keydown.esc="close"
@keydown.esc="escClose"
>
<v-card>
<v-toolbar dark color="primary">
<v-btn icon dark @click="close">
<v-icon>mdi-close</v-icon>
</v-btn>
<v-toolbar-title>{{ filepath ? filepath.slice(1)+"/" : "" }}{{ filename }}</v-toolbar-title>
<v-toolbar-title>{{ filepath ? filepath.slice(1)+"/" : "" }}{{ filename }} {{changed}}</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items>
<v-btn dark text href="https://www.klipper3d.org/Config_Reference.html" v-if="restartServiceName === 'klipper'" target="_blank" class="d-none d-md-flex"><v-icon small class="mr-1">mdi-help</v-icon>{{ $t('Editor.ConfigReference') }}</v-btn>
@@ -57,6 +57,48 @@
</v-btn>
</template>
</v-snackbar>
<v-dialog v-model="dialogConfirmChange" persistent :width="600">
<v-card dark>
<v-toolbar flat dense color="primary">
<v-toolbar-title>
<span class="subheading">
<v-icon class="mdi mdi-help-circle" left></v-icon> {{ $t('Editor.UnsavedChanges') }}
</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn small class="minwidth-0" @click="dialogConfirmChange = false"><v-icon small>mdi-close-thick</v-icon></v-btn>
</v-toolbar>
<v-card-text class="pt-3">
<v-container class="pb-0">
<v-row>
<v-col>
<p class="body-1 mb-2">{{ $t('Editor.UnsavedChangesMessage', {filename: filename}) }}</p>
<p class="body-2">{{ $t('Editor.UnsavedChangesSubMessage') }}</p>
</v-col>
</v-row>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn @click="dialogConfirmChange = false">
{{ $t('Editor.Cancel') }}
</v-btn>
<v-btn @click="discardChanges">
{{ $t('Editor.DontSave') }}
</v-btn>
<template v-if="restartServiceName != null">
<v-btn @click="save(restartServiceName)">
{{ $t('Editor.SaveRestart') }}
</v-btn>
</template>
<v-btn color="primary" @click="save">
{{ $t('Editor.SaveClose') }}
</v-btn>
</v-card-actions>
</v-container>
</v-card-text>
</v-card>
</v-dialog>
</div>
</template>
@@ -65,16 +107,23 @@ import {Component, Mixins} from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import {formatFilesize} from '@/plugins/helpers'
import Codemirror from '@/components/inputs/Codemirror.vue'
@Component({
components: {Codemirror}
})
export default class TheEditor extends Mixins(BaseMixin) {
private dialogConfirmChange = false
formatFilesize = formatFilesize
refs!: {
editor: any
}
get changed() {
return this.$store.state.editor.changed ? '*' : ''
}
get show() {
return this.$store.state.editor.bool ?? false
}
@@ -146,11 +195,33 @@ export default class TheEditor extends Mixins(BaseMixin) {
this.$store.dispatch('editor/cancelLoad')
}
escClose() {
if (this.$store.state.gui.editor.escToClose)
this.close()
}
close() {
if (this.$store.state.gui.editor.confirmUnsavedChanges)
this.promptUnsavedChanges()
else
this.$store.dispatch('editor/close')
}
discardChanges() {
this.dialogConfirmChange = false
this.$store.dispatch('editor/close')
}
promptUnsavedChanges() {
if (!this.$store.state.editor.changed)
this.$store.dispatch('editor/close')
else
this.dialogConfirmChange = true
}
save(restartServiceName: string | null = null) {
this.dialogConfirmChange = false
this.$store.dispatch('editor/saveFile', {
content: this.sourcecode,
restartServiceName: restartServiceName
+14 -2
View File
@@ -35,7 +35,7 @@
</v-col>
<v-col :class="isMobile ? '' : 'pl-0'">
<perfect-scrollbar :class="'settings-tabs '+(isMobile ? '' : 'height500')" ref="settingsScroll">
<component :is="'settings-'+activeTab+'-tab'"></component>
<component :is="'settings-'+activeTab+'-tab'" @scrollToTop="scrollToTop"></component>
</perfect-scrollbar>
</v-col>
</v-row>
@@ -59,6 +59,8 @@ import SettingsRemotePrintersTab from '@/components/settings/SettingsRemotePrint
import SettingsThemeTab from '@/components/settings/SettingsThemeTab.vue'
import SettingsDashboardTab from '@/components/settings/SettingsDashboardTab.vue'
import SettingsGCodeViewerTab from '@/components/settings/SettingsGCodeViewerTab.vue'
import SettingsEditorTab from '@/components/settings/SettingsEditorTab.vue'
import Panel from '@/components/ui/Panel.vue'
@Component({
components: {
@@ -72,7 +74,8 @@ import Panel from '@/components/ui/Panel.vue'
SettingsWebcamTab,
SettingsGeneralTab,
SettingsDashboardTab,
SettingsGCodeViewerTab
SettingsGCodeViewerTab,
SettingsEditorTab
}
})
export default class TheSettingsMenu extends Mixins(BaseMixin) {
@@ -134,12 +137,21 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
icon: 'mdi-video-3d',
name: 'g-code-viewer',
title: this.$t('Settings.GCodeViewerTab.GCodeViewer')
},
{
icon: 'mdi-file-document-edit-outline',
name: 'editor',
title: this.$t('Settings.EditorTab.Editor')
}
]
}
@Watch('activeTab')
activeTabWatch() {
this.scrollToTop()
}
scrollToTop() {
if (this.$refs.settingsScroll) this.$refs.settingsScroll.$el.scrollTop = 0
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<style scoped lang="scss">
.consoleTableRow {
font-family: monospace;
font-family: 'Roboto Mono', monospace;
&+.consoleTableRow .col {
border-top: 1px solid rgba(255, 255, 255, 0.12);
+144
View File
@@ -0,0 +1,144 @@
<style scoped>
.btnMacroMenu {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.macroWithParameters {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
</style>
<template>
<v-item-group class="d-inline-block">
<v-btn
small
:color="color"
:class="paramArray.length ? 'macroWithParameters' : ''"
:loading="loadings.includes('macro_'+macro.name)"
@click="doSendMacro(macro.name)">
{{ macro.name.replace(/_/g, " ") }}
</v-btn>
<template v-if="paramArray.length">
<v-menu offset-y :close-on-content-click="false">
<template v-slot:activator="{ on, attrs }">
<v-btn
small
:color="color"
v-bind="attrs"
v-on="on"
class="minwidth-0 px-1 btnMacroMenu"
>
<v-icon>mdi-menu-down</v-icon>
</v-btn>
</template>
<v-card max-width="200">
<v-card-text class="py-2">
<v-row v-for="(name, key) in paramArray" :key="'param_'+key" class="my-2">
<v-col class="py-0">
<v-text-field
:label="name"
v-model="params[name].value"
hide-details
outlined
dense
>
<template v-slot:append>
<v-btn
v-if="params[name].value !== params[name].default"
@click="params[name].value = params[name].default"
icon
small>
<v-icon>mdi-refresh</v-icon>
</v-btn>
</template>
</v-text-field>
</v-col>
</v-row>
<v-row class="my-2">
<v-col class="py-0">
<v-btn color="primary" class="text-uppercase" block @click="sendWithParams">
{{ $t('Panels.MacrosPanel.Send') }}
</v-btn>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-menu>
</template>
</v-item-group>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import {Mixins, Prop, Watch} from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import {GuiStateMacrogroupMacros} from '@/store/gui/types'
interface param {
type: 'int' | 'double' | 'string' | null,
default: string | null
value: string | null
}
interface params {
[key: string]: param
}
@Component
export default class MacroButton extends Mixins(BaseMixin) {
private paramArray: string[] = []
private params: params = {}
@Prop({ required: true }) readonly macro!: GuiStateMacrogroupMacros
@Prop({ default: 'primary' }) readonly color!: string
get klipperMacro() {
return this.$store.getters['printer/getMacro'](this.macro.name)
}
@Watch('klipperMacro')
klipperMacroChange() {
this.refreshParams()
}
refreshParams() {
this.paramArray.splice(0, this.paramArray.length)
this.params = {}
if (this.klipperMacro.params !== null) {
Object.keys(this.klipperMacro.params).forEach((name: string) => {
if (!name.startsWith('_')) {
this.paramArray.push(name)
this.params[name] = {
type: this.klipperMacro.params[name].type,
default: this.klipperMacro.params[name].default,
value: this.klipperMacro.params[name].default
}
}
})
}
}
doSendMacro(gcode: string) {
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'macro_'+gcode })
}
sendWithParams() {
let params: string[] = []
this.paramArray.forEach((paramname: string) => {
if (this.params[paramname].value !== null && this.params[paramname].value !== '')
params.push(paramname+'='+this.params[paramname].value)
})
const gcode = this.macro.name + ' ' +params.join(' ')
this.doSendMacro(gcode)
}
mounted(){
this.refreshParams()
}
}
</script>
@@ -99,8 +99,6 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
}
increment() {
window.console.log(this.value)
this.value = this.value < 1.0 ? Math.round((this.value + 0.01) * 100) / 100 : 1.0
if (this.value < this.off_below) this.value = this.off_below
this.sendCmd()
+87
View File
@@ -0,0 +1,87 @@
import Component from 'vue-class-component'
import BaseMixin from '@/components/mixins/base'
import {allDashboardPanels} from '@/store/variables'
import {GuiStateMacrogroup} from '@/store/gui/types'
import {capitalize} from '@/plugins/helpers'
@Component
export default class DashboardMixin extends BaseMixin {
get macroMode() {
return this.$store.state.gui.dashboard.macroManagement ?? 'simple'
}
get macrogroups() {
return this.$store.state.gui.dashboard.macrogroups ?? []
}
get missingPanelsMobile() {
const panels = [
...this.$store.state.gui.dashboard.mobileLayout,
]
return this.checkMissingPanels(panels)
}
get missingPanelsTablet() {
const panels = [
...this.$store.state.gui.dashboard.tabletLayout1,
...this.$store.state.gui.dashboard.tabletLayout2,
]
return this.checkMissingPanels(panels)
}
get missingPanelsDesktop() {
const panels = [
...this.$store.state.gui.dashboard.desktopLayout1,
...this.$store.state.gui.dashboard.desktopLayout2,
]
return this.checkMissingPanels(panels)
}
get missingPanelsWidescreen() {
const panels = [
...this.$store.state.gui.dashboard.widescreenLayout1,
...this.$store.state.gui.dashboard.widescreenLayout2,
...this.$store.state.gui.dashboard.widescreenLayout3,
]
return this.checkMissingPanels(panels)
}
checkMissingPanels(panels: any[]) {
let allPanels = [...allDashboardPanels]
const missingPanels: any[] = []
if (this.macroMode === 'expert') {
this.macrogroups.forEach((group: GuiStateMacrogroup) => {
allPanels.push('macrogroup_'+group.id)
})
allPanels = allPanels.filter((name) => name !== 'macros')
}
allPanels.forEach((panelname) => {
if (!panels.find((panel) => panel.name === panelname))
missingPanels.push({
name: panelname,
visable: true
})
})
return missingPanels
}
getPanelName(name: string) {
if (name.startsWith('macrogroup_')) {
const groupId = name.split('_')[1] ?? ''
const group = this.macrogroups.find((group: GuiStateMacrogroup) => group.id === groupId)
return (group) ? group.name : 'Macrogroup'
}
return this.$t('Panels.'+capitalize(name)+'Panel.Headline')
}
}
@@ -79,7 +79,6 @@ export default class EndstopPanel extends Mixins(BaseMixin) {
syncEndstops() {
this.$socket.emit('printer.query_endstops.status', { }, { action: 'printer/getEndstopStatus', loading: 'queryEndstops' })
if (this.existProbe) {
window.console.log('exist probe')
this.$store.dispatch('server/addEvent', { message: 'QUERY_PROBE', type: 'command' })
this.$socket.emit('printer.gcode.script', { script: 'QUERY_PROBE' })
}
@@ -475,8 +475,6 @@ export default class UpdatePanel extends Mixins(BaseMixin) {
}
this.commitsOverlay.bool = true
window.console.log(this.commitsOverlay.groupedCommits)
}
}
+75
View File
@@ -0,0 +1,75 @@
<style lang="scss" scoped>
</style>
<template>
<panel
v-if="klipperReadyForGui && macros.length > 0 && macrogroupStatus"
icon="mdi-code-tags"
:title="macrogroup.name"
:collapsible="true"
:card-class="'macrogroup_'+panelId+'_panel'"
>
<v-card-text class="py-2">
<v-row>
<v-col class="text-center">
<macro-button v-for="(macro, index) in macros"
:key="'macroparam_'+index"
:macro="macro"
:color="getColor(macro)"
class="mx-1 my-1"
/>
</v-col>
</v-row>
</v-card-text>
</panel>
</template>
<script lang="ts">
import {Component, Mixins, Prop} from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import Panel from '@/components/ui/Panel.vue'
import {GuiStateMacrogroupMacros} from '@/store/gui/types'
import MacroButton from '@/components/inputs/MacroButton.vue'
@Component({
components: {MacroButton, Panel}
})
export default class MacrogroupPanel extends Mixins(BaseMixin) {
@Prop({ required: true }) panelId!: string
get macrogroup() {
return this.$store.getters['gui/getMacroGroup'](this.panelId)
}
get macros() {
let macros = this.macrogroup?.macros ?? []
macros = macros.filter((macro: GuiStateMacrogroupMacros) => {
return (
(macro.showInStandby && ['standby', 'complete', 'error'].includes(this.printer_state)) ||
(macro.showInPause && this.printer_state === 'paused') ||
(macro.showInPrinting && this.printer_state === 'printing')
)
})
return macros.sort((a: GuiStateMacrogroupMacros, b: GuiStateMacrogroupMacros) => a.pos - b.pos)
}
get macrogroupStatus() {
return (
(this.macrogroup.showInStandby && ['standby', 'complete', 'error'].includes(this.printer_state)) ||
(this.macrogroup.showInPause && this.printer_state === 'paused') ||
(this.macrogroup.showInPrinting && this.printer_state === 'printing')
)
}
getColor(macro: GuiStateMacrogroupMacros) {
if (macro.color === 'group') {
if (this.macrogroup.color === 'custom') return this.macrogroup.colorCustom
else return this.macrogroup.color
}
return macro.color
}
}
</script>
+8 -18
View File
@@ -1,7 +1,3 @@
<style lang="scss" scoped>
</style>
<template>
<panel
v-if="klipperReadyForGui && macros.length > 0"
@@ -13,13 +9,12 @@
<v-container>
<v-row no-gutters v-if="macros.length">
<v-col class="text-center mr-fix-2 mb-fix-2">
<v-btn v-for="(macro, index) in macros"
:key="index+99"
small
color="primary"
class="mr-2 mb-2"
:loading="loadings.includes('macro_'+macro.name)"
@click="doSendMacro(macro.name)">{{ macro.name.replace(/_/g, " ") }}</v-btn>
<macro-button v-for="(macro, index) in macros"
:key="'macro_'+index"
:macro="macro"
color="primary"
class="mx-1 my-1"
/>
</v-col>
</v-row>
</v-container>
@@ -30,18 +25,13 @@
import {Component, Mixins} from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import Panel from '@/components/ui/Panel.vue'
import MacroButton from '@/components/inputs/MacroButton.vue'
@Component({
components: {Panel}
components: {MacroButton, Panel}
})
export default class MacrosPanel extends Mixins(BaseMixin) {
get macros() {
return this.$store.getters['printer/getMacros']
}
doSendMacro(gcode: string) {
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'macro_'+gcode })
}
}
</script>
+1 -1
View File
@@ -5,7 +5,7 @@
}
.gcode-command-field {
font-family: monospace;
font-family: 'Roboto Mono', monospace;
}
</style>
@@ -150,7 +150,6 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) {
@Debounce(500)
updateConsoleHeight(newVal: number) {
window.console.log('updateConsoleHeight', newVal)
this.consoleHeight = newVal
}
@@ -13,30 +13,34 @@
<v-card class="mx-auto" max-width="300" tile >
<v-list dense>
<v-list-item>
<v-list-item-icon>
<v-icon>mdi-information</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.StatusPanel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon color="grey lighten-1">mdi-lock</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon>mdi-information</v-icon>
</v-col>
<v-col>
{{ $t('Panels.StatusPanel.Headline') }}
</v-col>
<v-col class="col-auto">
<v-icon color="grey lighten-1">mdi-lock</v-icon>
</v-col>
</v-row>
</v-list-item>
<draggable v-model="desktopLayout1" :handle="isMobile ? '.handle' : ''" class="v-list-item-group" ghost-class="ghost" group="desktopViewport">
<template v-for="(element) in desktopLayout1">
<v-list-item :key="'item-desktop-'+element.name" link>
<v-list-item-icon>
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.'+capitalize(element.name)+'Panel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-col>
<v-col class="pr-0">
{{ getPanelName(element.name) }}
</v-col>
<v-col class="col-auto pl-0">
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
</v-col>
</v-row>
</v-list-item>
</template>
</draggable>
@@ -49,17 +53,19 @@
<draggable v-model="desktopLayout2" :handle="isMobile ? '.handle' : ''" class="v-list-item-group" ghost-class="ghost" group="desktopViewport">
<template v-for="(element) in desktopLayout2">
<v-list-item :key="'item-desktop-'+element.name" link>
<v-list-item-icon>
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.'+capitalize(element.name)+'Panel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-col>
<v-col class="pr-0">
{{ getPanelName(element.name) }}
</v-col>
<v-col class="col-auto pl-0">
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
</v-col>
</v-row>
</v-list-item>
</template>
</draggable>
@@ -79,21 +85,24 @@
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import draggable from 'vuedraggable'
import {capitalize, convertPanelnameToIcon} from '@/plugins/helpers'
import DashboardMixin from '@/components/mixins/dashboard'
@Component( {
components: {
draggable
}
}
)
export default class SettingsDashboardTabDesktop extends Mixins(BaseMixin) {
export default class SettingsDashboardTabDesktop extends Mixins(DashboardMixin) {
capitalize = capitalize
convertPanelnameToIcon = convertPanelnameToIcon
get desktopLayout1() {
return this.$store.state.gui?.dashboard?.desktopLayout1?.filter((element: any) => element !== null) ?? []
let panels = this.$store.getters['gui/getPanels']('desktopLayout1')
panels = panels.concat(this.missingPanelsDesktop)
return panels
}
set desktopLayout1(newVal) {
@@ -103,7 +112,7 @@ export default class SettingsDashboardTabDesktop extends Mixins(BaseMixin) {
}
get desktopLayout2() {
return this.$store.state.gui?.dashboard?.desktopLayout2?.filter((element: any) => element !== null) ?? []
return this.$store.getters['gui/getPanels']('desktopLayout2')
}
set desktopLayout2(newVal) {
@@ -13,32 +13,34 @@
<v-card class="mx-auto" max-width="300" tile >
<v-list dense>
<v-list-item>
<v-list-item-icon>
<v-icon>mdi-information</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.StatusPanel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon color="grey lighten-1">mdi-lock</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon>mdi-information</v-icon>
</v-col>
<v-col>
{{ $t('Panels.StatusPanel.Headline') }}
</v-col>
<v-col class="col-auto">
<v-icon color="grey lighten-1">mdi-lock</v-icon>
</v-col>
</v-row>
</v-list-item>
<draggable v-model="mobileLayout" :handle="isMobile ? '.handle' : ''" class="v-list-item-group" ghost-class="ghost" group="mobileViewport">
<template v-for="(element) in mobileLayout">
<v-list-item :key="'item-mobile-'+element.name" link>
<v-list-item-icon>
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>
{{ $t('Panels.'+capitalize(element.name)+'Panel.Headline') }}
</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon v-if="!element.visable" color="grey lighten-1" @click="changeState(element.name, true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click="changeState(element.name, false)">mdi-checkbox-marked</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-col>
<v-col class="pr-0">
{{ getPanelName(element.name) }}
</v-col>
<v-col class="col-auto pl-0">
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState(element.name,false)">mdi-checkbox-marked</v-icon>
</v-col>
</v-row>
</v-list-item>
</template>
</draggable>
@@ -58,7 +60,7 @@
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import DashboardMixin from '@/components/mixins/dashboard'
import draggable from 'vuedraggable'
import {capitalize, convertPanelnameToIcon} from '@/plugins/helpers'
@Component( {
@@ -67,12 +69,15 @@ import {capitalize, convertPanelnameToIcon} from '@/plugins/helpers'
}
}
)
export default class SettingsDashboardTabMobile extends Mixins(BaseMixin) {
export default class SettingsDashboardTabMobile extends Mixins(DashboardMixin) {
capitalize = capitalize
convertPanelnameToIcon = convertPanelnameToIcon
get mobileLayout() {
return this.$store.state.gui?.dashboard?.mobileLayout?.filter((element: any) => element !== null) ?? []
let panels = this.$store.getters['gui/getPanels']('mobileLayout')
panels = panels.concat(this.missingPanelsMobile)
return panels
}
set mobileLayout(newVal) {
@@ -13,30 +13,34 @@
<v-card class="mx-auto" max-width="300" tile >
<v-list dense>
<v-list-item>
<v-list-item-icon>
<v-icon>mdi-information</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.StatusPanel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon color="grey lighten-1">mdi-lock</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon>mdi-information</v-icon>
</v-col>
<v-col>
{{ $t('Panels.StatusPanel.Headline') }}
</v-col>
<v-col class="col-auto">
<v-icon color="grey lighten-1">mdi-lock</v-icon>
</v-col>
</v-row>
</v-list-item>
<draggable v-model="tabletLayout1" :handle="isMobile ? '.handle' : ''" class="v-list-item-group" ghost-class="ghost" group="tabletViewport">
<template v-for="(element) in tabletLayout1">
<v-list-item :key="'item-tablet-'+element.name" link>
<v-list-item-icon>
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.'+capitalize(element.name)+'Panel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-col>
<v-col class="pr-0">
{{ getPanelName(element.name) }}
</v-col>
<v-col class="col-auto pl-0">
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
</v-col>
</v-row>
</v-list-item>
</template>
</draggable>
@@ -49,17 +53,19 @@
<draggable v-model="tabletLayout2" :handle="isMobile ? '.handle' : ''" class="v-list-item-group" ghost-class="ghost" group="tabletViewport">
<template v-for="(element) in tabletLayout2">
<v-list-item :key="'item-tablet-'+element.name" link>
<v-list-item-icon>
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.'+capitalize(element.name)+'Panel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-col>
<v-col class="pr-0">
{{ getPanelName(element.name) }}
</v-col>
<v-col class="col-auto pl-0">
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
</v-col>
</v-row>
</v-list-item>
</template>
</draggable>
@@ -79,7 +85,7 @@
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import DashboardMixin from '@/components/mixins/dashboard'
import draggable from 'vuedraggable'
import {capitalize, convertPanelnameToIcon} from '@/plugins/helpers'
@Component( {
@@ -88,12 +94,15 @@ import {capitalize, convertPanelnameToIcon} from '@/plugins/helpers'
}
}
)
export default class SettingsDashboardTabTablet extends Mixins(BaseMixin) {
export default class SettingsDashboardTabTablet extends Mixins(DashboardMixin) {
capitalize = capitalize
convertPanelnameToIcon = convertPanelnameToIcon
get tabletLayout1() {
return this.$store.state.gui?.dashboard?.tabletLayout1?.filter((element: any) => element !== null) ?? []
let panels = this.$store.getters['gui/getPanels']('tabletLayout1')
panels = panels.concat(this.missingPanelsTablet)
return panels
}
set tabletLayout1(newVal) {
@@ -103,7 +112,7 @@ export default class SettingsDashboardTabTablet extends Mixins(BaseMixin) {
}
get tabletLayout2() {
return this.$store.state.gui?.dashboard?.tabletLayout2?.filter((element: any) => element !== null) ?? []
return this.$store.getters['gui/getPanels']('tabletLayout2')
}
set tabletLayout2(newVal) {
@@ -13,30 +13,34 @@
<v-card class="mx-auto" max-width="300" tile >
<v-list dense>
<v-list-item>
<v-list-item-icon>
<v-icon>mdi-information</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.StatusPanel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon color="grey lighten-1">mdi-lock</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon>mdi-information</v-icon>
</v-col>
<v-col>
{{ $t('Panels.StatusPanel.Headline') }}
</v-col>
<v-col class="col-auto">
<v-icon color="grey lighten-1">mdi-lock</v-icon>
</v-col>
</v-row>
</v-list-item>
<draggable v-model="widescreenLayout1" :handle="isMobile ? '.handle' : ''" class="v-list-item-group" ghost-class="ghost" group="widescreenViewport">
<template v-for="(element) in widescreenLayout1">
<v-list-item :key="'item-widescreen-'+element.name" link>
<v-list-item-icon>
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.'+capitalize(element.name)+'Panel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-col>
<v-col class="pr-0">
{{ getPanelName(element.name) }}
</v-col>
<v-col class="col-auto pl-0">
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
</v-col>
</v-row>
</v-list-item>
</template>
</draggable>
@@ -49,17 +53,19 @@
<draggable v-model="widescreenLayout2" :handle="isMobile ? '.handle' : ''" class="v-list-item-group" ghost-class="ghost" group="widescreenViewport">
<template v-for="(element) in widescreenLayout2">
<v-list-item :key="'item-widescreen-'+element.name" link>
<v-list-item-icon>
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.'+capitalize(element.name)+'Panel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-col>
<v-col class="pr-0">
{{ getPanelName(element.name) }}
</v-col>
<v-col class="col-auto pl-0">
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
</v-col>
</v-row>
</v-list-item>
</template>
</draggable>
@@ -72,17 +78,19 @@
<draggable v-model="widescreenLayout3" :handle="isMobile ? '.handle' : ''" class="v-list-item-group" ghost-class="ghost" group="widescreenViewport">
<template v-for="(element) in widescreenLayout3">
<v-list-item :key="'item-widescreen-'+element.name" link>
<v-list-item-icon>
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ $t('Panels.'+capitalize(element.name)+'Panel.Headline') }}</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState3(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState3(element.name,false)">mdi-checkbox-marked</v-icon>
</v-list-item-action>
<v-row>
<v-col class="col-auto pr-0">
<v-icon v-if="isMobile" class="handle">mdi-arrow-up-down</v-icon>
<v-icon v-else v-text="convertPanelnameToIcon(element.name)"></v-icon>
</v-col>
<v-col class="pr-0">
{{ getPanelName(element.name) }}
</v-col>
<v-col class="col-auto pl-0">
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState3(element.name,true)">mdi-checkbox-blank-outline</v-icon>
<v-icon v-else color="primary" @click.stop="changeState3(element.name,false)">mdi-checkbox-marked</v-icon>
</v-col>
</v-row>
</v-list-item>
</template>
</draggable>
@@ -102,21 +110,24 @@
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import draggable from 'vuedraggable'
import {capitalize, convertPanelnameToIcon} from '@/plugins/helpers'
import DashboardMixin from '@/components/mixins/dashboard'
@Component( {
components: {
draggable
}
}
)
export default class SettingsDashboardTabWidescreen extends Mixins(BaseMixin) {
export default class SettingsDashboardTabWidescreen extends Mixins(DashboardMixin) {
capitalize = capitalize
convertPanelnameToIcon = convertPanelnameToIcon
get widescreenLayout1() {
return this.$store.state.gui?.dashboard?.widescreenLayout1?.filter((element: any) => element !== null) ?? []
let panels = this.$store.getters['gui/getPanels']('widescreenLayout1')
panels = panels.concat(this.missingPanelsWidescreen)
return panels
}
set widescreenLayout1(newVal) {
@@ -126,7 +137,7 @@ export default class SettingsDashboardTabWidescreen extends Mixins(BaseMixin) {
}
get widescreenLayout2() {
return this.$store.state.gui?.dashboard?.widescreenLayout2?.filter((element: any) => element !== null) ?? []
return this.$store.getters['gui/getPanels']('widescreenLayout2')
}
set widescreenLayout2(newVal) {
@@ -136,7 +147,7 @@ export default class SettingsDashboardTabWidescreen extends Mixins(BaseMixin) {
}
get widescreenLayout3() {
return this.$store.state.gui?.dashboard?.widescreenLayout3?.filter((element: any) => element !== null) ?? []
return this.$store.getters['gui/getPanels']('widescreenLayout3')
}
set widescreenLayout3(newVal) {
@@ -0,0 +1,45 @@
<template>
<div>
<v-card flat>
<v-card-text>
<settings-row :title="$t('Settings.EditorTab.UseEscToClose')" :sub-title="$t('Settings.EditorTab.UseEscToCloseDescription')" :dynamicSlotWidth="true">
<v-switch v-model="escToClose" hide-details class="mt-0"></v-switch>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.EditorTab.ConfirmUnsavedChanges')" :sub-title="$t('Settings.EditorTab.ConfirmUnsavedChangesDescription')" :dynamicSlotWidth="true">
<v-switch v-model="confirmUnsavedChanges" hide-details class="mt-0"></v-switch>
</settings-row>
<v-divider class="my-2"></v-divider>
</v-card-text>
</v-card>
</div>
</template>
<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
@Component({
components: {SettingsRow}
})
export default class SettingsEditorTab extends Mixins(BaseMixin) {
get escToClose() {
return this.$store.state.gui.editor.escToClose
}
set escToClose(newVal) {
this.$store.dispatch('gui/saveSetting', {name: 'editor.escToClose', value: newVal })
}
get confirmUnsavedChanges() {
return this.$store.state.gui.editor.confirmUnsavedChanges
}
set confirmUnsavedChanges(newVal) {
this.$store.dispatch('gui/saveSetting', {name: 'editor.confirmUnsavedChanges', value: newVal })
}
}
</script>
+36 -31
View File
@@ -1,23 +1,19 @@
<template>
<v-card flat>
<v-card-text>
<template v-if="macros.length">
<div v-for="(macro, index) in macros" v-bind:key="index">
<v-divider class="my-2" v-if="index"></v-divider>
<settings-row :title="macro.name" :sub-title="macro.description" :dynamicSlotWidth="true">
<v-switch :input-value="getMacroStatus(macro.name)" @change="changeMacroStatus(macro.name)" hide-details class="mt-0"></v-switch>
</settings-row>
</div>
</template>
<template v-else>
<v-row>
<v-col>
<p class="mb-0 text-center font-italic">{{ $t('Settings.MacrosTab.NOMacros') }}</p>
</v-col>
</v-row>
</template>
<v-card-text v-if="showGeneral">
<h3 class="text-h5 mb-3">{{ $t('Settings.MacrosTab.General') }}</h3>
<settings-row :title="$t('Settings.MacrosTab.Management')">
<v-select v-model="macroManagement" :items="macroManagements" outlined dense hide-details></v-select>
</settings-row>
<v-divider class="my-2"></v-divider>
</v-card-text>
<template v-if="macroManagement === 'expert'">
<settings-macros-tab-expert @update:showGeneral="updateShowGeneral" @scrollToTop="scrollToTop"></settings-macros-tab-expert>
</template>
<template v-else>
<settings-macros-tab-simple></settings-macros-tab-simple>
</template>
</v-card>
</template>
@@ -26,32 +22,41 @@
import {Component, Mixins} from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import SettingsMacrosTabSimple from '@/components/settings/SettingsMacrosTabSimple.vue'
import SettingsMacrosTabExpert from '@/components/settings/SettingsMacrosTabExpert.vue'
@Component({
components: {SettingsRow}
components: {SettingsMacrosTabExpert, SettingsMacrosTabSimple, SettingsRow}
})
export default class SettingsMacrosTab extends Mixins(BaseMixin) {
private showGeneral = true
get macros() {
return this.$store.getters['printer/getAllMacros'] ?? []
get macroManagements() {
return [
{
text: this.$t('Settings.MacrosTab.Simple'),
value: 'simple',
},
{
text: this.$t('Settings.MacrosTab.Expert'),
value: 'expert',
},
]
}
get hiddenMacros() {
return this.$store.state.gui.dashboard.hiddenMacros ?? []
get macroManagement() {
return this.$store.state.gui?.dashboard?.macroManagement ?? 'simple'
}
getMacroStatus(name: string) {
return !this.hiddenMacros.includes(name.toUpperCase())
set macroManagement(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'dashboard.macroManagement', value: newVal })
}
changeMacroStatus(name: string) {
const hiddenMacros = [...this.hiddenMacros]
updateShowGeneral(newVal: boolean) {
this.showGeneral = newVal
}
if (this.hiddenMacros.includes(name.toUpperCase()))
hiddenMacros.splice(hiddenMacros.indexOf(name.toUpperCase()), 1)
else
hiddenMacros.push(name.toUpperCase())
this.$store.dispatch('gui/saveSetting', { name: 'dashboard.hiddenMacros', value: hiddenMacros })
scrollToTop() {
this.$emit('scrollToTop')
}
}
</script>
@@ -0,0 +1,410 @@
<template>
<div>
<template v-if="boolFormEdit === false">
<v-card-text>
<h3 class="text-h5 mb-3">{{ $t('Settings.MacrosTab.Macrogroups') }}</h3>
<template v-if="groups.length">
<div v-for="(group, index) in groups" v-bind:key="index">
<v-divider class="my-2" v-if="index"></v-divider>
<settings-row :title="group.name !== '' ? group.name : '<'+$t('Settings.MacrosTab.UnknownGroup')+'>'" :sub-title="$tc('Settings.MacrosTab.CountMacros', ('macros' in group ? group.macros.length : 0), { count: ('macros' in group ? group.macros.length : 0) })" :dynamicSlotWidth="true">
<v-btn small outlined class="ml-3" @click="editMacrogroup(group)">
<v-icon left small>mdi-pencil</v-icon>{{ $t('Settings.Edit') }}
</v-btn>
<v-btn small outlined @click="deleteMacrogroup(group.id)" class="ml-3 minwidth-0 px-2" color="error">
<v-icon small>mdi-delete</v-icon>
</v-btn>
</settings-row>
</div>
</template>
<template v-else>
<v-row>
<v-col>
<p class="mb-0 text-center font-italic">{{ $t('Settings.MacrosTab.NoGroups') }}</p>
</v-col>
</v-row>
</template>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn text color="primary" @click="addGroup">{{ $t("Settings.MacrosTab.AddGroup")}}</v-btn>
</v-card-actions>
</template>
<template v-else-if="boolFormEdit">
<v-card-text>
<h3 class="text-h5 mb-3">{{ $t('Settings.MacrosTab.EditGroup') }}</h3>
<settings-row :title="$t('Settings.MacrosTab.Name')">
<v-text-field
v-model="editGroup.name"
hide-details="auto"
:rules="[rules.required, rules.groupUnique]"
dense
outlined
@change="updateGroupOptionName"
></v-text-field>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.MacrosTab.Color')">
<v-select v-model="editGroup.color" :items="groupColors" @change="updateGroupOptionColor" outlined dense hide-details></v-select>
</settings-row>
<template v-if="editGroup.color === 'custom'">
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.MacrosTab.CustomColor')">
<v-menu bottom left offset-y :close-on-content-click="false">
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" :color="editGroup.colorCustom" class="minwidth-0 px-5" small></v-btn>
</template>
<v-color-picker
:value="editGroup.colorCustom"
hide-mode-switch
mode="rgba"
@update:color="updateGroupOptionColorCustom"
></v-color-picker>
</v-menu>
</settings-row>
</template>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.MacrosTab.Status')">
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn small outlined v-bind="attrs" v-on="on" @click="updateGroupOptionShowInStandby(!editGroup.showInStandby)" class="ml-3 minwidth-0 px-2" :color="editGroup.showInStandby ? '' : 'secondary'">
<v-icon small>mdi-sleep</v-icon>
</v-btn>
</template>
<span>{{ $t('Settings.MacrosTab.ShowInStateStandby') }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn small outlined v-bind="attrs" v-on="on" @click="updateGroupOptionShowInPause(!editGroup.showInPause)" class="ml-3 minwidth-0 px-2" :color="editGroup.showInPause ? '' : 'secondary'">
<v-icon small>mdi-pause</v-icon>
</v-btn>
</template>
<span>{{ $t('Settings.MacrosTab.ShowInStatePaused') }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn small outlined v-bind="attrs" v-on="on" @click="updateGroupOptionShowInPrinting(!editGroup.showInPrinting)" class="ml-3 minwidth-0 px-2" :color="editGroup.showInPrinting ? '' : 'secondary'">
<v-icon small>mdi-printer-3d-nozzle</v-icon>
</v-btn>
</template>
<span>{{ $t('Settings.MacrosTab.ShowInStatePrinting') }}</span>
</v-tooltip>
</settings-row>
<v-divider class="my-2"></v-divider>
<h3 class="text-h5 mt-6 mb-3">{{ $t('Settings.MacrosTab.GroupMacros') }}</h3>
<template v-if="editGroup.macros && editGroup.macros.length">
<draggable v-model="editGroupMacros" handle=".handle" ghost-class="ghost" group="macros" @change="updateMacroOrder">
<template v-for="(macro, index) in editGroupMacros">
<div v-bind:key="macro.name">
<v-row>
<v-col class="col-auto pr-0 d-flex">
<v-icon class="handle">mdi-arrow-up-down</v-icon>
</v-col>
<v-col>
<settings-row :title="macro.name" :sub-title="getMacroDescription(macro.name)" v-bind:key="'groupMacro_macro_'+index" :dynamicSlotWidth="true">
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn small outlined v-bind="attrs" v-on="on" @click="changeColorMacroFromGroup(macro)" class="ml-3 minwidth-0 px-2" :color="macro.color ">
<v-icon small left>mdi-palette</v-icon> {{ macro.color }}
</v-btn>
</template>
<span>{{ $t('Settings.MacrosTab.ChangeMacroColor') }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn small outlined v-bind="attrs" v-on="on" @click="updateMacroFromGroup(macro, 'showInStandby', !macro.showInStandby)" class="ml-3 minwidth-0 px-2" :color="macro.showInStandby ? '' : 'secondary'">
<v-icon small>mdi-sleep</v-icon>
</v-btn>
</template>
<span>{{ $t('Settings.MacrosTab.ShowInStateStandby') }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn small outlined v-bind="attrs" v-on="on" @click="updateMacroFromGroup(macro, 'showInPause', !macro.showInPause)" class="ml-3 minwidth-0 px-2" :color="macro.showInPause ? '' : 'secondary'">
<v-icon small>mdi-pause</v-icon>
</v-btn>
</template>
<span>{{ $t('Settings.MacrosTab.ShowInStatePaused') }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn small outlined v-bind="attrs" v-on="on" @click="updateMacroFromGroup(macro, 'showInPrinting', !macro.showInPrinting)" class="ml-3 minwidth-0 px-2" :color="macro.showInPrinting ? '' : 'secondary'">
<v-icon small>mdi-printer-3d-nozzle</v-icon>
</v-btn>
</template>
<span>{{ $t('Settings.MacrosTab.ShowInStatePrinting') }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn small outlined v-bind="attrs" v-on="on" @click="removeMacroFromGroup(macro)" class="ml-3 minwidth-0 px-2" color="error">
<v-icon small>mdi-delete</v-icon>
</v-btn>
</template>
<span>{{ $t('Settings.MacrosTab.DeleteMacroFromGroup') }}</span>
</v-tooltip>
</settings-row>
</v-col>
</v-row>
<v-divider class="my-2" ></v-divider>
</div>
</template>
</draggable>
</template>
<template v-else>
<v-row>
<v-col>
<p class="mb-0 text-center font-italic">{{ $t('Settings.MacrosTab.NoMacrosInGroup') }}</p>
</v-col>
</v-row>
</template>
<h3 class="text-h5 mt-6 mb-3">{{ $t('Settings.MacrosTab.AvailableMacros') }}</h3>
<template v-if="availableMacros.length">
<template v-for="(macro, index) in availableMacros">
<v-divider class="my-2" v-if="index" v-bind:key="'availableMacro_deliver_'+index"></v-divider>
<settings-row :title="macro.name" :sub-title="macro.description" v-bind:key="'availableMacro_macro_'+index" :dynamicSlotWidth="true">
<v-btn small outlined class="ml-3" @click="addMacroToGroup(macro)">
<v-icon left small>mdi-plus</v-icon> {{ $t('Settings.MacrosTab.Add') }}
</v-btn>
</settings-row>
</template>
</template>
<template v-else>
<v-row>
<v-col>
<p class="mb-0 text-center font-italic">{{ $t('Settings.MacrosTab.NoAvailableMacros') }}</p>
</v-col>
</v-row>
</template>
</v-card-text>
<v-card-actions class="d-flex justify-end">
<v-btn text @click="cancelEditMacrogroup">{{ $t('Settings.Cancel')}}</v-btn>
</v-card-actions>
</template>
</div>
</template>
<script lang="ts">
import {Component, Mixins, Watch} from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import draggable from 'vuedraggable'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import {GuiStateMacrogroup, GuiStateMacrogroupMacros} from '@/store/gui/types'
import {Debounce} from 'vue-debounce-decorator'
import {PrinterStateMacro} from '@/store/printer/types'
@Component({
components: {SettingsRow, draggable}
})
export default class SettingsMacrosTabExpert extends Mixins(BaseMixin) {
private rules = {
required: (value: string) => value !== '' || 'required',
groupUnique: (value: string) => !this.existsGroupName(value) || 'Name already exists',
}
private boolFormEdit = false
private editGroupId: string | null = ''
get groupColors() {
return [
{
text: this.$t('Settings.MacrosTab.Primary'),
value: 'primary',
},
{
text: this.$t('Settings.MacrosTab.Secondary'),
value: 'secondary',
},
{
text: this.$t('Settings.MacrosTab.Success'),
value: 'success',
},
{
text: this.$t('Settings.MacrosTab.Warning'),
value: 'warning',
},
{
text: this.$t('Settings.MacrosTab.Error'),
value: 'error',
},
{
text: this.$t('Settings.MacrosTab.Custom'),
value: 'custom',
},
]
}
get macroColors() {
const colors = [...this.groupColors]
const indexCustom = colors.findIndex((color) => color.value === 'custom')
if (indexCustom !== -1) colors.splice(indexCustom, 1)
colors.push({
text: this.$t('Settings.MacrosTab.Group'),
value: 'group'
})
return colors
}
get allMacros() {
return this.$store.getters['printer/getAllMacros'] ?? []
}
get availableMacros() {
return this.allMacros.filter((m: GuiStateMacrogroupMacros) => !this.editGroupUsedMacros.includes(m.name))
}
get groups() {
return this.$store.getters['gui/getAllMacroGroups'] ?? []
}
get editGroupUsedMacros() {
return this.editGroup?.macros?.map((m: GuiStateMacrogroupMacros) => m.name) ?? []
}
get editGroup(): GuiStateMacrogroup | null {
return this.$store.getters['gui/getMacroGroup'](this.editGroupId)
}
get editGroupMacros() {
const macros = this.editGroup?.macros ?? []
macros.sort((a, b) => a.pos - b.pos)
return macros
}
set editGroupMacros(newVal) {
}
existsGroupName(name: string) {
return (this.groups.findIndex((group: GuiStateMacrogroup) => group.name === name && group.id != this.editGroupId) >= 0)
}
clearColorObject(color: any): string {
if (typeof color === 'object' && 'hex' in color)
color = color.hex
if (color.length > 7)
color = color.substr(0, 7)
return color
}
updateShowGeneral(newVal: boolean) {
this.$emit('update:showGeneral', newVal )
}
async addGroup() {
this.editGroupId = await this.$store.dispatch('gui/storeMarcogroup', {
name: '',
color: 'primary',
colorCustom: '#fff',
showInStandby: true,
showInPause: true,
showInPrinting: true,
})
this.boolFormEdit = true
}
editMacrogroup(group: GuiStateMacrogroup) {
this.boolFormEdit = true
this.editGroupId = group.id
}
deleteMacrogroup(id: string) {
this.$store.dispatch('gui/destroyMacrogroup', id)
}
addMacroToGroup(macro: PrinterStateMacro) {
this.$store.dispatch('gui/addMacroToMacrogroup', {
group: this.editGroupId,
macro: macro.name
})
}
updateMacroFromGroup(macro: GuiStateMacrogroupMacros, option: string, value: boolean | string | number) {
this.$store.dispatch('gui/updateMacroFromMacrogroup', {
group: this.editGroupId,
macro: macro.name,
option: option,
value: value
})
}
updateMacroOrder(output: any) {
const oldIndex = output.moved.oldIndex ?? 0
const newIndex = output.moved.newIndex ?? 0
const oldPos = this.editGroupMacros[oldIndex].pos
const newPos = this.editGroupMacros[newIndex].pos
this.updateMacroFromGroup(this.editGroupMacros[oldIndex], 'pos', newPos)
this.updateMacroFromGroup(this.editGroupMacros[newIndex], 'pos', oldPos)
}
changeColorMacroFromGroup(macro: GuiStateMacrogroupMacros) {
let index = this.macroColors.findIndex((color) => color.value === macro.color) + 1
const maxIndex = this.macroColors.length - 1
if (index > maxIndex) index = 0
const newColor = this.macroColors[index].value
this.updateMacroFromGroup(macro, 'color', newColor)
}
removeMacroFromGroup(macro: GuiStateMacrogroupMacros) {
this.$store.dispatch('gui/removeMacroFromMacrogroup', {
group: this.editGroupId,
macro: macro.name
})
}
getMacroDescription(macroname: string) {
const macro = this.allMacros.find((m: PrinterStateMacro) => m.name.toLowerCase() === macroname.toLowerCase())
return macro?.description ?? null
}
updateMacrogroupOption(option: string, newVal: boolean | string) {
this.$store.dispatch('gui/updateMacrogroup', {
group: this.editGroupId,
option: option,
value: newVal
})
}
@Debounce(250)
updateGroupOptionName(newVal: string) {
this.updateMacrogroupOption('name', newVal)
}
updateGroupOptionColor(newVal: string) {
this.updateMacrogroupOption('color', newVal)
}
@Debounce(250)
updateGroupOptionColorCustom(newVal: string) {
this.updateMacrogroupOption('colorCustom', this.clearColorObject(newVal))
}
updateGroupOptionShowInStandby(newVal: boolean) {
this.updateMacrogroupOption('showInStandby', newVal)
}
updateGroupOptionShowInPause(newVal: boolean) {
this.updateMacrogroupOption('showInPause', newVal)
}
updateGroupOptionShowInPrinting(newVal: boolean) {
this.updateMacrogroupOption('showInPrinting', newVal)
}
@Watch('boolFormEdit')
updatedBoolFormEdit(newVal: boolean) {
this.updateShowGeneral(!newVal)
}
cancelEditMacrogroup() {
this.boolFormEdit = false
this.$emit('scrollToTop')
}
}
</script>
@@ -0,0 +1,55 @@
<template>
<v-card-text>
<h3 class="text-h5 mt-6 mb-3">{{ $t('Settings.MacrosTab.Macros') }}</h3>
<template v-if="macros.length">
<div v-for="(macro, index) in macros" v-bind:key="index">
<v-divider class="my-2" v-if="index"></v-divider>
<settings-row :title="macro.name" :sub-title="macro.description" :dynamicSlotWidth="true">
<v-switch :input-value="getMacroStatus(macro.name)" @change="changeMacroStatus(macro.name)" hide-details class="mt-0"></v-switch>
</settings-row>
</div>
</template>
<template v-else>
<v-row>
<v-col>
<p class="mb-0 text-center font-italic">{{ $t('Settings.MacrosTab.NOMacros') }}</p>
</v-col>
</v-row>
</template>
</v-card-text>
</template>
<script lang="ts">
import {Component, Mixins} from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
@Component({
components: {SettingsRow}
})
export default class SettingsMacrosTabSimple extends Mixins(BaseMixin) {
get macros() {
return this.$store.getters['printer/getAllMacros'] ?? []
}
get hiddenMacros() {
return this.$store.state.gui.dashboard.hiddenMacros ?? []
}
getMacroStatus(name: string) {
return !this.hiddenMacros.includes(name.toUpperCase())
}
changeMacroStatus(name: string) {
const hiddenMacros = [...this.hiddenMacros]
if (this.hiddenMacros.includes(name.toUpperCase()))
hiddenMacros.splice(hiddenMacros.indexOf(name.toUpperCase()), 1)
else
hiddenMacros.push(name.toUpperCase())
this.$store.dispatch('gui/saveSetting', { name: 'dashboard.hiddenMacros', value: hiddenMacros })
}
}
</script>
+47 -3
View File
@@ -105,7 +105,12 @@
"SaveRestart": "Save & Restart",
"SaveClose": "Save & close",
"SuccessfullySaved": "{filename} successfully saved.",
"FailedSave": "{filename} could not be uploaded!"
"FailedSave": "{filename} could not be uploaded!",
"UnsavedChanges": "Unsaved Changes",
"UnsavedChangesMessage": "Do you want to save your changes made to {filename}?",
"UnsavedChangesSubMessage": "Your changes will be lost if you don't save them. You can disable this message in the editor settings.",
"DontSave": "Don't save",
"Cancel": "Cancel"
},
"Files": {
"GCodeFiles": "G-Code Files",
@@ -266,7 +271,8 @@
"Extrude": "Extrude"
},
"MacrosPanel": {
"Headline": "Macros"
"Headline": "Macros",
"Send": "send"
},
"FarmPrinterPanel": {
"WebcamOff": "Off",
@@ -560,7 +566,38 @@
},
"MacrosTab": {
"Macros": "Macros",
"NOMacros": "No macros found..."
"NOMacros": "No macros found...",
"General": "General",
"Management": "Management",
"Simple": "Simple",
"Expert": "Expert",
"NoGroups": "No group found...",
"Macrogroups": "Groups",
"CreateGroup": "Create Group",
"EditGroup": "Edit Group",
"CountMacros": "no Macros added | {count} Macro | {count} Macros",
"Name": "Name",
"Color": "Color",
"CustomColor": "Custom Color",
"Status": "Status",
"Primary": "primary",
"Secondary": "secondary",
"Success": "success",
"Warning": "warning",
"Error": "error",
"Custom": "custom",
"AddGroup": "add Group",
"GroupMacros": "Group Macros",
"AvailableMacros": "Available Macros",
"Add": "add",
"NoMacrosInGroup": "No macros in this group.",
"NoAvailableMacros": "No available macros.",
"UnknownGroup": "Unknown Group",
"ChangeMacroColor": "Change the color of the button.",
"ShowInStateStandby": "Show/hide if printer is standby.",
"ShowInStatePaused": "Show/hide if printer is paused.",
"ShowInStatePrinting": "Show/hide if printer is printing.",
"DeleteMacroFromGroup": "Delete macro from group."
},
"ControlTab": {
"Control": "Control",
@@ -632,6 +669,13 @@
"ShowAxes": "Show Axes",
"MinFeed" :"Min Feed Rate",
"MaxFeed" : "Max Feed Rate"
},
"EditorTab": {
"Editor": "Editor",
"UseEscToClose": "Use ESC to close editor",
"UseEscToCloseDescription": "Allows the ESC key to close the editor",
"ConfirmUnsavedChanges": "Prompt to save or discard unsaved changes",
"ConfirmUnsavedChangesDescription": "If enabled, the editor requires a confirmation to either save or discard the changes made. If disabled, changes are silently discarded."
}
},
"GCodeViewer":{
+1 -1
View File
@@ -6,7 +6,7 @@
}
.gcode-command-field {
font-family: monospace;
font-family: 'Roboto Mono', monospace;
}
</style>
+56 -18
View File
@@ -4,7 +4,7 @@
<v-col>
<status-panel></status-panel>
<template v-for="component in mobileLayout">
<component v-bind:is="component.name+'-panel'" :key="'dashboard-mobileLayout-'+component.name"></component>
<component v-bind:is="extractPanelName(component.name)" :panel-id="extractPanelId(component.name)" :key="'dashboard-mobileLayout-'+component.name"></component>
</template>
</v-col>
</v-row>
@@ -12,12 +12,12 @@
<v-col class="col-6">
<status-panel></status-panel>
<template v-for="component in tabletLayout1">
<component v-bind:is="component.name+'-panel'" :key="'dashboard-tabletLayout1-'+component.name"></component>
<component v-bind:is="extractPanelName(component.name)" :panel-id="extractPanelId(component.name)" :key="'dashboard-tabletLayout1-'+component.name"></component>
</template>
</v-col>
<v-col class="col-6">
<template v-for="component in tabletLayout2">
<component v-bind:is="component.name+'-panel'" :key="'dashboard-tabletLayout2-'+component.name"></component>
<component v-bind:is="extractPanelName(component.name)" :panel-id="extractPanelId(component.name)" :key="'dashboard-tabletLayout2-'+component.name"></component>
</template>
</v-col>
</v-row>
@@ -25,12 +25,12 @@
<v-col class="col-5">
<status-panel></status-panel>
<template v-for="component in desktopLayout1">
<component v-bind:is="component.name+'-panel'" :key="'dashboard-desktopLayout1-'+component.name"></component>
<component v-bind:is="extractPanelName(component.name)" :panel-id="extractPanelId(component.name)" :key="'dashboard-desktopLayout1-'+component.name"></component>
</template>
</v-col>
<v-col class="col-7">
<template v-for="component in desktopLayout2">
<component v-bind:is="component.name+'-panel'" :key="'dashboard-desktopLayout2-'+component.name"></component>
<component v-bind:is="extractPanelName(component.name)" :panel-id="extractPanelId(component.name)" :key="'dashboard-desktopLayout2-'+component.name"></component>
</template>
</v-col>
</v-row>
@@ -38,17 +38,17 @@
<v-col class="col-3">
<status-panel></status-panel>
<template v-for="component in widescreenLayout1">
<component v-bind:is="component.name+'-panel'" :key="'dashboard-desktopLayout1-'+component.name"></component>
<component v-bind:is="extractPanelName(component.name)" :panel-id="extractPanelId(component.name)" :key="'dashboard-desktopLayout1-'+component.name"></component>
</template>
</v-col>
<v-col class="col-5">
<template v-for="component in widescreenLayout2">
<component v-bind:is="component.name+'-panel'" :key="'dashboard-desktopLayout2-'+component.name"></component>
<component v-bind:is="extractPanelName(component.name)" :panel-id="extractPanelId(component.name)" :key="'dashboard-desktopLayout2-'+component.name"></component>
</template>
</v-col>
<v-col class="col-4">
<template v-for="component in widescreenLayout3">
<component v-bind:is="component.name+'-panel'" :key="'dashboard-desktopLayout3-'+component.name"></component>
<component v-bind:is="extractPanelName(component.name)" :panel-id="extractPanelId(component.name)" :key="'dashboard-desktopLayout3-'+component.name"></component>
</template>
</v-col>
</v-row>
@@ -59,7 +59,6 @@
import Component from 'vue-class-component'
import {Mixins} from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import MinSettingsPanel from '@/components/panels/MinSettingsPanel.vue'
import KlippyStatePanel from '@/components/panels/KlippyStatePanel.vue'
import MoonrakerStatePanel from '@/components/panels/MoonrakerStatePanel.vue'
@@ -69,9 +68,11 @@ import WebcamPanel from '@/components/panels/WebcamPanel.vue'
import ZoffsetPanel from '@/components/panels/ZoffsetPanel.vue'
import ControlPanel from '@/components/panels/ControlPanel.vue'
import MacrosPanel from '@/components/panels/MacrosPanel.vue'
import MacrogroupPanel from '@/components/panels/MacrogroupPanel.vue'
import MiscellaneousPanel from '@/components/panels/MiscellaneousPanel.vue'
import MiniconsolePanel from '@/components/panels/MiniconsolePanel.vue'
import PrintsettingsPanel from '@/components/panels/PrintsettingsPanel.vue'
import DashboardMixin from '@/components/mixins/dashboard'
@Component({
components: {
@@ -80,6 +81,7 @@ import PrintsettingsPanel from '@/components/panels/PrintsettingsPanel.vue'
MiscellaneousPanel,
ControlPanel,
MacrosPanel,
MacrogroupPanel,
ZoffsetPanel,
WebcamPanel,
ToolsPanel,
@@ -89,37 +91,73 @@ import PrintsettingsPanel from '@/components/panels/PrintsettingsPanel.vue'
MinSettingsPanel
}
})
export default class PageDashboard extends Mixins(BaseMixin) {
export default class PageDashboard extends Mixins(DashboardMixin) {
get mobileLayout() {
return this.$store.state.gui.dashboard.mobileLayout.filter((element: any) => element.visable) ?? []
let panels = this.$store.getters['gui/getPanels']('mobileLayout')
panels = panels.concat(this.missingPanelsMobile)
panels = panels.filter((element: any) => element.visable)
return panels
}
get tabletLayout1() {
return this.$store.state.gui.dashboard.tabletLayout1.filter((element: any) => element.visable) ?? []
let panels = this.$store.getters['gui/getPanels']('tabletLayout1')
panels = panels.concat(this.missingPanelsTablet)
panels = panels.filter((element: any) => element.visable)
return panels
}
get tabletLayout2() {
return this.$store.state.gui.dashboard.tabletLayout2.filter((element: any) => element.visable) ?? []
let panels = this.$store.getters['gui/getPanels']('tabletLayout2')
panels = panels.filter((element: any) => element.visable)
return panels
}
get desktopLayout1() {
return this.$store.state.gui.dashboard.desktopLayout1.filter((element: any) => element.visable) ?? []
let panels = this.$store.getters['gui/getPanels']('desktopLayout1')
panels = panels.concat(this.missingPanelsDesktop)
panels = panels.filter((element: any) => element.visable)
return panels
}
get desktopLayout2() {
return this.$store.state.gui.dashboard.desktopLayout2.filter((element: any) => element.visable) ?? []
let panels = this.$store.getters['gui/getPanels']('desktopLayout2')
panels = panels.filter((element: any) => element.visable)
return panels
}
get widescreenLayout1() {
return this.$store.state.gui.dashboard.widescreenLayout1.filter((element: any) => element.visable) ?? []
let panels = this.$store.getters['gui/getPanels']('widescreenLayout1')
panels = panels.concat(this.missingPanelsWidescreen)
panels = panels.filter((element: any) => element.visable)
return panels
}
get widescreenLayout2() {
return this.$store.state.gui.dashboard.widescreenLayout2.filter((element: any) => element.visable) ?? []
let panels = this.$store.getters['gui/getPanels']('widescreenLayout2')
panels = panels.filter((element: any) => element.visable)
return panels
}
get widescreenLayout3() {
return this.$store.state.gui.dashboard.widescreenLayout3.filter((element: any) => element.visable) ?? []
let panels = this.$store.getters['gui/getPanels']('widescreenLayout3')
panels = panels.filter((element: any) => element.visable)
return panels
}
extractPanelName(name: string) {
return name.split('_')[0]+'-panel'
}
extractPanelId(name: string) {
return name.split('_')[1] ?? null
}
}
</script>
+46
View File
@@ -1,5 +1,6 @@
import { ServerStateEvent } from '@/store/server/types'
import {FileStateFile} from '@/store/files/types'
import {PrinterStateMacroParams} from '@/store/printer/types'
export const findDirectory = (folder: FileStateFile[], dirArray: string[]): FileStateFile[] | null => {
if (folder !== undefined && folder !== null && dirArray.length) {
@@ -35,6 +36,8 @@ export const capitalize = (str: string): string => {
}
export const convertPanelnameToIcon = (name: string): string => {
if (name.startsWith('macrogroup_')) return 'mdi-code-tags'
switch (name) {
case 'webcam': return 'mdi-webcam'
case 'zoffset': return 'mdi-arrow-collapse-vertical'
@@ -164,3 +167,46 @@ export function formatTime(date: Date): string {
return hours+':'+minutes+':'+seconds
}
export function getMacroParams(macro: { gcode: string }): PrinterStateMacroParams {
const paramRegex = /{%?.*?params\.([A-Za-z_0-9]+)(?:\|(int|string|double))?(?:\|default\('?(.*?)'?\))?(?:\|(int|string))?.*?%?}/
let params = paramRegex.exec(macro.gcode)
let currentMatch = macro.gcode
let ret: PrinterStateMacroParams = null
while(params) {
if (ret === null) {
ret = {}
}
const name = params[1]
const t: 'int' | 'string' | 'double' | null = (params[2] ?? params[4] ?? null) as 'int' | 'string' | 'double' | null
const def = params[3] ?? null
ret[`${name}`] = {
type: t,
default: def
}
currentMatch = currentMatch.replace(params[0], '')
params = paramRegex.exec(currentMatch)
}
const paramInRegex = /{%?.*?if.*?'([A-Za-z_0-9]+)' (?:not )?in params.*?%?}/
params = paramInRegex.exec(macro.gcode)
currentMatch = macro.gcode
while(params) {
if (ret === null) {
ret = {}
}
const name = params[1]
if (!(`${name}` in ret)) {
ret[`${name}`] = {
type: null,
default: null
}
}
currentMatch = currentMatch.replace(params[0], '')
params = paramInRegex.exec(currentMatch)
}
return ret
}
+3 -1
View File
@@ -20,7 +20,9 @@ export const getDefaultState = (): EditorState => {
total: 0,
speed: '',
},
cancelToken: null
cancelToken: null,
loadedHash: '',
changed: false
}
}
+28
View File
@@ -2,8 +2,10 @@ import { getDefaultState } from './index'
import {MutationTree} from 'vuex'
import {EditorState} from '@/store/editor/types'
import Vue from 'vue'
import { sha256 } from 'js-sha256'
export const mutations: MutationTree<EditorState> = {
reset(state) {
Object.assign(state, getDefaultState())
},
@@ -25,6 +27,13 @@ export const mutations: MutationTree<EditorState> = {
Vue.set(state, 'fileroot', payload.fileroot)
Vue.set(state, 'filepath', payload.filepath)
Vue.set(state, 'sourcecode', payload.file)
// Because the used editor converts all Windows-Style line endings with unix ones on load,
// the hash is computed with the source always having unix-style line endings.
// https://github.com/codemirror/CodeMirror/issues/3395
Vue.set(state, 'loadedHash', sha256(payload.file.replace(/(?:\r\n|\r|\n)/g, '\n')))
Vue.set(state, 'changed', false)
Vue.set(state, 'bool', true)
},
@@ -42,5 +51,24 @@ export const mutations: MutationTree<EditorState> = {
updateSourcecode(state, payload) {
Vue.set(state, 'sourcecode', payload)
// To check if a file has been changed by the user, we need to calculate a hash
// (or otherwise we would need to save the full file in memory twice). Simply listening
// to the changed event is not enough, because if the user types an "a" and then deletes
// the "a" again, the file would still be shown as changed, even though the edited file
// is equal to the stored file.
// I've tested this functionality with huge text files (60MB G-Code) and while calculating
// the hash took 2 seconds per run, the editor itself is pretty laggy even without hash
// calculations. Hash calculations with typical config file sizes (50KB) only take 1 or 2ms
// on my machine, so I guess this is acceptable for most use cases.
if (sha256(payload) != state.loadedHash)
state.changed = true
else
state.changed = false
}
}
+3 -1
View File
@@ -13,5 +13,7 @@ export interface EditorState {
total: number
speed: string
},
cancelToken: any
cancelToken: any,
loadedHash: string,
changed: boolean
}
+82
View File
@@ -3,6 +3,7 @@ import {ActionTree} from 'vuex'
import {GuiState} from '@/store/gui/types'
import {RootState} from '@/store/types'
import { getDefaultState } from './index'
import {v4 as uuid} from 'uuid'
export const actions: ActionTree<GuiState, RootState> = {
reset({ commit }) {
@@ -225,5 +226,86 @@ export const actions: ActionTree<GuiState, RootState> = {
name: 'dashboard.'+name,
value: newVal
})
},
async storeMarcogroup({ commit, dispatch, state }, payload) {
payload.id = uuid()
await commit('storeMacrogroup', payload)
dispatch('updateSettings', {
keyName: 'dashboard.macrogroups',
newVal: state.dashboard.macrogroups
})
return payload.id
},
updateMacrogroup({ commit, dispatch, state }, payload) {
if (payload.group) {
commit('updateMacrogroup', payload)
dispatch('updateSettings', {
keyName: 'dashboard.macrogroups',
newVal: state.dashboard.macrogroups
})
}
},
destroyMacrogroup({ commit, dispatch, state }, payload) {
commit('destroyMacrogroup', payload)
dispatch('updateSettings', {
keyName: 'dashboard.macrogroups',
newVal: state.dashboard.macrogroups
})
const layouts = ['mobileLayout', 'tabletLayout1', 'tabletLayout2', 'desktopLayout1', 'desktopLayout2',
'widescreenLayout1', 'widescreenLayout2', 'widescreenLayout3']
layouts.forEach((layoutname: string) => {
const layoutArray = [...state.dashboard[layoutname]]
const index = layoutArray.findIndex((layoutPos: any) => layoutPos.name === 'macrogroup_'+payload)
if (index !== -1) {
commit('deleteFromDashboardLayout', { layoutname, index })
dispatch('updateSettings', {
keyName: 'dashboard.'+layoutname,
newVal: state.dashboard[layoutname]
})
}
})
},
addMacroToMacrogroup({ commit, dispatch, state }, payload) {
if (payload.group) {
commit('addMacroToMacrogroup', payload)
dispatch('updateSettings', {
keyName: 'dashboard.macrogroups',
newVal: state.dashboard.macrogroups
})
}
},
updateMacroFromMacrogroup({ commit, dispatch, state }, payload) {
if (payload.group) {
commit('updateMacroFromMacrogroup', payload)
dispatch('updateSettings', {
keyName: 'dashboard.macrogroups',
newVal: state.dashboard.macrogroups
})
}
},
removeMacroFromMacrogroup({ commit, dispatch, state }, payload) {
if (payload.group) {
commit('removeMacroFromMacrogroup', payload)
dispatch('updateSettings', {
keyName: 'dashboard.macrogroups',
newVal: state.dashboard.macrogroups
})
}
}
}
+29 -1
View File
@@ -1,6 +1,6 @@
import {caseInsensitiveSort} from '@/plugins/helpers'
import {GetterTree} from 'vuex'
import {GuiState, GuiStateConsoleFilter, GuiStatePreset} from '@/store/gui/types'
import {GuiState, GuiStateConsoleFilter, GuiStateMacrogroup, GuiStatePreset} from '@/store/gui/types'
// eslint-disable-next-line
export const getters: GetterTree<GuiState, any> = {
@@ -106,5 +106,33 @@ export const getters: GetterTree<GuiState, any> = {
getPanelExpand: (state) => (name: string) => {
return !state.dashboard.nonExpandPanels?.includes(name) ?? true
},
getAllMacroGroups: (state) => {
return caseInsensitiveSort(state.dashboard.macrogroups ?? [], 'name')
},
getMacroGroup: (state) => (id: string) => {
return state.dashboard.macrogroups.find((group: GuiStateMacrogroup) => group.id === id)
},
getPanels: (state, getters) => (viewport: string) => {
let panels = state.dashboard[viewport]?.filter((element: any) => element !== null) ?? []
if (state.dashboard.macroManagement === 'simple') panels = panels.filter((element: any) => !element.name.startsWith('macrogroup_'))
else {
panels = panels.filter((element: any) => element.name !== 'macros')
const macrogroups = getters['getAllMacroGroups']
if (macrogroups.length) {
panels = panels.filter((element: any) => {
if (!element.name.startsWith('macrogroup_')) return true
const macrogroupId = element.name.substr(11)
return (macrogroups.findIndex((macrogroup: GuiStateMacrogroup) => macrogroup.id === macrogroupId) !== -1)
})
}
}
return panels
}
}
+6 -2
View File
@@ -24,7 +24,9 @@ export const getDefaultState = (): GuiState => {
dashboard: {
boolTempchart: true,
boolBigThumbnail: true,
macroManagement: 'simple',
hiddenMacros: [],
macrogroups: [],
hiddenTempChart: [],
control: {
style: 'bars',
@@ -165,7 +167,9 @@ export const getDefaultState = (): GuiState => {
}
},
editor: {
minimap: false
minimap: false,
escToClose: true,
confirmUnsavedChanges: true
},
//moonraker DB api dont accept camel case key names
remotePrinters: [],
@@ -192,7 +196,7 @@ export const getDefaultState = (): GuiState => {
voxelWidth: 1,
voxelHeight: 1,
specularLighting: false,
}
},
}
}
+75 -1
View File
@@ -1,7 +1,8 @@
import Vue from 'vue'
import { getDefaultState } from './index'
import {MutationTree} from 'vuex'
import {GuiState} from '@/store/gui/types'
import {GuiState, GuiStateMacrogroup, GuiStateMacrogroupMacros} from '@/store/gui/types'
import { v4 as uuid } from 'uuid'
export const mutations: MutationTree<GuiState> = {
reset(state) {
@@ -162,5 +163,78 @@ export const mutations: MutationTree<GuiState> = {
removeClosePanel(state, payload) {
const index = state.dashboard.nonExpandPanels.indexOf(payload.name)
if (index > -1) state.dashboard.nonExpandPanels.splice(index, 1)
},
storeMacrogroup(state, payload) {
state.dashboard.macrogroups.push(payload)
},
destroyMacrogroup(state, payload) {
const index = state.dashboard.macrogroups.findIndex((group: GuiStateMacrogroup) => group.id === payload)
if (index !== -1) state.dashboard.macrogroups.splice(index, 1)
},
addMacroToMacrogroup(state, payload) {
const index = state.dashboard.macrogroups.findIndex((group: GuiStateMacrogroup) => group.id === payload.group)
if (index !== -1) {
const macros = [...state.dashboard.macrogroups[index]?.macros ?? []]
const newMacro: GuiStateMacrogroupMacros = {
pos: 1,
name: payload.macro,
color: 'group',
showInStandby: true,
showInPrinting: true,
showInPause: true
}
if (macros.length) newMacro.pos = Math.max(...macros.map((m: GuiStateMacrogroupMacros) => m.pos)) + 1
macros.push(newMacro)
Vue.set(state.dashboard.macrogroups[index], 'macros', macros)
}
},
updateMacroFromMacrogroup(state, payload) {
const index = state.dashboard.macrogroups.findIndex((group: GuiStateMacrogroup) => group.id === payload.group)
if (index !== -1) {
const macros = [...state.dashboard.macrogroups[index]?.macros ?? []]
const updateMacroIndex = macros.findIndex((m: GuiStateMacrogroupMacros) => m.name === payload.macro)
if (updateMacroIndex !== -1) {
macros[updateMacroIndex][payload.option] = payload.value
Vue.set(state.dashboard.macrogroups[index], 'macros', macros)
}
}
},
removeMacroFromMacrogroup(state, payload) {
const index = state.dashboard.macrogroups.findIndex((group: GuiStateMacrogroup) => group.id === payload.group)
if (index !== -1) {
const macros = [...state.dashboard.macrogroups[index]?.macros ?? []]
const deletedMacroIndex = macros.findIndex((m: GuiStateMacrogroupMacros) => m.name === payload.macro)
if (deletedMacroIndex !== -1) {
const oldPos = macros[deletedMacroIndex].pos
macros.splice(deletedMacroIndex, 1)
macros.filter((macro: GuiStateMacrogroupMacros) => macro.pos > oldPos).forEach((macro: GuiStateMacrogroupMacros) => {
macro.pos = macro.pos - 1
})
}
Vue.set(state.dashboard.macrogroups[index], 'macros', macros)
}
},
updateMacrogroup(state, payload) {
const index = state.dashboard.macrogroups.findIndex((group: GuiStateMacrogroup) => group.id === payload.group)
if (index !== -1 && payload.option in state.dashboard.macrogroups[index]) {
Vue.set(state.dashboard.macrogroups[index], payload.option, payload.value)
}
},
deleteFromDashboardLayout(state, payload) {
const layoutArray = [...state.dashboard[payload.layoutname]]
layoutArray.splice(payload.index, 1)
Vue.set(state.dashboard, payload.layoutname, layoutArray)
}
}
+20
View File
@@ -38,4 +38,24 @@ export interface GuiStateConsoleFilter {
index?: string
name: string
regex: string
}
export interface GuiStateMacrogroup {
id: string | null
name: string
color: 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'custom'
colorCustom?: string
showInStandby: boolean
showInPrinting: boolean
showInPause: boolean
macros?: GuiStateMacrogroupMacros[]
}
export interface GuiStateMacrogroupMacros {
pos: number
name: string
color: 'group' | 'primary' | 'secondary' | 'success' | 'warning' | 'error'
showInStandby: boolean
showInPrinting: boolean
showInPause: boolean
}
+21 -4
View File
@@ -5,9 +5,9 @@ import {
PrinterStateFan, PrinterStateFilamentSensors,
PrinterStateHeater, PrinterStateTemperatureFan,
PrinterStateMiscellaneous,
PrinterStateSensor, PrinterStateMacro
PrinterStateSensor, PrinterStateMacro,
} from '@/store/printer/types'
import {caseInsensitiveSort, formatFrequency} from '@/plugins/helpers'
import {caseInsensitiveSort, formatFrequency, getMacroParams} from '@/plugins/helpers'
import {RootState} from '@/store/types'
export const getters: GetterTree<PrinterState, RootState> = {
@@ -64,7 +64,8 @@ export const getters: GetterTree<PrinterState, RootState> = {
array.push({
'name': prop.replace('gcode_macro ', ''),
'description': state.configfile.config[prop].description ?? null,
'prop': state.configfile.config[prop]
'prop': state.configfile.config[prop],
'params': getMacroParams(state.configfile.config[prop])
})
}
})
@@ -371,7 +372,8 @@ export const getters: GetterTree<PrinterState, RootState> = {
array.push({
'name': prop.replace('gcode_macro ', ''),
'description': state.configfile.config[prop].description ?? null,
'prop': state.configfile.config[prop]
'prop': state.configfile.config[prop],
'params': getMacroParams(state.configfile.config[prop])
})
}
})
@@ -379,6 +381,21 @@ export const getters: GetterTree<PrinterState, RootState> = {
return caseInsensitiveSort(array, 'name')
},
getMacro: (state) => (name: string) => {
if ('gcode_macro '+name in state.configfile.config) {
const config = state.configfile.config['gcode_macro '+name]
return {
name,
description: config.description ?? null,
prop: config,
params: getMacroParams(config)
}
}
return null
},
getFilamentSensors: state => {
const sensorObjectNames = ['filament_switch_sensor', 'filament_motion_sensor']
const sensors: PrinterStateFilamentSensors[] = []
+11 -1
View File
@@ -129,13 +129,23 @@ export interface PrinterStateBedMesh {
is_active: boolean
}
export interface PrinterStateMacroParam {
type: 'int' | 'double' | 'string' | null,
default: string | null
}
export type PrinterStateMacroParams = {
[key: string]: PrinterStateMacroParam
} | null
export interface PrinterStateMacro {
name: string
description: string | null
prop: {
// eslint-disable-next-line
[key: string]: any
}
},
params: PrinterStateMacroParams
}
export interface PrinterStateKlipperConfig {
+12 -1
View File
@@ -79,4 +79,15 @@ export const allowedMetadata = [
'thumbnails',
]
export const maxEventHistory = 500
export const maxEventHistory = 500
export const allDashboardPanels = [
'control',
'macros',
'miniconsole',
'miscellaneous',
'printsettings',
'tools',
'webcam',
'zoffset',
]