Merge branch 'master' of https://github.com/meteyou/mainsail into LanguageChange

# Conflicts:
#	src/store/gui/index.js
This commit is contained in:
winbin committed 2021-03-16 09:29:02 +08:00
commit 9db7638495
7 files changed
+68 -28

No files matched your search

+12
View File
@@ -28,6 +28,9 @@
<v-list-item class="minheight30" link @click="doServiceRestartMoonraker()">
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>{{ $t("App.Moonraker") }}</v-list-item-title>
</v-list-item>
<v-list-item class="minheight30" v-if="boolWebcam" link @click="doServiceRestartWebcam()">
<v-list-item-title><v-icon class="mr-2" small>mdi-restart</v-icon>Webcam</v-list-item-title>
</v-list-item>
<div v-if="countPowerDevices">
<v-divider class="mt-0"></v-divider>
<v-subheader class="pt-2" style="height: auto;">{{ $t("App.PowerDevices") }}</v-subheader>
@@ -70,6 +73,11 @@ export default {
return this.$store.getters["server/power/count"]
}
},
boolWebcam: {
get() {
return this.$store.state.gui.dashboard.boolWebcam || this.$store.state.gui.webcam.bool
}
}
},
methods: {
changeSwitch(device, value) {
@@ -97,6 +105,10 @@ export default {
this.showMenu = false
this.$socket.sendObj('machine.services.restart', { service: "moonraker" })
},
doServiceRestartWebcam: function() {
this.showMenu = false
this.$socket.sendObj('machine.services.restart', { service: "webcamd" })
},
doHostReboot: function() {
this.showMenu = false
this.$socket.sendObj('machine.reboot', { })
@@ -31,6 +31,21 @@
</v-switch>
</v-col>
</v-row>
<v-row>
<v-col class="py-2">
<v-switch v-model="displayZOffsetStandby" hide-details class="mt-0">
<template v-slot:label>
Display Z-Offset-Panel
<v-tooltip right>
<template v-slot:activator="{ on, attrs }">
<v-icon class="text--secondary ml-2" v-bind="attrs" v-on="on">mdi mdi-information</v-icon>
</template>
<span>Shows the Z-Offset panel permanently.</span>
</v-tooltip>
</template>
</v-switch>
</v-col>
</v-row>
<v-row>
<v-col class="text-center">
<v-btn @click="dialogResetMainsail=true" >{{ $t('Settings.GeneralPanel.FactoryReset') }}</v-btn>
@@ -102,6 +117,14 @@
return this.$store.dispatch('gui/setSettings', { general: { displayCancelPrint: displayCancelPrint } });
}
},
displayZOffsetStandby: {
get() {
return this.$store.state.gui.general.displayZOffsetStandby;
},
set(displayZOffsetStandby) {
return this.$store.dispatch('gui/setSettings', { general: { displayZOffsetStandby: displayZOffsetStandby } });
}
},
},
methods: {
resetMainsail() {
+2 -1
View File
@@ -3,7 +3,7 @@
</style>
<template>
<v-card v-if="(['printing', 'paused'].includes(printer_state))">
<v-card v-if="(['printing', 'paused'].includes(printer_state)) || (displayZOffsetStandby && ['standby', 'complete'].includes(printer_state))">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon class="mdi mdi-arrow-collapse-vertical" left></v-icon>{{ $t("Panels.ZOffsetPanel.ZBabyStepping") }}</span>
@@ -53,6 +53,7 @@
homing_origin: state => state.printer.gcode_move.homing_origin,
printer_state: state => state.printer.print_stats.state,
homed_axis: state => state.printer.toolhead.homed_axes,
displayZOffsetStandby: state => state.gui.general.displayZOffsetStandby,
}),
},
methods: {
+22 -24
View File
@@ -149,14 +149,14 @@
>
<td class="pr-0 text-center" style="width: 32px;">
<v-icon v-if="item.isDirectory">mdi-folder</v-icon>
<v-icon v-if="!item.isDirectory && !(existsSmallThumbnail(item))">mdi-file</v-icon>
<v-tooltip v-if="!item.isDirectory && existsSmallThumbnail(item) && existsBigThumbnail(item)" top>
<v-icon v-if="!item.isDirectory && !(getSmallThumbnail(item))">mdi-file</v-icon>
<v-tooltip v-if="!item.isDirectory && getSmallThumbnail(item) && getBigThumbnail(item)" top>
<template v-slot:activator="{ on, attrs }">
<img :src="'data:image/gif;base64,'+getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
<img :src="getSmallThumbnail(item)" width="32" height="32" v-bind="attrs" v-on="on" />
</template>
<span><img :src="'data:image/gif;base64,'+getBigThumbnail(item)" width="250" /></span>
<span><img :src="getBigThumbnail(item)" width="250" /></span>
</v-tooltip>
<img v-if="!item.isDirectory && existsSmallThumbnail(item) && !existsBigThumbnail(item)" :src="'data:image/gif;base64,'+getSmallThumbnail(item)" width="32" height="32" />
<img v-if="!item.isDirectory && getSmallThumbnail(item) && !getBigThumbnail(item)" :src="getSmallThumbnail(item)" width="32" height="32" />
</td>
<td class=" ">{{ item.filename }}</td>
<td class="text-no-wrap text-right" v-if="headers.filter(header => header.value === 'size')[0].visible">{{ item.isDirectory ? '--' : formatFilesize(item.size) }}</td>
@@ -212,8 +212,8 @@
<v-card>
<v-img
contain
v-if="existsBigThumbnail(dialogPrintFile.item)"
:src="'data:image/gif;base64,'+getBigThumbnail(dialogPrintFile.item)"
v-if="getBigThumbnail(dialogPrintFile.item)"
:src="getBigThumbnail(dialogPrintFile.item)"
></v-img>
<v-card-title class="headline">{{ $t('Files.StartJob') }}</v-card-title>
<v-card-text>{{ $t('Files.DoYouWantToStart') + dialogPrintFile.item.filename }}?</v-card-text>
@@ -421,6 +421,11 @@
get: function() {
return this.$store.getters["files/getDiskUsage"](this.currentPath)
}
},
basicUrl: {
get: function() {
return this.$store.getters["socket/getUrl"]
}
}
},
created() {
@@ -790,43 +795,36 @@
this.$store.dispatch("gui/setGcodefilesMetadata", {name: name, value: value});
}
},
existsSmallThumbnail(item) {
return (
getSmallThumbnail(item) {
if (
'thumbnails' in item &&
item.thumbnails !== undefined &&
item.thumbnails.findIndex(thumb => thumb.width >= 32 && thumb.width <= 64 && thumb.height >= 32 && thumb.height <= 64) !== -1
)
},
getSmallThumbnail(item) {
if (this.existsSmallThumbnail(item)) {
item.thumbnails.length
) {
const thumbnail = item.thumbnails.find(thumb =>
thumb.width >= 32 && thumb.width <= 64 &&
thumb.height >= 32 && thumb.height <= 64
)
if (thumbnail) return thumbnail.data
if (thumbnail && 'relative_path' in thumbnail) return this.basicUrl+"/server/files/"+this.currentPath+"/"+thumbnail.relative_path
}
return ""
},
existsBigThumbnail(item) {
return (
getBigThumbnail(item) {
if (
'thumbnails' in item &&
item.thumbnails !== undefined &&
item.thumbnails.findIndex(thumb => thumb.width >= 300 && thumb.width <= 400) !== -1
)
},
getBigThumbnail(item) {
if (this.existsBigThumbnail(item)) {
item.thumbnails.length) {
const thumbnail = item.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
if (thumbnail) return thumbnail.data
if (thumbnail && 'relative_path' in thumbnail) return this.basicUrl+"/server/files/"+this.currentPath+"/"+thumbnail.relative_path
}
return ""
},
getThumbnailWidth(item) {
if (this.existsBigThumbnail(item)) {
if (this.getBigThumbnail(item)) {
const thumbnail = item.thumbnails.find(thumb => thumb.width >= 300 && thumb.width <= 400)
if (thumbnail) return thumbnail.width
+1 -1
View File
@@ -52,7 +52,7 @@ const routes = [
{
title: "G-Code Files",
path: '/files',
icon: 'printer-3d-nozzle',
icon: 'file-document-multiple-outline',
component: Files,
alwaysShow: false,
},
+6 -1
View File
@@ -31,7 +31,12 @@ export default {
updateSettings({ commit }, payload) {
const keyName = payload.keyName
let newState = payload.newVal
if ('value' in payload && keyName in payload.value && typeof payload.value[keyName] !== "string") {
if (
'value' in payload &&
keyName in payload.value &&
typeof payload.value[keyName] !== "string" &&
!Array.isArray(payload.value[keyName])
) {
newState = objectAssignDeep(payload.value[keyName], newState)
}
+2 -1
View File
@@ -7,7 +7,8 @@ export function getDefaultState() {
general: {
printername: "",
language: "en",
displayCancelPrint: false
displayCancelPrint: false,
displayZOffsetStandby: false,
},
dashboard: {
boolWebcam: false,