Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored Sep 6, 2024
2 parents 4c7e9d0 + 5cb3080 commit 2fe93e1
Show file tree
Hide file tree
Showing 27 changed files with 510 additions and 405 deletions.
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
"options": {
"tabWidth": 2
}
},
{
"files": "src/locales/*.json",
"options": {
"plugins": ["prettier-plugin-sort-json"],
"jsonRecursiveSort": true,
"jsonSortOrder": "{ \"placeThisFirst\": null, \"/^[a-zA-Z0-9]/\": \"caseInsensitiveNumeric\" }"
}
}
]
}
21 changes: 17 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"eslint-plugin-vue": "^9.0.0",
"postcss": "^8.4.31",
"postcss-nesting": "^12.0.1",
"prettier": "^3.0.0",
"prettier": "^3.3.3",
"prettier-plugin-sort-json": "^4.0.0",
"sass": "~1.32",
"start-server-and-test": "^2.0.5",
"typescript": "^4.5.5",
Expand Down
12 changes: 11 additions & 1 deletion src/components/console/ConsoleTableEntry.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<template>
<v-row :class="entryStyle">
<v-col class="col-auto pr-0 text--disabled console-time">{{ entryFormatTime }}</v-col>
<v-col :class="messageClass" style="min-width: 0" @click.capture="commandClick" v-html="event.formatMessage" />
<v-col
v-if="!rawOutput"
:class="messageClass"
style="min-width: 0"
@click.capture="commandClick"
v-html="event.formatMessage" />
<v-col v-else :class="messageClass" style="min-width: 0" @click.capture="commandClick" v-text="event.message" />
</v-row>
</template>

