Skip to content

Commit

Permalink
Merge branch 'mainsail-crew:develop' into hotkey-save
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhill authored Jun 9, 2024
2 parents fc18102 + 6b625ac commit 52d5f78
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/components/panels/Status/PrintstatusPrinting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ export default class StatusPanelPrintstatusPrinting extends Mixins(BaseMixin) {
}
formatDuration(seconds: number) {
let prefix = seconds < 0 ? '-' : ''
const prefix = seconds < 0 ? '-' : ''
let absSeconds = Math.abs(seconds)
let h = Math.floor(absSeconds / 3600)
const h = Math.floor(absSeconds / 3600)
absSeconds %= 3600
let m = ('0' + Math.floor(absSeconds / 60)).slice(-2)
let s = ('0' + (absSeconds % 60).toFixed(0)).slice(-2)
const m = ('0' + Math.floor(absSeconds / 60)).slice(-2)
const s = ('0' + Math.floor(absSeconds % 60)).slice(-2)
return prefix + h + ':' + m + ':' + s
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/webcams/streamers/Mjpegstreamer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,8 @@ export default class Mjpegstreamer extends Mixins(BaseMixin, WebcamMixin) {
padding: 3px 10px;
border-top-left-radius: 5px;
}
html.theme--light .webcamFpsOutput {
background: rgba(255, 255, 255, 0.7);
}
</style>
4 changes: 4 additions & 0 deletions src/components/webcams/streamers/MjpegstreamerAdaptive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,8 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin, WebcamMixin
padding: 3px 10px;
border-top-left-radius: 5px;
}
html.theme--light .webcamFpsOutput {
background: rgba(255, 255, 255, 0.7);
}
</style>
19 changes: 13 additions & 6 deletions src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,31 @@ export const getters: GetterTree<PrinterState, RootState> = {

getMacros: (state) => {
const array: PrinterStateMacro[] = []
const config = state.configfile?.config ?? {}
const settings = state.configfile?.settings ?? null
const printerGcodes = state.gcode?.commands ?? {}

Object.keys(config)
.filter((prop) => prop.toLowerCase().startsWith('gcode_macro'))
const prefix = 'gcode_macro '
const prefixLength = prefix.length

Object.keys(state)
.filter((prop) => prop.toLowerCase().startsWith(prefix))
.forEach((prop) => {
const name = prop.replace('gcode_macro ', '')
const name = prop.slice(prefixLength)
const printerGcode = printerGcodes[name.toUpperCase()] ?? {}

// remove macros with a '_' as first char
if (name.startsWith('_')) return

// remove macros with rename_existing in the config
const propLower = prop.toLowerCase()
const propSettings = settings[propLower]
const propSettings = settings[propLower] ?? {}
if ('rename_existing' in propSettings) return

const variables = state[prop] ?? {}

array.push({
name,
description: settings[propLower].description ?? null,
description: printerGcode?.help ?? null,
prop: propSettings,
params: getMacroParams(propSettings),
variables,
Expand Down

0 comments on commit 52d5f78

Please sign in to comment.