From c6d3d57358f6cc9ce87f4c0d3ad67059699bda93 Mon Sep 17 00:00:00 2001 From: "marcinlei@outlook.com" <1750818448@qq.com> Date: Sun, 24 Aug 2025 22:49:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=E6=97=A5=E5=BF=97=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=97=B6=E6=98=BE=E7=A4=BA=E6=8F=90=E7=A4=BA=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/event_handler.py | 5 ++++- src/file_processor.py | 5 ++++- src/service.py | 6 +++++- src/view_renderer.py | 14 +++++++++++--- 4 files changed, 24 insertions(+), 6 deletions(-) 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