Skip to content

Commit

Permalink
Merge branch 'mainsail-crew:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
MG-longshot authored Dec 28, 2024
2 parents 7e00a06 + 976547e commit 540f72f
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 45 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
# Changelog
All notable changes to Mainsail will be documented in this file.

## [2.13.2](https://github.com/mainsail-crew/mainsail/releases/tag/v2.13.2) - 2024-12-25
### Bug Fixes and Improvements

- **Editor**: Fix maximal height of the sidebar ([#2079](https://github.com/mainsail-crew/mainsail/pull/2079))
- **Editor**: Fix docs link for Kalico ([#2080](https://github.com/mainsail-crew/mainsail/pull/2080))
- **Tools**: Use gcode commands instead of config gcode macros ([#2088](https://github.com/mainsail-crew/mainsail/pull/2088))
- **macro-prompts**: Preserve outer quotes ([#2076](https://github.com/mainsail-crew/mainsail/pull/2076))
- Fix print start from dashboard for subdirectory files ([#2074](https://github.com/mainsail-crew/mainsail/pull/2074))
- Hide horizontal scrollbar in StartPrintDialog.vue ([#2075](https://github.com/mainsail-crew/mainsail/pull/2075))
- Fix z_tilt button for z_tilt_ng with Kalico ([#2078](https://github.com/mainsail-crew/mainsail/pull/2078))

### Localization

- **zh**: Update chinese locale ([#2081](https://github.com/mainsail-crew/mainsail/pull/2081))

## [2.13.1](https://github.com/mainsail-crew/mainsail/releases/tag/v2.13.1) - 2024-12-07
### Bug Fixes and Improvements

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mainsail",
"version": "2.13.1",
"version": "2.13.2",
"private": true,
"decription": "a klipper web interface",
"author": {
Expand Down
12 changes: 7 additions & 5 deletions src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ import { Component, Mixins, Ref, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { capitalize, formatFilesize, windowBeforeUnloadFunction } from '@/plugins/helpers'
import Panel from '@/components/ui/Panel.vue'
import { availableKlipperConfigReferenceTranslations } from '@/store/variables'
import { klipperRepos } from '@/store/variables'
import CodemirrorAsync from '@/components/inputs/CodemirrorAsync'
import {
mdiClose,
Expand Down Expand Up @@ -346,13 +346,15 @@ export default class TheEditor extends Mixins(BaseMixin) {
get klipperConfigReference(): string {
const currentLanguage = this.currentLanguage
const translations = availableKlipperConfigReferenceTranslations
let url = 'https://www.klipper3d.org/Config_Reference.html'
const klipperRepo = klipperRepos[this.klipperAppName] ?? klipperRepos.Klipper
if (translations.includes(currentLanguage)) {
url = `https://www.klipper3d.org/${currentLanguage}/Config_Reference.html`
let url = klipperRepo.url
if (klipperRepo.docsLanguages?.includes(currentLanguage)) {
url += `${currentLanguage}/`
}
url += 'Config_Reference.html'
return url
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/dialogs/StartPrintDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template>
<v-dialog v-model="bool" :max-width="400" @click:outside="closeDialog" @keydown.esc="closeDialog">
<v-dialog
v-model="bool"
:max-width="400"
content-class="overflow-x-hidden"
@click:outside="closeDialog"
@keydown.esc="closeDialog">
<v-card>
<div v-if="file.big_thumbnail" class="d-flex align-center justify-center" style="min-height: 200px">
<v-img
Expand Down
4 changes: 4 additions & 0 deletions src/components/mixins/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export default class BaseMixin extends Vue {
return this.socketIsConnected && this.klipperState === 'ready'
}

get klipperAppName() {
return this.$store.state.printer.app_name ?? 'Klipper'
}

get printerIsPrinting() {
return this.klipperReadyForGui && ['printing', 'paused'].includes(this.printer_state)
}
Expand Down
24 changes: 16 additions & 8 deletions src/components/mixins/control.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Vue from 'vue'
import Component from 'vue-class-component'
import { PrinterStateMacro, PrinterStateToolchangeMacro } from '@/store/printer/types'

@Component
export default class ControlMixin extends Vue {
Expand Down Expand Up @@ -55,7 +54,16 @@ export default class ControlMixin extends Vue {
}

get colorZTilt() {
const status = this.$store.state.printer.z_tilt?.applied ?? true
let status = true

// normal Klipper z_tilt
if ('z_tilt' in this.$store.state.printer) {
status = this.$store.state.printer.z_tilt?.applied
}
// check Kalico next gen z_tilt
else if ('z_tilt_ng' in this.$store.state.printer) {
status = this.$store.state.printer.z_tilt_ng?.applied
}

return status ? 'primary' : 'warning'
}
Expand Down Expand Up @@ -101,12 +109,12 @@ export default class ControlMixin extends Vue {
return this.$store.getters['printer/getMacros']
}

get toolchangeMacros(): PrinterStateToolchangeMacro[] {
return this.macros
.filter((macro: PrinterStateMacro) => macro.name.toUpperCase().match(/^T\d+/))
.sort((a: PrinterStateMacro, b: PrinterStateMacro) => {
const numberA = parseInt(a.name.slice(1))
const numberB = parseInt(b.name.slice(1))
get toolchangeMacros(): string[] {
return Object.keys(this.$store.state.printer.gcode?.commands ?? {})
.filter((gcode) => gcode.match(/^T\d+/))
.sort((a: string, b: string) => {
const numberA = parseInt(a.slice(1))
const numberB = parseInt(b.slice(1))

return numberA - numberB
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<v-row v-for="(row, index) in rows" :key="'row_' + index" class="mt-0">
<v-col>
<v-item-group class="_btn-group py-0 px-3">
<extruder-control-panel-tools-item v-for="macro in row" :key="macro.name" :macro="macro" />
<extruder-control-panel-tools-item v-for="macro in row" :key="macro" :name="macro" />
</v-item-group>
</v-col>
</v-row>
Expand Down
31 changes: 19 additions & 12 deletions src/components/panels/Extruder/ExtruderControlPanelToolsItem.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
<template>
<v-btn
:disabled="printerIsPrintingOnly"
dense
class="flex-grow-1 px-0"
:style="buttonStyle"
@click="doSend(macro.name)">
<v-btn :disabled="printerIsPrintingOnly" dense class="flex-grow-1 px-0" :style="buttonStyle" @click="changeTool">
<span v-if="color != null" class="_extruderColorState mr-1" :style="dotStyle" />
{{ macro.name }}
{{ name.toUpperCase() }}
</v-btn>
</template>

<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import { PrinterStateMacro } from '@/store/printer/types'
import BaseMixin from '@/components/mixins/base'
import ControlMixin from '@/components/mixins/control'
import { ServerSpoolmanStateSpool } from '@/store/server/spoolman/types'
Expand All @@ -21,25 +15,34 @@ import { ServerSpoolmanStateSpool } from '@/store/server/spoolman/types'
components: {},
})
export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin) {
@Prop({ type: Object }) macro!: PrinterStateMacro
@Prop({ type: String }) name!: string
get macro() {
const objectName = Object.keys(this.$store.state.printer).find(
(key) => key.toLowerCase() === `gcode_macro ${this.name?.toLowerCase()}`
)
if (!objectName) return undefined
return this.$store.state.printer[objectName] ?? {}
}
get active() {
return this.macro.variables.active ?? false
return this.macro?.active ?? false
}
get color() {
if (this.spool) {
return this.spool.filament?.color_hex ?? '000000'
}
const color = this.macro.variables.color ?? this.macro.variables.colour ?? null
const color = this.macro?.color ?? this.macro?.colour ?? null
if (color === '' || color === 'undefined') return null
return color
}
get spoolId() {
return this.macro.variables.spool_id ?? null
return this.macro?.spool_id ?? null
}
get spool() {
Expand Down Expand Up @@ -90,6 +93,10 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
'background-color': '#' + this.color,
}
}
changeTool() {
this.doSend(this.name.toUpperCase())
}
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,9 @@ export const getters: GetterTree<PrinterState, RootState> = {
},

existsZtilt: (state) => {
if (!state.configfile?.settings) return false
if (!state.gcode) return false

return 'z_tilt' in state.configfile.settings
return 'Z_TILT_ADJUST' in state.gcode.commands
},

existsBedTilt: (state) => {
Expand Down
6 changes: 0 additions & 6 deletions src/store/printer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,6 @@ export interface PrinterStateExtruderStepper {
extruder: number
}

export interface PrinterStateToolchangeMacro {
name: string
active: boolean
color: string
}

export interface PrinterGetterObject {
name: string
type: string
Expand Down
7 changes: 7 additions & 0 deletions src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ export interface Theme {
}
css?: boolean
}

export interface KlipperRepos {
[name: string]: {
url: string
docsLanguages?: string[]
}
}
21 changes: 14 additions & 7 deletions src/store/variables.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Theme } from '@/store/types'
import { KlipperRepos, Theme } from '@/store/types'

export const defaultMode = 'dark'
export const defaultTheme = 'mainsail'
Expand Down Expand Up @@ -129,12 +129,6 @@ export const hiddenRootDirectories = ['gcodes', 'timelapse', 'timelapse_frames']
*/
export const hiddenDirectories = ['.git']

/*
* List of available Klipper config reference translations
* https://www.klipper3d.org/Config_Reference.html
*/
export const availableKlipperConfigReferenceTranslations = ['it', 'hu', 'zh']

/*
* List of all downloadable logfiles
*/
Expand Down Expand Up @@ -205,3 +199,16 @@ export const themes: Theme[] = [
logo: { show: true, light: false },
},
]

/*
* List of all supported Klipper-Repos
*/
export const klipperRepos: KlipperRepos = {
Klipper: {
url: 'https://www.klipper3d.org/',
docsLanguages: ['it', 'hu', 'zh'],
},
Kalico: {
url: 'https://docs.kalico.gg/',
},
}

0 comments on commit 540f72f

Please sign in to comment.