This commit is contained in:
2025-11-21 14:55:52 +08:00
parent e3ecd0550f
commit 26ed8df502
36 changed files with 908 additions and 433 deletions

View File

@ -7,7 +7,6 @@ from .bottom_control_controller import BottomControlController
from .hopper_controller import HopperController
from service.msg_recorder import MessageRecorder
from config.settings import Settings
from core.system import FeedingControlSystem
from opc.opcua_server import SimpleOPCUAServer
@ -15,8 +14,7 @@ class MainController:
def __init__(self):
# 主界面
self.main_window = MainWindow()
self.settings = Settings()
self.system = FeedingControlSystem(self.settings)
self.system = FeedingControlSystem()
self.system.initialize()
self.system.state.state_updated.connect(self.update_ui_notify)
self.opcua_server = SimpleOPCUAServer(self.system.state)
@ -63,7 +61,7 @@ class MainController:
def update_ui_notify(self, prop:str,value):
"""更新UI状态"""
print(f"更新UI状态: {prop} = {value}")
# print(f"更新UI状态: {prop} = {value}")
def __connectSignals(self):
self.main_window.about_to_close.connect(self.handleMainWindowClose) # 处理主界面关闭
@ -71,6 +69,9 @@ class MainController:
def handleMainWindowClose(self):
"""主界面关闭"""
self.msg_recorder.normal_record("关闭自动智能浇筑系统")
self.system.stop()
self.opcua_server.stop()
# 停止系统底部控制器中的线程
if hasattr(self, 'bottom_control_controller'):
self.bottom_control_controller.stop_threads()