bugfix: allow .ufp and show thumbnails

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2021-01-27 21:03:44 +01:00
parent a72af00c0a
commit e5469b47ca
2 changed files with 14 additions and 5 deletions

View File

@ -75,7 +75,7 @@
<v-app-bar app elevate-on-scroll>
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-spacer></v-spacer>
<input type="file" ref="fileUploadAndStart" accept=".gcode" style="display: none" @change="uploadAndStart" />
<input type="file" ref="fileUploadAndStart" accept=".gcode, .ufp" style="display: none" @change="uploadAndStart" />
<v-btn color="primary" class="mr-5 d-none d-sm-flex" v-if="isConnected && save_config_pending" :disabled="['printing', 'paused'].includes(printer_state)" :loading="loadings.includes['topbarSaveConfig']" @click="clickSaveConfig">SAVE CONFIG</v-btn>
<v-btn color="primary" class="mr-5 d-none d-sm-flex" v-if="isConnected && ['standby', 'complete'].includes(printer_state)" :loading="loadings.includes['btnUploadAndStart']" @click="btnUploadAndStart"><v-icon class="mr-2">mdi-file-upload</v-icon>Upload & Print</v-btn>
<v-btn color="error" class="button-min-width-auto px-3" v-if="isConnected" :loading="loadings.includes['topbarEmergencyStop']" @click="clickEmergencyStop"><v-icon class="mr-sm-2">mdi-alert-circle-outline</v-icon><span class="d-none d-sm-flex">Emergency Stop</span></v-btn>

View File

@ -53,7 +53,7 @@
<v-card-title>
G-Code Files
<v-spacer class="d-none d-sm-block"></v-spacer>
<input type="file" ref="fileUpload" accept=".gcode" style="display: none" multiple @change="uploadFile" />
<input type="file" ref="fileUpload" accept=".gcode, .ufp" style="display: none" multiple @change="uploadFile" />
<v-item-group class="v-btn-toggle my-5 my-sm-0 col-12 col-sm-auto px-0 py-0" name="controllers">
<v-btn @click="clickUploadButton" title="Upload new Gcode" class="primary flex-grow-1" :loading="loadings.includes('gcodeUpload')"><v-icon>mdi-upload</v-icon></v-btn>
<v-btn @click="createDirectory" title="Create new Directory" class="flex-grow-1"><v-icon>mdi-folder-plus</v-icon></v-btn>
@ -180,7 +180,7 @@
</v-list-item>
</v-list>
</v-menu>
<v-dialog v-model="dialogPrintFile.show" max-width="400">
<v-dialog v-model="dialogPrintFile.show" :max-width="getThumbnailWidth(dialogPrintFile.item)">
<v-card>
<v-img
contain
@ -748,17 +748,26 @@
return (
'thumbnails' in item &&
item.thumbnails !== undefined &&
item.thumbnails.findIndex(thumb => thumb.width === 400) !== -1
item.thumbnails.findIndex(thumb => thumb.width >= 300 && thumb.width <= 400) !== -1
)
},
getBigThumbnail(item) {
if (this.existsBigThumbnail(item)) {
const thumbnail = item.thumbnails.find(thumb => thumb.width === 400)
const thumbnail = item.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
if (thumbnail) return thumbnail.data
}
return ""
},
getThumbnailWidth(item) {
if (this.existsBigThumbnail(item)) {
const thumbnail = item.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
if (thumbnail) return thumbnail.width
}
return 400
}
},
watch: {