fix: 无日志上传时显示提示框

This commit is contained in:
marcinlei@outlook.com 2025-08-24 22:49:38 +08:00
parent f58eda0421
commit c6d3d57358
4 changed files with 24 additions and 6 deletions

@ -36,7 +36,10 @@ class EventHandler:
# 获取选中项对应的路径关键词 # 获取选中项对应的路径关键词
key = self.main_window.combo_box_text_dict.get(selected_text) key = self.main_window.combo_box_text_dict.get(selected_text)
if key: if key:
self.view_renderer.display_pic(self.main_window.file_processor.get_sensorhistory_path(key)) self.view_renderer.display_pic(
self.main_window.file_processor.get_sensorhistory_path(key),
self.main_window.parse_status.diag_complete_status
)
def dragEnterEvent(self, event: QDragEnterEvent): def dragEnterEvent(self, event: QDragEnterEvent):
"""拖入事件:判断是否为文件""" """拖入事件:判断是否为文件"""

@ -61,7 +61,10 @@ class FileProcessor:
# 更新传感器图片 # 更新传感器图片
if self.parse_status.sensorhistory_status: if self.parse_status.sensorhistory_status:
self.view_renderer.display_pic(self.get_sensorhistory_path("all")) self.view_renderer.display_pic(
self.get_sensorhistory_path("all"),
self.parse_status.diag_complete_status
)
# 更新告警表格 # 更新告警表格
if self.parse_status.parseidl_status and not service.is_idl_alert_empty(): if self.parse_status.parseidl_status and not service.is_idl_alert_empty():

@ -8,6 +8,7 @@ import ZiJin_parse_event as zijin_event
class ServiceStatus(): class ServiceStatus():
def __init__(self): def __init__(self):
self.diag_complete_status = False
self.sensorhistory_status = False self.sensorhistory_status = False
self.baseinfo_status = False self.baseinfo_status = False
self.parseidl_status = False self.parseidl_status = False
@ -86,4 +87,7 @@ def start_diagnose(parseStatus):
parseStatus.set_parseidl_status(result_parseidl) parseStatus.set_parseidl_status(result_parseidl)
result_eventline = zijin_event.program_main() result_eventline = zijin_event.program_main()
parseStatus.set_eventline_status(result_eventline) parseStatus.set_eventline_status(result_eventline)
# 完成文件解析后将 diag_complete_status 置位
parseStatus.diag_complete_status = True

@ -11,16 +11,24 @@ class ViewRenderer:
# 持有主窗口引用用于访问UI组件如graphicsView、model_alert # 持有主窗口引用用于访问UI组件如graphicsView、model_alert
self.main_window = main_window self.main_window = main_window
def display_pic(self, image_path): def display_pic(self, image_path, completeStatus):
""" """
QGraphicsView 中显示图片支持抗锯齿居中适配 QGraphicsView 中显示图片支持抗锯齿居中适配
:param image_path: 图片文件的绝对路径 :param image_path: 图片文件的绝对路径
""" """
if not completeStatus:
show_info_message(
parent=self.main_window,
title="图片无法显示",
message="当前无日志文件解析\n"
)
return
if not os.path.exists(image_path): if not os.path.exists(image_path):
show_info_message( show_info_message(
parent=self.main_window, parent=self.main_window,
title="图片无法显示", title="图片无法显示",
message="目标日志文件中无温度数据, 可能是BMC版本不支持\n" message="目标日志文件中无温度数据; BMC版本不支持\n"
) )
return return