perf(温度显示) 优化温度显示逻辑

This commit is contained in:
marcinlei@outlook.com 2025-08-24 17:10:46 +08:00
parent c8794b8d47
commit 1c582f2aa8
3 changed files with 24 additions and 2 deletions

@ -217,6 +217,14 @@ def get_sensor_all_image_path(type):
file_path = os.path.join(default_chart_dir, "VR_CPU_temperature.png") file_path = os.path.join(default_chart_dir, "VR_CPU_temperature.png")
case "vr_fpga": case "vr_fpga":
file_path = os.path.join(default_chart_dir, "VR_FPGA_temperature.png") file_path = os.path.join(default_chart_dir, "VR_FPGA_temperature.png")
case "opt0":
file_path = os.path.join(default_chart_dir, "OPT0_temperature.png")
case "opt1":
file_path = os.path.join(default_chart_dir, "OPT1_temperature.png")
case "opt2":
file_path = os.path.join(default_chart_dir, "OPT2_temperature.png")
case "opt3":
file_path = os.path.join(default_chart_dir, "OPT3_temperature.png")
case _: case _:
file_path = os.path.join(default_chart_dir, "temperature_distribution.png") file_path = os.path.join(default_chart_dir, "temperature_distribution.png")
return file_path return file_path

@ -44,5 +44,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"Outlet_CPU_Temp": "outlet_cpu", "Outlet_CPU_Temp": "outlet_cpu",
"Outlet_FPGA_Temp": "outlet_fpga", "Outlet_FPGA_Temp": "outlet_fpga",
"VR_CPU_Temp": "vr_cpu", "VR_CPU_Temp": "vr_cpu",
"VR_FPGA_Temp": "vr_fpga" "VR_FPGA_Temp": "vr_fpga",
"OPT0_Temp": "opt1",
"OPT1_Temp": "opt1",
"OPT2_Temp": "opt2",
"OPT3_Temp": "opt3",
} }

@ -2,6 +2,8 @@ from PyQt5.QtWidgets import QGraphicsPixmapItem
from PyQt5.QtGui import QPixmap, QStandardItem from PyQt5.QtGui import QPixmap, QStandardItem
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from utils import show_critical_message # 导入工具类的错误弹窗函数 from utils import show_critical_message # 导入工具类的错误弹窗函数
from utils import show_info_message
import os
class ViewRenderer: class ViewRenderer:
"""视图渲染模块负责图片显示、表格数据填充等UI渲染逻辑""" """视图渲染模块负责图片显示、表格数据填充等UI渲染逻辑"""
@ -14,6 +16,14 @@ class ViewRenderer:
QGraphicsView 中显示图片支持抗锯齿居中适配 QGraphicsView 中显示图片支持抗锯齿居中适配
:param image_path: 图片文件的绝对路径 :param image_path: 图片文件的绝对路径
""" """
if not os.path.exists(image_path):
show_info_message(
parent=self.main_window,
title="图片无法显示",
message="目标日志文件中无温度数据, 可能是BMC版本不支持\n"
)
return
try: try:
# 1. 清空场景中已有的图片(避免叠加显示) # 1. 清空场景中已有的图片(避免叠加显示)
self.main_window.scene.clear() self.main_window.scene.clear()