Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeanon committed Jun 12, 2024
1 parent 75dd642 commit 72657da
Show file tree
Hide file tree
Showing 15 changed files with 171 additions and 115 deletions.
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.11.5",
"version": "2.11.6",
"private": true,
"decription": "a klipper web interface",
"author": {
Expand Down
6 changes: 5 additions & 1 deletion src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
hide-overlay
:transition="false"
@close="close"
@keydown.esc="escClose">
@keydown.esc="escClose"
@keydown.ctrl.shift.s.prevent="restartServiceNameExists && save(restartServiceName)"
@keydown.meta.shift.s.prevent="restartServiceNameExists && save(restartServiceName)"
@keydown.ctrl.s.prevent="save(null)"
@keydown.meta.s.prevent="save(null)">
<panel
card-class="editor-dialog"
:icon="isWriteable ? mdiFileDocumentEditOutline : mdiFileDocumentOutline"
Expand Down
4 changes: 3 additions & 1 deletion src/components/panels/Machine/SystemPanelHost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{{ $t('Machine.SystemPanel.Values.Load', { load: hostStats.load }) }},
</span>
<span v-if="hostStats.memoryFormat" class="d-inline-block text-no-wrap">
{{ $t('Machine.SystemPanel.Values.Memory', { memory: hostStats.memoryFormat }) }},
{{ $t('Machine.SystemPanel.Values.Memory', { memory: hostStats.memoryFormat }) }}
</span>
<span class="text-no-wrap">
<template v-if="hostStats.tempSensor">
Expand All @@ -51,6 +51,7 @@
<v-tooltip top>
<template #activator="{ on, attrs }">
<span v-bind="attrs" v-on="on">
,
{{
$t('Machine.SystemPanel.Values.Temp', {
temp: hostStats.tempSensor.temperature,
Expand All @@ -74,6 +75,7 @@
</v-tooltip>
</template>
<span v-else>
,
{{
$t('Machine.SystemPanel.Values.Temp', {
temp: hostStats.tempSensor.temperature,
Expand Down
57 changes: 36 additions & 21 deletions src/components/panels/Status/PrintstatusThumbnail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
class="d-flex align-end statusPanel-big-thumbnail"
height="200"
:style="thumbnailStyle"
@focus="focusBigThumbnail"
@blur="blurBigThumbnail">
<v-card-title
class="white--text py-2 px-2"
style="background-color: rgba(0, 0, 0, 0.3); backdrop-filter: blur(3px)">
@focus="focus = true"
@blur="focus = false">
<v-card-title class="white--text py-2 px-2 statusPanel-thumbnail-overlay">
<v-row>
<v-col style="width: 100px">
<v-col>
<span class="subtitle-2 text-truncate px-0 text--disabled d-block">
<v-icon small class="mr-2">{{ mdiFileOutline }}</v-icon>
{{ current_filename }}
Expand Down Expand Up @@ -95,6 +93,9 @@ export default class StatusPanelPrintstatusThumbnail extends Mixins(BaseMixin) {
mdiFileOutline = mdiFileOutline
mdiFile = mdiFile
focus = false
thumbnailFactor = 0
declare $refs: {
bigThumbnail: any
}
Expand Down Expand Up @@ -190,34 +191,43 @@ export default class StatusPanelPrintstatusThumbnail extends Mixins(BaseMixin) {
}
get thumbnailStyle() {
let output: { height: string; backgroundColor?: string } = {
height: '200px',
}
if (!this.printstatusThumbnailZoom) {
output.height = '100%'
} else if (this.focus && this.thumbnailBlurHeight > 0) {
output.height = `${this.thumbnailBlurHeight}px`
}
if (defaultBigThumbnailBackground.toLowerCase() !== this.bigThumbnailBackground.toLowerCase()) {
return { backgroundColor: this.bigThumbnailBackground }
output.backgroundColor = this.bigThumbnailBackground
return output
}
return {}
return output
}
focusBigThumbnail() {
if (this.$refs.bigThumbnail) {
const clientWidth = this.$refs.bigThumbnail.$el.clientWidth
const thumbnailWidth = this.thumbnailBigWidth
const factor = clientWidth / thumbnailWidth
get thumbnailBlurHeight() {
if (this.thumbnailFactor === 0) return 0
this.$refs.bigThumbnail.$el.style.height = (this.thumbnailBigHeight * factor).toFixed() + 'px'
}
return (this.thumbnailBigHeight * this.thumbnailFactor).toFixed()
}
blurBigThumbnail() {
if (this.$refs.bigThumbnail) {
this.$refs.bigThumbnail.$el.style.height = '200px'
}
get printstatusThumbnailZoom() {
return this.$store.state.gui.uiSettings.printstatusThumbnailZoom ?? true
}
calcThumbnailFactor() {
const thumbnailClientWidth = this.$refs.bigThumbnail?.$el.clientWidth ?? 0
if (!thumbnailClientWidth || !this.thumbnailBigWidth) this.thumbnailFactor = 0
return (this.thumbnailFactor = thumbnailClientWidth / this.thumbnailBigWidth)
}
@Debounce(200)
handleResize() {
this.$nextTick(() => {
const isFocused = document.activeElement === this.$refs.bigThumbnail?.$el
if (isFocused) this.focusBigThumbnail()
this.calcThumbnailFactor()
})
}
}
Expand All @@ -231,4 +241,9 @@ export default class StatusPanelPrintstatusThumbnail extends Mixins(BaseMixin) {
.statusPanel-printstatus-thumbnail {
position: relative;
}
.statusPanel-thumbnail-overlay {
background-color: rgba(0, 0, 0, 0.3);
backdrop-filter: blur(3px);
}
</style>
24 changes: 17 additions & 7 deletions src/components/panels/Temperature/TemperaturePanelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<tr>
<th class="icon">&nbsp;</th>
<th class="name">{{ $t('Panels.TemperaturePanel.Name') }}</th>
<th v-if="!el.is.mobile && !hidePIDProfiles" class="pid-profile">
{{ $t('Panels.TemperaturePanel.PIDProfile') }}
<th v-if="!el.is.mobile && !hideHeaterProfiles" class="heater-profile">
{{ $t('Panels.TemperaturePanel.HeaterProfile') }}
</th>
<th v-if="!el.is.mobile" class="state">
{{ $t('Panels.TemperaturePanel.State') }}
Expand Down Expand Up @@ -76,6 +76,16 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
.sort(this.sortObjectName)
}
get blockTemperatures() {
return this.available_sensors
.filter((fullName: string) => {
if (!(fullName.toLowerCase() in (this.$store.state.printer?.configfile?.settings ?? {}))) return false
if (!("sensor_type" in (this.$store.state.printer?.configfile?.settings[fullName.toLowerCase()] ?? {}))) return false
return this.$store.state.printer?.configfile?.settings[fullName.toLowerCase()]["sensor_type"] == "block_temperature"
})
.sort(this.sortObjectName)
}
get available_sensors() {
return this.$store.state.printer?.heaters?.available_sensors ?? []
}
Expand Down Expand Up @@ -110,8 +120,8 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
return this.$store.state.gui.view.tempchart.hideMonitors ?? false
}
get hidePIDProfiles(): boolean {
return this.$store.state.gui.view.tempchart.hidePIDProfiles ?? false
get hideHeaterProfiles(): boolean {
return this.$store.state.gui.view.tempchart.hideHeaterProfiles ?? false
}
get temperature_sensors() {
Expand All @@ -130,13 +140,13 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
let name = splits[0]
if (splits.length > 1) name = splits[1]
return !name.startsWith('_')
return !name.startsWith('_') && !this.blockTemperatures.includes(fullName)
})
.sort(this.sortObjectName)
}
get heaterObjects() {
return [...this.filteredHeaters, ...this.temperature_fans]
return [...this.filteredHeaters, ...this.blockTemperatures, ...this.temperature_fans]
}
get settings() {
Expand Down Expand Up @@ -187,7 +197,7 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
text-align: center;
}
.temperature-panel-table ::v-deep .pid-profile {
.temperature-panel-table ::v-deep .heater-profile {
width: 75px;
text-align: right !important;
}
Expand Down
80 changes: 40 additions & 40 deletions src/components/panels/Temperature/TemperaturePanelListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
<td class="name">
<span class="cursor-pointer" @click="showEditDialog = true">{{ formatName }}</span>
</td>
<td v-if="!isResponsiveMobile && !hidePIDProfiles" class="pid-profile">
<form @submit.prevent="setPIDProfile"
<td v-if="!isResponsiveMobile && !hideHeaterProfiles" class="heater-profile">
<form @submit.prevent="setHeaterProfile"
@mouseover="focused = true"
@mouseleave="focused = false">
<v-text-field
v-if="loaded_pid_profile !== null"
class="_pid-profile-input pr-6"
:rules="[rules.pid_profile]"
v-model="pid_profile"
v-if="loaded_heater_profile !== null"
class="_heater-profile-input pr-6"
:rules="[rules.heater_profile]"
v-model="heater_profile"
dense
outlined
hide-details
hide-spin-buttons
@blur="pidProfile = loaded_pid_profile"
@blur="heaterProfile = loaded_heater_profile"
@focus="$event.target.select()">
<template v-if="pid_profile !== 'default' && focused" #append>
<template v-if="heater_profile !== 'default' && focused" #append>
<v-btn
icon
class="_pid-profile-reset"
@click="resetPIDProfile">
class="_heater-profile-reset"
@click="resetHeaterProfile">
<v-icon>{{ mdiRefresh }}</v-icon>
</v-btn>
</template>
Expand Down Expand Up @@ -113,20 +113,20 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
showEditDialog = false
focused = false
pidProfile = this.printerObject.pid_profile ?? null
heaterProfile = this.printerObject.heater_profile ?? null
heater_name = (this.$store.state.printer?.toolhead?.improved_axes_def && this.objectName.startsWith("extruder"))
? "hotend" + this.objectName.replace("extruder", "")
: this.objectName
private rules = {
pid_profile: (value: string) => this.pidProfileAllowed(value) || this.$t('Panels.TemperaturePanel.PIDProfileNotAllowed')
heater_profile: (value: string) => this.heaterProfileAllowed(value) || this.$t('Panels.TemperaturePanel.HeaterProfileNotAllowed')
}
pidProfileAllowed(name: string) {
heaterProfileAllowed(name: string) {
if (name == 'autotune') return true;
const pidProfiles = this.pidProfiles
for (let i = 0; i < pidProfiles.length; i++) {
if (name == pidProfiles[i]) {
const heaterProfiles = this.heaterProfiles
for (let i = 0; i < heaterProfiles.length; i++) {
if (name == heaterProfiles[i]) {
return true
}
}
Expand Down Expand Up @@ -234,34 +234,34 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
return this.printerObject.power ?? this.printerObject.speed ?? null
}
set pid_profile(newval: string) {
this.pidProfile = newval
set heater_profile(newval: string) {
this.heaterProfile = newval
}
get pid_profile(): string {
return this.pidProfile
get heater_profile(): string {
return this.heaterProfile
}
get loaded_pid_profile(): string | null {
return this.printerObject.pid_profile ?? null
get loaded_heater_profile(): string | null {
return this.printerObject.heater_profile ?? null
}
get pidProfiles(): string[] {
return this.$store.getters['printer/getPIDProfiles']?.get(this.heater_name) ?? {}
get heaterProfiles(): string[] {
return this.$store.getters['printer/getHeaterProfiles']?.get(this.heater_name) ?? {}
}
resetPIDProfile():void {
this.pidProfile = "default"
this.setPIDProfile()
resetHeaterProfile():void {
this.heaterProfile = "default"
this.setHeaterProfile()
}
setPIDProfile():void {
if (!this.pidProfileAllowed(this.pidProfile)) {
setHeaterProfile():void {
if (!this.heaterProfileAllowed(this.heaterProfile)) {
this.$toast.error(
this.$t('Panels.TemperaturePanel.UnknownPIDProfile', { profile: this.pidProfile, heater: this.heater_name }) + ''
this.$t('Panels.TemperaturePanel.UnknownHeaterProfile', { profile: this.heaterProfile, heater: this.heater_name }) + ''
)
} else {
const gcode = 'PID_PROFILE HEATER=' + this.heater_name + ' LOAD=' + this.pidProfile
const gcode = 'HEATER_PROFILE HEATER=' + this.heater_name + ' LOAD=' + this.heaterProfile
this.$store.dispatch('server/addEvent', {
message: gcode,
type: 'command',
Expand All @@ -270,9 +270,9 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
}
}
@Watch('loaded_pid_profile')
pidProfileChanged(newVal: any): void {
this.pidProfile = this.printerObject.pid_profile
@Watch('loaded_heater_profile')
heaterProfileChanged(newVal: any): void {
this.heaterProfile = this.printerObject.heater_profile
}
get formatState() {
Expand Down Expand Up @@ -375,8 +375,8 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
return ''
}
get hidePIDProfiles(): boolean {
return this.$store.state.gui.view.tempchart.hidePIDProfiles ?? false
get hideHeaterProfiles(): boolean {
return this.$store.state.gui.view.tempchart.hideHeaterProfiles ?? false
}
}
</script>
Expand All @@ -390,26 +390,26 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
cursor: pointer;
}
._pid-profile-input {
._heater-profile-input {
min-width: 4.2rem;
max-width: 8rem;
padding-right: 0 !important;
}
._pid-profile-input >>> .v-input__slot {
._heater-profile-input >>> .v-input__slot {
min-height: 1rem !important;
padding-left: 8px !important;
padding-right: 8px !important;
}
._pid-profile-input >>> .v-text-field__slot input {
._heater-profile-input >>> .v-text-field__slot input {
text-align: center !important;
padding-top: 4px;
padding-bottom: 4px;
min-width: 4rem;
}
._pid-profile-reset {
._heater-profile-reset {
margin-top: -6px;
margin-left: -4px;
margin-right: -4px;
Expand Down
Loading

0 comments on commit 72657da

Please sign in to comment.