Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable controls if Klipper not ready #911

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/ui/AppBtnCollapseGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
transition="slide-y-transition"
left
offset-y
:disabled="disabled"
:close-on-content-click="false"
>
<template #activator="{ on, attrs }">
<app-btn
fab
:x-small="size === 'x-small'"
:small="size === 'small'"
:disabled="disabled"
text
color=""
v-bind="attrs"
Expand Down Expand Up @@ -52,6 +54,9 @@ export default class AppBtnCollapseGroup extends Vue {
@Prop({ type: String, default: 'x-small' })
readonly size!: string

@Prop({ type: Boolean, default: false })
readonly disabled!: boolean

get isCollapsed () {
if (this.collapsed) return true
return this.$vuetify.breakpoint.mdAndDown
Expand Down
33 changes: 25 additions & 8 deletions src/components/widgets/filesystem/FileSystemContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,30 @@
no-gutters
>
<v-col>
<v-list
dense
>
<v-list dense>
<v-list-item
v-if="file.type !== 'directory' && rootProperties.accepts.includes('.' + file.extension) && rootProperties.canPrint"
v-if="canPrint"
matmen marked this conversation as resolved.
Show resolved Hide resolved
link
:disabled="!printerReady"
@click="$emit('print', file)"
>
<v-list-item-icon>
<v-icon>$printer</v-icon>
<v-icon :disabled="!printerReady">
$printer
</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $t('app.general.btn.print') }}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="canPreheat"
link
:disabled="!printerReady"
@click="$emit('preheat', file)"
>
<v-list-item-icon>
<v-icon>$fire</v-icon>
<v-icon :disabled="!printerReady">
$fire
</v-icon>
</v-list-item-icon>
<v-list-item-title>{{ $t('app.general.btn.preheat') }}</v-list-item-title>
</v-list-item>
Expand Down Expand Up @@ -80,7 +84,7 @@
<v-list-item-title>{{ $t('app.general.btn.preview_gcode') }}</v-list-item-title>
</v-list-item>
<v-list-item
v-if="file.type !== 'directory' && file.thumbnails?.length"
v-if="'thumbnails' in file && file.thumbnails && file.thumbnails.length"
link
@click="$emit('view-thumbnail', file)"
>
Expand Down Expand Up @@ -156,10 +160,23 @@ export default class FileSystemContextMenu extends Mixins(StateMixin, FilesMixin
return this.$store.getters['files/getRootProperties'](this.root)
}

get canPrint () {
return (
this.file.type !== 'directory' &&
this.rootProperties.accepts.includes('.' + this.file.extension) &&
this.rootProperties.canPrint
)
}

get canPreheat () {
return (
'first_layer_extr_temp' in this.file &&
'first_layer_bed_temp' in this.file &&
'first_layer_bed_temp' in this.file
)
}

get printerReady () {
return (
!this.printerPrinting &&
!this.printerPaused &&
this.klippyReady
Expand Down
9 changes: 6 additions & 3 deletions src/views/Tune.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<template>
<v-row :dense="$vuetify.breakpoint.smAndDown">
<v-row
v-if="klippyReady"
:dense="$vuetify.breakpoint.smAndDown"
>
<v-col
v-if="supportsBedMesh && klippyReady"
v-if="supportsBedMesh"
cols="12"
md="8"
>
Expand All @@ -12,7 +15,7 @@
md="4"
>
<bed-mesh-controls
v-if="supportsBedMesh && klippyReady"
v-if="supportsBedMesh"
class="mb-2 mb-sm-4"
/>
<end-stops-card class="mb-2 mb-sm-4" />
matmen marked this conversation as resolved.
Show resolved Hide resolved
Expand Down