Expand Down Expand Up @@ -38,6 +44,10 @@ export default class ConsoleTableEntry extends Mixins(BaseMixin) {
return classes
}
get rawOutput() {
return this.$store.state.gui.console.rawOutput ?? false
}
commandClick(event: Event) {
const eventTarget = event.target as Element
if (eventTarget.localName === 'a' && eventTarget.className.indexOf('command') !== -1) {
Expand Down
134 changes: 134 additions & 0 deletions src/components/dialogs/TimelapseRenderingsettingsDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<template>
<v-dialog :value="show" :max-width="700" :max-height="500">
<panel
:title="$t('Timelapse.RenderSettings')"
:icon="mdiTextBoxSearchOutline"
card-class="timelapse-rendersettings-dialog-panel"
:margin-bottom="false">
<template #buttons>
<v-btn icon @click="close">
<v-icon>{{ mdiCloseThick }}</v-icon>
</v-btn>
</template>
<v-card-text class="">
<v-row>
<v-col class="col-4">
<v-select
v-model="variable_fps"
:label="$t('Timelapse.Type')"
:items="framerateTypeOptions"
outlined
dense
hide-details />
</v-col>
<v-col class="col-4">
<template v-if="variable_fps">
<v-text-field
v-model="variable_fps_min"
:label="$t('Timelapse.MinFramerate')"
type="number"
outlined
dense
hide-details
hide-spin-buttons />
<v-text-field
v-model="variable_fps_max"
:label="$t('Timelapse.MaxFramerate')"
type="number"
outlined
dense
hide-details
hide-spin-buttons
class="mt-3" />
<v-text-field
v-model="targetlength"
:label="$t('Timelapse.Targetlength')"
type="number"
outlined
dense
hide-details
hide-spin-buttons
class="mt-3" />
</template>
<v-text-field
v-else
v-model="output_framerate"
:label="$t('Timelapse.Framerate')"
type="number"
outlined
dense
hide-details
hide-spin-buttons />
<v-text-field
v-model="duplicatelastframe"
:label="$t('Timelapse.DuplicateLastframe')"
type="number"
outlined
dense
hide-details
hide-spin-buttons
class="mt-3" />
</v-col>
<v-col class="col-4">
<v-text-field
v-if="variable_fps"
v-model="variableTargetFps"
:label="$t('Timelapse.TargetFps')"
type="number"
outlined
dense
hide-details
readonly
class="mb-3" />
<v-text-field
v-model="estimatedVideoLength"
:label="$t('Timelapse.EstimatedLength')"
outlined
dense
hide-details
readonly />
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text @click="close">{{ $t('Timelapse.Cancel') }}</v-btn>
<v-btn text color="primary" @click="startRender">{{ $t('Timelapse.StartRender') }}</v-btn>
</v-card-actions>
</panel>
</v-dialog>
</template>
<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import Panel from '@/components/ui/Panel.vue'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import BaseMixin from '@/components/mixins/base'
import TimelapseMixin from '@/components/mixins/timelapse'
import { mdiCloseThick, mdiTextBoxSearchOutline } from '@mdi/js'
@Component({
components: { Panel, SettingsRow },
})
export default class TimelapseRenderingsettingsDialog extends Mixins(BaseMixin, TimelapseMixin) {
mdiCloseThick = mdiCloseThick
mdiTextBoxSearchOutline = mdiTextBoxSearchOutline
@Prop({ type: Boolean, default: false }) show!: boolean
get framerateTypeOptions() {
return [
{ value: false, text: this.$t('Timelapse.Fixed') },
{ value: true, text: this.$t('Timelapse.Variable') },
]
}
startRender() {
this.$socket.emit('machine.timelapse.render', {})
this.close()
}
close() {
this.$emit('close')
}
}
</script>
78 changes: 78 additions & 0 deletions src/components/mixins/timelapse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import Component from 'vue-class-component'
import Vue from 'vue'

@Component
export default class TimelapseMixin extends Vue {
get variable_fps() {
return this.$store.state.server.timelapse?.settings?.variable_fps ?? false
}

set variable_fps(newVal) {
this.$store.dispatch('server/timelapse/saveSetting', { variable_fps: newVal })
}

get variable_fps_min() {
return this.$store.state.server.timelapse?.settings?.variable_fps_min ?? 5
}

set variable_fps_min(newVal) {
this.$store.dispatch('server/timelapse/saveSetting', { variable_fps_min: newVal })
}

get variable_fps_max() {
return this.$store.state.server.timelapse?.settings?.variable_fps_max ?? 60
}

set variable_fps_max(newVal) {
this.$store.dispatch('server/timelapse/saveSetting', { variable_fps_max: newVal })
}

get targetlength() {
return this.$store.state.server.timelapse?.settings?.targetlength ?? 10
}

set targetlength(newVal) {
this.$store.dispatch('server/timelapse/saveSetting', { targetlength: newVal })
}

get output_framerate() {
return this.$store.state.server.timelapse?.settings?.output_framerate ?? 30
}

set output_framerate(newVal) {
this.$store.dispatch('server/timelapse/saveSetting', { output_framerate: newVal })
}

get duplicatelastframe() {
return this.$store.state.server.timelapse?.settings?.duplicatelastframe ?? 0
}

set duplicatelastframe(newVal) {
this.$store.dispatch('server/timelapse/saveSetting', { duplicatelastframe: newVal })
}

get framesCount() {
return this.$store.state.server.timelapse?.lastFrame?.count ?? 0
}

get estimatedVideoLength() {
let seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.output_framerate)

if (this.variable_fps) {
seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.variableTargetFps)
if (seconds < this.targetlength) seconds = this.targetlength
}

return seconds > 60
? Math.floor(seconds / 60) + 'm ' + (seconds - Math.floor(seconds / 60) * 60) + 's'
: seconds + 's'
}

get variableTargetFps() {
let targetFps = Math.floor(this.framesCount / this.targetlength)
targetFps = Math.max(targetFps, this.variable_fps_min)
targetFps = Math.min(targetFps, this.variable_fps_max)

return targetFps
}
}
21 changes: 14 additions & 7 deletions src/components/panels/Extruder/ExtruderControlPanelControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<template #activator="{ on }">
<div v-on="on">
<v-btn
:loading="loadings.includes('btnDetract')"
:loading="loadings.includes('btnExtrude')"
:disabled="!extrudePossible || tooLargeExtrusion || printerIsPrintingOnly"
small
class="_btn-extruder-cmd"
Expand Down Expand Up @@ -157,7 +157,7 @@
<template #activator="{ on }">
<div class="pt-1 pb-2 px-3" v-on="on">
<v-btn
:loading="loadings.includes('btnDetract')"
:loading="loadings.includes('btnExtrude')"
:disabled="
!extrudePossible || tooLargeExtrusion || printerIsPrintingOnly
"
Expand Down Expand Up @@ -263,15 +263,22 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ExtruderMixi
}
sendRetract(): void {
const gcode = `M83\nG1 E-${this.feedamount} F${this.feedrate * 60}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnRetract' })
this.sendCommand(this.feedamount * -1, 'btnRetract')
}
sendExtrude(): void {
const gcode = `M83\nG1 E${this.feedamount} F${this.feedrate * 60}`
this.sendCommand(this.feedamount, 'btnExtrude')
}
sendCommand(length: number, loading: string): void {
const gcode =
`SAVE_GCODE_STATE NAME=_ui_extrude\n` +
`M83\n` +
`G1 E${length} F${this.feedrate * 60}\n` +
`RESTORE_GCODE_STATE NAME=_ui_extrude`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnDetract' })
this.$socket.emit('printer.gcode.script', { script: gcode }, { loading })
}
}
</script>
Expand Down
15 changes: 15 additions & 0 deletions src/components/panels/MiniconsolePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
:label="filter.name"
@change="toggleFilter(filter)" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="rawOutput"
class="mt-0"
hide-details
:label="$t('Panels.MiniconsolePanel.RawOutput')" />
</v-list-item>
</v-list>
</v-menu>
</template>
Expand Down Expand Up @@ -204,6 +211,14 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'console.autoscroll', value: newVal })
}
get rawOutput(): boolean {
return this.$store.state.gui.console.rawOutput ?? false
}
set rawOutput(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'console.rawOutput', value: newVal })
}
commandClick(msg: string): void {
this.gcode = msg
Expand Down
4 changes: 2 additions & 2 deletions src/components/panels/Status/ExcludeObjectDialogMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
hoverName === object.name
? primaryColor
: excluded_objects.includes(object.name)
? '#6668'
: '#bbb'
? '#6668'
: '#bbb'
"
@mouseover="showObjectTooltip(object.name)"
@mouseout="hideObjectTooltip"
Expand Down
Loading

0 comments on commit 2fe93e1

Please sign in to comment.