diff --git a/src/event_handler.py b/src/event_handler.py index 5e584eb..d82e698 100644 --- a/src/event_handler.py +++ b/src/event_handler.py @@ -36,7 +36,10 @@ class EventHandler: # 获取选中项对应的路径关键词 key = self.main_window.combo_box_text_dict.get(selected_text) 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): """拖入事件:判断是否为文件""" diff --git a/src/file_processor.py b/src/file_processor.py index b99eb52..abe4f86 100644 --- a/src/file_processor.py +++ b/src/file_processor.py @@ -61,7 +61,10 @@ class FileProcessor: # 更新传感器图片 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(): diff --git a/src/service.py b/src/service.py index 8cc44be..44317f5 100644 --- a/src/service.py +++ b/src/service.py @@ -8,6 +8,7 @@ import ZiJin_parse_event as zijin_event class ServiceStatus(): def __init__(self): + self.diag_complete_status = False self.sensorhistory_status = False self.baseinfo_status = False self.parseidl_status = False @@ -86,4 +87,7 @@ def start_diagnose(parseStatus): parseStatus.set_parseidl_status(result_parseidl) result_eventline = zijin_event.program_main() - parseStatus.set_eventline_status(result_eventline) \ No newline at end of file + parseStatus.set_eventline_status(result_eventline) + + # 完成文件解析后将 diag_complete_status 置位 + parseStatus.diag_complete_status = True \ No newline at end of file diff --git a/src/view_renderer.py b/src/view_renderer.py index 94add41..aed0126 100644 --- a/src/view_renderer.py +++ b/src/view_renderer.py @@ -11,16 +11,24 @@ class ViewRenderer: # 持有主窗口引用,用于访问UI组件(如graphicsView、model_alert) self.main_window = main_window - def display_pic(self, image_path): + def display_pic(self, image_path, completeStatus): """ 在 QGraphicsView 中显示图片(支持抗锯齿、居中适配) :param image_path: 图片文件的绝对路径 - """ + """ + if not completeStatus: + show_info_message( + parent=self.main_window, + title="图片无法显示", + message="当前无日志文件解析\n" + ) + return + if not os.path.exists(image_path): show_info_message( parent=self.main_window, title="图片无法显示", - message="目标日志文件中无温度数据, 可能是BMC版本不支持\n" + message="目标日志文件中无温度数据; BMC版本不支持\n" ) return