diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f78cf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pyc + diff --git a/QT5_Project/KD_ZM_8/__pycache__/UIFrameWork.cpython-311.pyc b/QT5_Project/KD_ZM_8/__pycache__/UIFrameWork.cpython-311.pyc index fb5868b..919dd37 100644 Binary files a/QT5_Project/KD_ZM_8/__pycache__/UIFrameWork.cpython-311.pyc and b/QT5_Project/KD_ZM_8/__pycache__/UIFrameWork.cpython-311.pyc differ diff --git a/QT5_Project/KD_ZM_8_XCF/APPWindow.py b/QT5_Project/KD_ZM_8_XCF/APPWindow.py new file mode 100644 index 0000000..5a4ed98 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/APPWindow.py @@ -0,0 +1,1038 @@ +# This Python file uses the following encoding: utf-8 +import sys +import time +from PyQt5.QtWidgets import QWidget, QLineEdit +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget, QWidget, QLayout, QLabel, QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog,QTextEdit +from PyQt5 import uic +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent +from PyQt5.QtGui import QImage, QPixmap, QColor, QKeySequence +from UIFrameWork import UIFrameWork +from UIFrameWork import * +# 添加当前脚本的父级目录到 sys.path +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget +from PyQt5.QtWidgets import QDesktopWidget + +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from print_color import * +from Shared_CODE.get_tip_prop import * +from Shared_CODE.DialogFaceView import * + +# 设置 UI 目录的路径 +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'UI')) + + +# 页面文件,动态构建 UI 文件的路径 +uiFile_P00DeviceList = os.path.join(ui_path, "P00DeviceList.ui") +uiFile_P01DeviceMenu = os.path.join(ui_path, "P01DeviceMenu.ui") +uiFile_P02DataView = os.path.join(ui_path, "P02DataView.ui") +uiFile_P03SwitchAction = os.path.join(ui_path, "P03SwitchAction.ui") +uiFile_P04ParamSet = os.path.join(ui_path, "P04ParamSet.ui") + +uiFile_P05CameraView = os.path.join(ui_path, "P05CameraView.ui") +uiFile_P05_01_FaceCameraView = os.path.join(ui_path, "P05_01_FaceCameraView.ui") + +uiFile_P06FaultQuery = os.path.join(ui_path, "P06FaultQuery.ui") +uiFile_P07SystemSet = os.path.join(ui_path, "P07SystemSet.ui") +uiFile_P08FieldTestAction = os.path.join(ui_path, "P08FieldTestAction.ui") +uiFile_P11LightDeviceMenu = os.path.join(ui_path, "P11LightDeviceMenu.ui") +uiFile_P12LightDataView = os.path.join(ui_path, "P12LightDataView.ui") +uiFile_P13LightSwitchAction = os.path.join(ui_path, "P13LightSwitchAction.ui") +uiFile_P14LightParamSet = os.path.join(ui_path, "P14LightParamSet.ui") +uiFile_P16LightFaultQuery = os.path.join(ui_path, "P16LightFaultQuery.ui") +uiFile_P17LightSystemSet = os.path.join(ui_path, "P17LightSystemSet.ui") +uiFile_P18LightFieldTestAction = os.path.join(ui_path, "P18LightFieldTestAction.ui") + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#ECECEC").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() + +COLOR_VALUE_NORMAL_YELLOW = QColor("#F8C822").name() +COLOR_VALUE_NORMAL_BLUE = QColor("#4E76D4").name() +COLOR_VALUE_NORMAL_READ = QColor("#CE5D62").name() +COLOR_VALUE_NORMAL_GREEN = QColor("#83BF6E").name() + + + +def get_camera_id_and_canvas_id(action : str) : + camera_id = -1 + canvas_id = -1 + if "canvas" in action and "camera" in action : + action_splits = action.split("_") + for action_split_str in action_splits: + if "camera" in action_split_str: + camera_id = get_value_from_lead_value_str(action_split_str, "camera", -1) + elif "canvas" in action_split_str: + canvas_id = get_value_from_lead_value_str(action_split_str, "canvas", -1) + return camera_id, canvas_id + + +#根据回路选择摄像头url地址 +def search_camera_url(camera_id : int) : + cameral_url = None + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_camera_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_camera_id == camera_id : + cameral_url = utils.dict_or_object_get_attr(item_dict, "camera_url", None) + if cameral_url != None : + return cameral_url + return cameral_url + +menu_page_widget_list = [] + +class PageTemplate(UIFrameWork): # 页面模板类,包含各子页面公用功能 + def __init__(self, parent_window): # + UIFrameWork.__init__(self) # + self.parent_window : APPWindow = parent_window + + def connect_matched_camera_canvas(self) : + page_widget : UIFrameWork = self.parent_window.stack.currentWidget() + if page_widget != None : + for canvas_id in range(9) : + camera_id , face_detect = page_widget.get_canvas_prop(canvas_id) + if camera_id >= 0 : + self.parent_window.connect_camera_to_canvas(page_widget, camera_id, canvas_id, face_detect) + + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.parent_window.camera_thread_list) : + face_detect = 0 + canvas_object = self.search_canvas_object(canvas_id) + if canvas_object != None : + face_detect = get_tip_face_detection(canvas_object.statusTip()) + + camera_thread : CameraThread = self.parent_window.camera_thread_list[camera_id] + if camera_thread != None : + if not camera_thread.is_emit and is_visible: + self.show_camera_error(camera_id) + + if camera_thread.is_emit: + self.connect_camera_thread(camera_thread, canvas_id, is_visible) + self.parent_window.camera_signal.emit(camera_id) + camera_thread.face_detection = face_detect + + if hasattr(self, "CameraChioceLabel") : + # self.CameraChioceLabel.setStyleSheet("color: rgb(255, 255, 255); font-size: 50px;") + self.CameraChioceLabel.setText("回路" + str(camera_id+1)) + else: + self.show_camera_error(camera_id) + + def show_camera_error(self, camera_id) : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", f"视频流{camera_id+1}无法初始化或失去连接!") + + #定义虚函数, 进入页面时调用 + def virtual_on_page_enter(self) : + pass + + #定义虚函数, 退出页面时调用 + def virtual_on_page_leave(self) : + pass + + #重载虚函数, 切换页面时调用 + def virtual_change_to_page(self, page) : + if self.parent_window == None : + return + + self_page_widget : PageTemplate = self.parent_window.stack.currentWidget() + if self_page_widget == None : + return + + target_page_widget : PageTemplate = None + + if page >= 0 : + target_page_widget = self.parent_window.search_page_widget(page) + if target_page_widget in menu_page_widget_list: + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == None or pop_page_widget == target_page_widget: + break + else : + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == self : + continue + else : + target_page_widget = pop_page_widget + break + + if target_page_widget == None : + target_page_widget = self.parent_window.allpages_list[0] + + if target_page_widget != None : + menu_page_widget_list.append(target_page_widget) + self_page_widget.virtual_on_page_leave() + self.parent_window.stack.setCurrentWidget(target_page_widget) + target_page_widget.virtual_on_page_enter() + self.connect_matched_camera_canvas() + + def virtual_widget_action_process(self, widget : QWidget, action : str) : + action_splits = action.split("+") + page_id = -1 + circuit_id = -1 + main_index = -1 + add_circuit = -1 + binding_circuit = -1 + for action_split_str in action_splits : + if "SetPage" in action_split_str : + page_id = get_value_from_lead_value_str(action_split_str, "SetPage", -1) + elif "SetCircuit" in action_split_str : + circuit_id = get_value_from_lead_value_str(action_split_str, "SetCircuit", -1) + elif "SetMain" in action_split_str: + main_index = get_value_from_lead_value_str(action_split_str, "SetMain", -1) + elif "AddCircuit" in action_split_str : + add_circuit = get_value_from_lead_value_str(action_split_str, "AddCircuit", -1) + elif "SetBinding" in action_split_str : + binding_circuit = get_value_from_lead_value_str(action_split_str, "SetBinding", 1) + + + print("@Line:",inspect.currentframe().f_lineno,' = ',circuit_id,' = ',action_splits) + + if add_circuit >= 0 : + tip_str : str = page_widget.statusTip() + circuit_id = get_tip_circuit(tip_str) + circuit_id = circuit_id + 1 + + if binding_circuit > 0 : + circuit_id = self.get_circuit_from_object(widget) + + target_page_widget = self.parent_window.search_page_widget(page_id) + page_widget : PageTemplate = target_page_widget + + if page_id >= 0 : # 功能标记:执行页面跳转功能 + target_page_widget = self.parent_window.search_page_widget(page_id) + + if target_page_widget != None : + if circuit_id >= 0 : + target_page_widget.set_page_circuit(circuit_id) + self.virtual_change_to_page(page_id) + + if main_index >= 0 : # 功能标记:执行控件主索引设定 + self.set_menu_main_index(main_index) # 设置页面主索引字段
,可以跨组选择控件 + + if circuit_id >= 0 : + indicator : QLineEdit = target_page_widget.findChild(QLineEdit,"BindNum_Title") + indicator.setText("当前回路为 %d"%(circuit_id + 1)) + + # 显示提示图标 + indicator_Label : QLabel = target_page_widget.findChild(QLabel,"indicator_Label") + tip_str : str = indicator_Label.statusTip() + imag_file_name = get_imag_value_file_name(tip_str, circuit_id) + if imag_file_name != None : + self.modify_object_style_sheet(indicator_Label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(indicator_Label) + + camera_id, canvas_id = get_camera_id_and_canvas_id(action) + self.virtual_connect_canvas_to_camera(canvas_id, camera_id) + +#P00设备列表页面 +class QDeviceListPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P00DeviceList) + + # 回路1测试:开关合闸1,总开关0,无报警 + json_dict0 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"无故障","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1143", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"60", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"20", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"45321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路2测试:开关合闸1,分开关1,无报警 + json_dict1 = { "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"开关未到位","type" : "alarm","color" : COLOR_ALARM_ERROR_TEXT}, + "Voltage" : {"value" :"1120", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"45", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"30", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"46321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路3测试:开关合闸1,总开关0,无报警 + json_dict2 = { "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1065", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"30", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"16", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"1321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路4测试:开关合闸1,总开关0,无报警 + json_dict3 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1141", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"26", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"32321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路5测试:开关合闸1,总开关0,无报警 + json_dict4 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"2133", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"26", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"4453", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路6测试:开关合闸1,总开关0,无报警 + json_dict5 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1212", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"27", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"11212", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路7测试:开关合闸1,总开关0,无报警 + json_dict6 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1564", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"32", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"45341", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + # self.flush_widgets(3, json_dict3) + # # self.flush_widgets(4, json_dict4) + # # self.flush_widgets(5, json_dict5) + # # self.flush_widgets(6, json_dict6) + +#P01设备列表页面 +class QDeviceMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P01DeviceMenu) + +#P02数据查看页面 +class QDataViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P02DataView) + + json_dict0 = {"Uab" :"1111", "Ubc" : "1111", "Uca" : "1111", "Uo" : "11" , "Iab" : "1111", "Ibc" : "1111", "Ica" : "1111", "Io" : "1111"} + json_dict1 = {"Uab" :"2222", "Ubc" : "2222", "Uca" : "2222", "Uo" : "22" , "Iab" : "2222", "Ibc" : "2222", "Ica" : "2222", "Io" : "2222"} + json_dict2 = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P03开关操作页面 +class QSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P03SwitchAction) + + json_dict0 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + json_dict1 = {"SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + json_dict2 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P04参数设置页面 +class QParamSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P04ParamSet) + + json_dict0 = {"Uab" :"1000", "Ubc" : "5", "Uca" : "50"} + json_dict1 = {"Uab" :"1111", "Ubc" : "111", "Uca" : "111"} + json_dict2 = {"Uab" :"2222", "Ubc" : "222", "Uca" : "222"} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) +''' + # 查找 QLineEdit 控件 + self.line_edit = self.findChild(QLineEdit) + if self.line_edit: + # 重写 QLineEdit 的鼠标按下事件 + self.line_edit.mousePressEvent = self.on_line_edit_clicked + def on_line_edit_clicked(self, event): + + self.key_enter_process() + # 调用原始的鼠标按下事件处理方法 + QLineEdit.mousePressEvent(self.line_edit, event) + +''' +#P05视频查看页面 QFaultQueryPage +class QCameraViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P05CameraView) + + def virtual_on_page_enter(self) : + self.parent_window.camera_signal.emit(0) +#P05_01人脸视频查看页面 +class QFaceCameraViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P05_01_FaceCameraView) + # 读取配置 + self.default_baud = getattr(group_config, "BAUDRATE", 115200) + + # 串口/线程变量 + self.ser = None + self.worker = SerialWorker(lambda: self.ser) + self.worker.frame_received.connect(self.on_frame) + self.worker.log_message.connect(self.log) + self.worker.start() + + self.video_worker = None + self.last_port = None + self.last_enroll_name = "" + self.current_video_mode = 0 + self.current_face_box = 0 + + + #信号绑定 + # self.btn_refresh.clicked.connect(self.refresh_ports) + # self.btn_conn.clicked.connect(self.toggle_conn) + self.btn_video.clicked.connect(self.toggle_video) + self.btn_video_mode.clicked.connect(self.toggle_video_mode) + self.chk_face_box.stateChanged.connect(self.toggle_face_box) + self.btn_save.clicked.connect(self.save_log) + self.btn_reset.clicked.connect(lambda: self.send(build_reset())) + self.btn_enroll.clicked.connect(self.do_enroll_itg_single) + self.btn_users.clicked.connect(self.do_manage_users) + self.btn_verify.clicked.connect(self.do_verify) + + + # 定时器:串口监控 & 视频重连 + self.t_port = QTimer(self) + self.t_port.setInterval(1000) + self.t_port.timeout.connect(self._port_tick) + self.t_port.start() + + self.t_video = QTimer(self) + self.t_video.setInterval(2000) + self.t_video.timeout.connect(self._check_video) + self.t_video.start() + + self.auto_connect_serial() + # 串口管理 + + def auto_connect_serial(self): + """根据 config.py 选择默认串口,但不立即打开""" + ports = [p.device for p in serial.tools.list_ports.comports()] + if not ports: + self.log("[WARN] 未检测到任何串口设备") + return + + sys_platform = platform.system() + preferred_port = group_config.DEFAULT_PORT.get(sys_platform) + + if preferred_port and preferred_port in ports: + self.last_port = preferred_port + self.log(f"[INFO] 已选择默认串口 {preferred_port},等待自动连接") + else: + self.log(f"[WARN] {sys_platform} 平台未找到配置串口或设备不在列表: {ports}") + + def _port_tick(self): + ports = {p.device for p in serial.tools.list_ports.comports()} + + # 如果串口对象不存在或已关闭 + if not self.ser or not getattr(self.ser, "is_open", False): + # 串口掉线,自动关闭 + if self.ser: # 如果之前有串口对象 + self.close_serial() + # 尝试自动重连 + if self.last_port in ports: + self.open_serial(self.last_port) + + def open_serial(self, port=None): + port = port or self.cb_port.currentText() or self.last_port + if not port: + self.log("[WARN] 没有选择串口") + return + try: + baud = self.default_baud + self.ser = serial.Serial(port, baudrate=baud, timeout=0.05) + self.last_port = port + # self.btn_conn.setText("断开") + self.log(f"[INFO] 已连接 {port} @ {baud}") + except Exception as e: + self.log(f"[ERR] 打开串口失败: {e}") + self.ser = None + + def close_serial(self): + if self.ser: + try: + self.ser.close() + except: + pass + self.ser = None + self.btn_conn.setText("连接") + self.log("[INFO] 串口已关闭") + + def toggle_conn(self): + if self.ser and getattr(self.ser, "is_open", False): + self.close_serial() + else: + self.open_serial() + + def send(self, frame: bytes): + if not self.ser or not getattr(self.ser, "is_open", False): + QMessageBox.warning(self, "提示", "请先连接串口") + return + try: + self.ser.write(frame) + self.log("> " + frame.hex(" ")) + except Exception as e: + self.log(f"[ERR] write: {e}") + + # 业务功能 + def do_verify(self): + dlg = VerifyDialog(self) + if dlg.exec_() == QDialog.Accepted: + pd_val, timeout_val = dlg.values() + self.send(build_verify(pd_val, timeout_val)) + + def do_enroll_itg_single(self): + dlg = EnrollItgSingleDialog(self) + if dlg.exec_() == QDialog.Accepted: + admin_val, uname, face_dir, timeout_val, itg_val = dlg.values() + self.last_enroll_name = uname + self.send(build_enroll_itg_single(admin_val, uname, face_dir, timeout_val, itg_val)) + + def do_manage_users(self): + UserManageDialog(self, self.send).exec_() + + def toggle_video(self): + running = self.video_worker and self.video_worker.isRunning() + if running: + self.video_worker.stop() + self.video_worker.wait(300) + self.video_worker = None + self.video_label.setText("未打开") + self.video_label.setPixmap(QPixmap()) + self.btn_video.setText("打开视频") + self.log("[INFO] 视频已关闭") + return + + if self.video_label.width()<50 or self.video_label.height()<50: + self.video_label.setMinimumSize(360,480) + + self.video_worker = VideoWorker(cam_index=0, target_size=self.video_label.size()) + self.video_worker.pixmap_ready.connect(self.video_label.setPixmap) + self.video_worker.log_message.connect(self.log) + self.video_worker.start() + self.btn_video.setText("关闭视频") + self.log("[INFO] 正在打开视频") + + def toggle_video_mode(self): + if self.current_video_mode==0: + self.send_uvc(0) + self.current_video_mode=1 + self.log("[INFO] 已切换到红外视频模式") + else: + self.send_uvc(1) + self.current_video_mode=0 + self.log("[INFO] 已切换到彩色视频模式") + + def toggle_face_box(self, state): + if state==Qt.Checked: + self.face_box_enabled=True + self.send_face_box(1) + self.log("[INFO] 人脸框已开启") + else: + self.face_box_enabled=False + self.send_face_box(0) + self.log("[INFO] 人脸框已关闭") + + # ---------------- 发送指令 ---------------- + def send_uvc(self, mode): + if self.ser and getattr(self.ser,"is_open",False): + self.ser.write(build_uvc_view(mode)) + else: + self.log("[WARN] 串口未连接,无法切换视频模式") + + def send_face_box(self, state): + if self.ser and getattr(self.ser,"is_open",False): + self.ser.write(build_face_view(state)) + else: + self.log("[WARN] 串口未连接,无法控制人脸框") + + # ---------------- 定时器检测 ---------------- + def _check_video(self): + if self.video_worker and not self.video_worker.isRunning(): + self.log("[WARN] 摄像头线程已停止") + self.video_worker=None # 自动重连可在这里实现 + + # 帧处理 + def on_frame(self, fr: dict): + self.log("< " + fr["raw"].hex(" ")) + msg_id = fr.get("msg_id") + data = fr.get("data", b"") + + if msg_id == MID_REPLY: + info = parse_reply(data) + self.log(f"[REPLY] {info}") + if info.get("mid") in (CMD_ENROLL, CMD_ENROLL_ITG) and info.get("result") == 0x00: + user_id = info.get("user_id") + user_name = self.last_enroll_name or "" + if user_id and user_name: + if save_user(user_id, user_name): + self.log(f"[INFO] 用户 {user_name}(ID={user_id}) 已保存") + else: + QMessageBox.warning(self, "提示", f"用户ID {user_id} 已存在!") + elif msg_id == MID_NOTE: + info = parse_note(data) + self.log(f"[NOTE] {info}") + + # 日志 + def log(self, s: str): + ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + self.txt_log.append(f"[{ts}] {s}") + self.txt_log.moveCursor(self.txt_log.textCursor().End) + pass + + def save_log(self): + path, _ = QFileDialog.getSaveFileName(self, "保存日志", "", "Text files (*.txt)") + if not path: + return + with open(path, "w", encoding="utf-8") as f: + f.write(self.txt_log.toPlainText()) + self.log(f"[INFO] 日志已保存到 {path}") + + def closeEvent(self,e): + if self.video_worker and self.video_worker.isRunning(): + self.video_worker.stop() + self.video_worker.wait(300) + if self.ser and getattr(self.ser,"is_open",False): + self.close_serial() + super().closeEvent(e) + + + +#P06故障查询页面 QFaultQueryPage +class QFaultQueryPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P06FaultQuery) + self.alarm_index = 0 + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +#P07系统参数设置页面 +class QSystemSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P07SystemSet) + +#P08现场试验页面 +class QFieldTestAction(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P08FieldTestAction) + +# P11照明菜单选择 +class QLightMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P11LightDeviceMenu) + +# P12照明运行数据页面 +class QRunDataPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P12LightDataView) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P13照明开关操作页面 +class QLightSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P13LightSwitchAction) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P14照明参数设置页面 +class QLightParamSetPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P14LightParamSet) + +# P16照明故障查询 +class QLightFaultQuery(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P16LightFaultQuery) + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +# P17照明系统参数 +class QLightSystemSet(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P17LightSystemSet) + +# P18现场试验页面 +class QLightFieldTestAction(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P18LightFieldTestAction) + +class APPWindow(QMainWindow): + camera_signal = pyqtSignal(int) + def __init__(self): + super().__init__() + + # 获取屏幕分辨率 + screen = QDesktopWidget().screenGeometry() + screen_width = screen.width() + screen_height = screen.height() + + self.stack = QStackedWidget(self) + self.setGeometry(0, 0, screen_width, screen_height) # 设置窗口大小为屏幕分辨率 + self.stack.setGeometry(0, 0, screen_width, screen_height) # 设置堆叠窗口大小为屏幕分辨率 + + #调试的时候用下面两行,全屏就注释 + # self.setGeometry(0, 0, 1024, 768) + # self.stack.setGeometry(0, 0, 1024, 768) + + self.ser = None + self.worker = SerialWorker(lambda: self.ser) + self.worker.frame_received.connect(self.on_frame) + self.worker.log_message.connect(self.log) + self.worker.start() + self.video_worker = None + self.last_port = None + self.last_enroll_name = "" + self.current_video_mode = 0 + self.current_face_box = 0 + + self.showFullScreen() + + self.menu_sequence_list : PageTemplate = [] + self.camera_thread_list : CameraThread = [None, None, None, None, None, None, None, None, None] + self.allpages_list : PageTemplate = [] + + self.P00_DeviceList : PageTemplate = QDeviceListPage(parent_window = self) + self.P01_DeviceMenu : PageTemplate = QDeviceMenuPage(parent_window = self) + self.P02_DataView : PageTemplate = QDataViewPage(parent_window = self) + self.P03_SwitchAction : PageTemplate = QSwitchActionPage(parent_window = self) + self.P04_ParamSet : PageTemplate = QParamSetPage(parent_window = self) + self.P05_CameraView : PageTemplate = QCameraViewPage(parent_window = self) + + self.P05_01_FaceCameraView : PageTemplate = QFaceCameraViewPage(parent_window = self) + + self.P06_FaultQuery : PageTemplate = QFaultQueryPage(parent_window = self) + self.P07_SystemSet : PageTemplate = QSystemSetPage(parent_window = self) + self.P08_FieldTestAction : PageTemplate = QFieldTestAction(parent_window = self) + self.P11_DeviceMenu : PageTemplate = QLightMenuPage(parent_window = self) + self.P12_DateView : PageTemplate = QRunDataPage(parent_window = self) + self.P13_SwitchAction : PageTemplate = QLightSwitchActionPage(parent_window = self) + self.P14_ParamSet : PageTemplate = QLightParamSetPage(parent_window = self) + self.P16_LightFaultQuery : PageTemplate = QLightFaultQuery(parent_window = self) + self.P17_LightSystemSet : PageTemplate = QLightSystemSet(parent_window = self) + self.P18_LightFieldTestAction : PageTemplate = QLightFieldTestAction(parent_window = self) + + self.allpages_list.append(self.P00_DeviceList) + self.allpages_list.append(self.P01_DeviceMenu) + self.allpages_list.append(self.P02_DataView) + self.allpages_list.append(self.P03_SwitchAction) + self.allpages_list.append(self.P04_ParamSet) + self.allpages_list.append(self.P05_CameraView) + self.allpages_list.append(self.P05_01_FaceCameraView) + self.allpages_list.append(self.P06_FaultQuery) + self.allpages_list.append(self.P07_SystemSet) + self.allpages_list.append(self.P08_FieldTestAction) + self.allpages_list.append(self.P11_DeviceMenu) + self.allpages_list.append(self.P12_DateView) + self.allpages_list.append(self.P13_SwitchAction) + self.allpages_list.append(self.P14_ParamSet) + self.allpages_list.append(self.P16_LightFaultQuery) + self.allpages_list.append(self.P17_LightSystemSet) + self.allpages_list.append(self.P18_LightFieldTestAction) + + self.stack.addWidget(self.P00_DeviceList) + self.stack.addWidget(self.P01_DeviceMenu) + self.stack.addWidget(self.P02_DataView) + self.stack.addWidget(self.P03_SwitchAction) + self.stack.addWidget(self.P04_ParamSet) + self.stack.addWidget(self.P05_CameraView) + self.stack.addWidget(self.P05_01_FaceCameraView) + self.stack.addWidget(self.P06_FaultQuery) + self.stack.addWidget(self.P07_SystemSet) + self.stack.addWidget(self.P08_FieldTestAction) + self.stack.addWidget(self.P11_DeviceMenu) + self.stack.addWidget(self.P12_DateView) + self.stack.addWidget(self.P13_SwitchAction) + self.stack.addWidget(self.P14_ParamSet) + self.stack.addWidget(self.P16_LightFaultQuery) + self.stack.addWidget(self.P17_LightSystemSet) + self.stack.addWidget(self.P18_LightFieldTestAction) + + test_init = system_parameter() + set_screen_blanking_time(test_init.get_screen_blanking_time()) +########################################################################### + def on_frame(self, fr: dict): + self.log("< " + fr["raw"].hex(" ")) + msg_id = fr.get("msg_id") + data = fr.get("data", b"") + + if msg_id == MID_REPLY: + info = parse_reply(data) + self.log(f"[REPLY] {info}") + if info.get("mid") in (CMD_ENROLL, CMD_ENROLL_ITG) and info.get("result") == 0x00: + user_id = info.get("user_id") + user_name = self.last_enroll_name or "" + if user_id and user_name: + if save_user(user_id, user_name): + self.log(f"[INFO] 用户 {user_name}(ID={user_id}) 已保存") + else: + QMessageBox.warning(self, "提示", f"用户ID {user_id} 已存在!") + elif msg_id == MID_NOTE: + info = parse_note(data) + self.log(f"[NOTE] {info}") + + def log(self, s: str): + ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + print(f"[{ts}] {s}") # 控制台打印日志 + +########################################################################## + + def search_page_widget(self, page) : + for list_item in self.allpages_list: + window_page : UIFrameWork = list_item + if window_page.page == page : + return window_page + return None + + def connect_camera_to_canvas(self, page_widget : UIFrameWork, camera_id: int , canvas_id : int, face_detect : int = 0) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.camera_thread_list) : + camera_thread : CameraThread = self.camera_thread_list[camera_id] + if camera_thread != None : + page_widget.connect_camera_thread(camera_thread, canvas_id) + camera_thread.face_detection = face_detect + + def create_all_camera_thread(self) : + for camera_id in range(len(self.camera_thread_list)) : + _camera_url = search_camera_url(camera_id) + if _camera_url != None : + camera_thread = CameraThread(_camera_url, camera_id) + camera_thread.set_video_cycle_ms(10) + self.camera_thread_list[camera_id] = camera_thread + self.camera_signal.connect(camera_thread.change_camera_url) + + #摄像头与 界面进行绑定 + for index in range(self.stack.count()) : + page_widget : UIFrameWork = self.stack.widget(index) + page_widget.connect_matched_camera_canvas() + + time.sleep(0.1) + + #开启多个摄像头线程 + for camera_thread in self.camera_thread_list: + thread_to_start : CameraThread = camera_thread + if thread_to_start != None : + thread_to_start.start() + time.sleep(0.01) + + def get_page_currentwidget(self) : + return self.stack.currentWidget().sort_menu_list[self.stack.currentWidget().menu_key_index][1] + + def closeEvent(self, event): + reply = QMessageBox.question(self, '确认', '确定要退出吗?', + QMessageBox.Yes | QMessageBox.No) + if reply == QMessageBox.Yes: + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + + if self.video_worker and self.video_worker.isRunning(): + self.video_worker.stop() + self.video_worker.wait(300) + if self.ser and getattr(self.ser,"is_open",False): + self.close_serial() + if thread_to_stop != None : + thread_to_stop.close() + + + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.wait() + + event.accept() # 接受关闭事件 + else: + event.ignore() # 忽略关闭事件 + + +if __name__ == '__main__': + #创建mqtt线程 + fvalue = float('06.00') + value = round(fvalue) + + _user_name = utils.dict_or_object_get_attr(group_config.mqtt_server, "user_name", "admin") + _password = utils.dict_or_object_get_attr(group_config.mqtt_server, "password", "admin") + _server = utils.dict_or_object_get_attr(group_config.mqtt_server, "remote", "127.0.0.1") + _port = utils.dict_or_object_get_attr(group_config.mqtt_server, "port", 1883) + + global_mqtt_thread = class_comm_mqtt_thread() + global_mqtt_thread.set_mqtt_server(server = _server, port = _port, keep_alive = 60, user_name=_user_name, password=_password) + + app = QApplication([]) + app_main_window = APPWindow() + app_main_window.show() + app_main_window.create_all_camera_thread() + + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name != None : + global_mqtt_thread.add_unique_object(circuit_unique_name, app_main_window.allpages_list) + + global_mqtt_thread.start() + app.exec_() + global_mqtt_thread.close() + global_mqtt_thread.join() + + sys.exit(0) \ No newline at end of file diff --git a/QT5_Project/KD_ZM_8_XCF/Light_image/Light_CameraView.png b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_CameraView.png new file mode 100644 index 0000000..124d069 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_CameraView.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/Light_image/Light_DataView.png b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_DataView.png new file mode 100644 index 0000000..d70d6cf Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_DataView.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/Light_image/Light_DeviceMenu.png b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_DeviceMenu.png new file mode 100644 index 0000000..4d63c9b Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_DeviceMenu.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/Light_image/Light_FieldTestAction.png b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_FieldTestAction.png new file mode 100644 index 0000000..0ebc77d Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_FieldTestAction.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/Light_image/Light_ParamSet.png b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_ParamSet.png new file mode 100644 index 0000000..5d8aee0 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_ParamSet.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/Light_image/Light_SystemSet.png b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_SystemSet.png new file mode 100644 index 0000000..f04e409 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/Light_image/Light_SystemSet.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/Light_image/Ligth_FaultQuery.png b/QT5_Project/KD_ZM_8_XCF/Light_image/Ligth_FaultQuery.png new file mode 100644 index 0000000..d168b56 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/Light_image/Ligth_FaultQuery.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/Light_image/Ligth_SwitchAction.png b/QT5_Project/KD_ZM_8_XCF/Light_image/Ligth_SwitchAction.png new file mode 100644 index 0000000..478faa8 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/Light_image/Ligth_SwitchAction.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P00DeviceList.ui b/QT5_Project/KD_ZM_8_XCF/UI/P00DeviceList.ui new file mode 100644 index 0000000..b1dffef --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P00DeviceList.ui @@ -0,0 +1,3443 @@ + + + P00DeviceList + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=0 + + + + + + 0 + -1 + 1920 + 1080 + + + + + + + ../image/DeviceList.png + + + + + + 91 + 97 + 450 + 481 + + + + + + + circuit=0, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=0, Action=SetPage1+SetCircuit0+SetBinding0,SelectImag=IM00_01B.png + + + + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas0=camera0 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper + m01_SwitchStatus_0 + m02_SwitchType_0 + m03_AlarmMessage_0 + m04_Voltage + m05_Power + m06_Current + m07_Electricity + Ls01 + Ls01_2 + Ls01_3 + Ls01_4 + m03_CarMessage_7 + Video0 + + + + + 546 + 97 + 450 + 481 + + + + + + + circuit=1, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=1, Action=SetPage1+SetCircuit1+SetBinding1,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas1=camera1 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_2 + m01_SwitchStatus_1 + m02_SwitchType_1 + m03_AlarmMessage_1 + m04_Voltage_2 + m05_Power_2 + m06_Current_2 + m07_Electricity_2 + Ls01_5 + Ls01_6 + Ls01_7 + Ls01_8 + m03_CarMessage_8 + Video0_1 + + + + + 1001 + 97 + 450 + 481 + + + + + + + circuit=2, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=2,Action=SetPage1+SetCircuit2+SetBinding2,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas2=camera2 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_3 + m01_SwitchStatus_2 + m02_SwitchType_2 + m03_AlarmMessage_2 + m04_Voltage_3 + m05_Power_3 + m06_Current_3 + m07_Electricity_3 + Ls01_9 + Ls01_10 + Ls01_11 + Ls01_12 + m03_CarMessage_9 + Video0_2 + + + + + 1456 + 97 + 450 + 481 + + + + + + + circuit=3, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=3, Action=SetPage1+SetCircuit3+SetBinding3,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas3=camera3 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_4 + m01_SwitchStatus_3 + m02_SwitchType_3 + m03_AlarmMessage_3 + m04_Voltage_4 + m05_Power_4 + m06_Current_4 + m07_Electricity_4 + Ls01_13 + Ls01_14 + Ls01_15 + Ls01_16 + m03_CarMessage_10 + Video0_3 + + + + + 91 + 583 + 450 + 481 + + + + + + + circuit=4, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=4, Action=SetPage1+SetCircuit4+SetBinding4,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas4=camera4 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_5 + m01_SwitchStatus_4 + m02_SwitchType_4 + m03_AlarmMessage_4 + m04_Voltage_5 + m05_Power_5 + m06_Current_5 + m07_Electricity_5 + Ls01_17 + Ls01_18 + Ls01_19 + Ls01_20 + m03_CarMessage_11 + Video0_4 + + + + + 546 + 583 + 450 + 481 + + + + + + + circuit=5, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=5, Action=SetPage1+SetCircuit5+SetBinding5,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas5=camera5 + + + + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_6 + m01_SwitchStatus_5 + m02_SwitchType_5 + m03_AlarmMessage_5 + m04_Voltage_6 + m05_Power_6 + m06_Current_6 + m07_Electricity_6 + Ls01_21 + Ls01_22 + Ls01_23 + Ls01_24 + m03_CarMessage_12 + Video0_5 + + + + + 1001 + 583 + 450 + 481 + + + + + + + circuit=6, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=6, Action=SetPage1+SetCircuit6+SetBinding6,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas6=camera6 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_7 + m01_SwitchStatus_6 + m02_SwitchType_6 + m03_AlarmMessage_6 + m04_Voltage_7 + m05_Power_7 + m06_Current_7 + m07_Electricity_7 + Ls01_25 + Ls01_26 + Ls01_27 + Ls01_28 + m03_CarMessage_13 + Video0_6 + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 3 + 72 + 144 + + + + Index=7, Action=SetPage5,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + 10 + 152 + 72 + 144 + + + + Index=7, Action=SetPage5_1,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 100 + 10 + 431 + 61 + + + + + 15 + + + + + + + border:none; + + + + + + border:none; + + + + + 0 + 10 + 411 + 41 + + + + + Microsoft YaHei UI + 22 + false + false + + + + System=DateTime, Action=ModifySystem, Index=8,main=1,SelectImag=SR_001.png + + + color: rgb(166, 215, 236); +font: 22pt "Microsoft YaHei UI"; + + + 2024-5-18 + + + + + + + 1455 + 583 + 450 + 481 + + + + + + + circuit=7, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=7, Action=SetPage11+SetCircuit7+SetBinding7,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 70 + 105 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P01DeviceMenu.ui b/QT5_Project/KD_ZM_8_XCF/UI/P01DeviceMenu.ui new file mode 100644 index 0000000..ccf9c28 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P01DeviceMenu.ui @@ -0,0 +1,339 @@ + + + P01DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=1 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage2+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage3+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage4+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage7+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage6+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage8+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P02DataView.ui b/QT5_Project/KD_ZM_8_XCF/UI/P02DataView.ui new file mode 100644 index 0000000..5e7a3c0 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P02DataView.ui @@ -0,0 +1,1004 @@ + + + P02DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=2 + + + + + PreferDefaultHinting + + + + + + + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + true + + + + 0 + 0 + 1920 + 1080 + + + + + false + PreferDefaultHinting + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../image/DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + PreferDefaultHinting + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 300 + 276 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 80 + 277 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=15000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 330 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 385 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 440 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Io, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 300 + 330 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 300 + 386 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 300 + 440 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Uo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 274 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 331 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 388 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 442 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosf, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 86 + 497 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + R, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 300 + 496 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=AngleUoIo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 531 + 494 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 100 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Aup, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 310 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bup, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 520 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cup, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 100 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Adown, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 310 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bdown, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 520 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cdown, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 104 + 40 + 161 + 171 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM02_SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 260 + 40 + 141 + 171 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM02_SwitchType_%d.png, Timeout=15000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + PreferDefaultHinting + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P03SwitchAction.ui b/QT5_Project/KD_ZM_8_XCF/UI/P03SwitchAction.ui new file mode 100644 index 0000000..7a6ed76 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P03SwitchAction.ui @@ -0,0 +1,468 @@ + + + P03SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=3 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/SwitchAction.png + + + + + false + + + + 295 + 190 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 374 + 189 + 1141 + 811 + + + + + + + main=1 + + + border:none; + + + + + + + + 60 + 484 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 60 + 582 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 487 + 583 + 246 + 84 + + + + CarRetreat,Index=6,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 487 + 483 + 246 + 84 + + + + CarForward,Index=5,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 77 + 150 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 60 + 681 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 150 + 114 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=15000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 650 + 150 + 441 + 241 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::Box + + + + + + + + + 856 + 485 + 246 + 84 + + + + Index=7, Action=SetPage1,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + + 690 + 114 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=15000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + + + + 144 + 320 + 173 + 69 + + + + + Arial + 12 + + + + SwitchType, ImageValue=SwitchType_%d.png, Timeout=10000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P04ParamSet.ui b/QT5_Project/KD_ZM_8_XCF/UI/P04ParamSet.ui new file mode 100644 index 0000000..947910b --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P04ParamSet.ui @@ -0,0 +1,1948 @@ + + + P04ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=4 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=额定电流,Timeout=15000, SelectImag=P4_ParaSelect.png, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=短路倍数, Format=%04.2f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=短路延时,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIa, Action=Modify, Index=11, Caption=Ia 校正, Format=%05.1f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIb, Action=Modify, Index=12, Caption=Ib 校正, Format=%05.1f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIc, Action=Modify, Index=13, Caption=Ic 校正, Format=%05.1f, Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=15000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + KD.Io, Index=2, Action=Modify,Format=%05.1f,Caption=零序电流, Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + KD.Uo, Index=2, Action=Modify,Format=%04.0f,Caption=零序电压, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=3, Format=%03.0f, Caption=漏电延时,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=4, Format=%05.1f, Caption=串联电阻,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=5, Format=%05.1f, Caption=闭锁电阻,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUo, Action=Modify, Index=6, Format=%05.1f, Caption=Uo校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIo, Action=Modify, Index=7, Format=%05.1f, Caption=Io校正值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MeasureV, Index=8, Alias=alias_measure_v, Action=Modify, Caption=检测电压,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLeakageTrip, Action=Modify, Index=9, Format=%04.1f, Caption=漏电投入延时,Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectPhaseSensitivity, Index=2, Alias=alias_bool, Action=Modify, Caption=相敏保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTubeAdhesion, Index=12, Alias=alias_bool, Action=Modify, Caption=真空管粘连保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 820 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=12, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=15000, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + Protect_14 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + Qt::NoFocus + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 174 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_5 + sys_P00_4 + sys_P00_3 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/ParamSet.png + + + P04BG + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + groupBox + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P05CameraView.ui b/QT5_Project/KD_ZM_8_XCF/UI/P05CameraView.ui new file mode 100644 index 0000000..ca8b622 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P05CameraView.ui @@ -0,0 +1,656 @@ + + + P05CameraView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=5 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/CameraView.png + + + + + + 0 + 100 + 85 + 960 + + + + + + + + + + border:none; + + + + + + + + 8 + 2 + 72 + 144 + + + + Index=9, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 380 + 124 + 1165 + 720 + + + + canvas0=camera0, Timeout=15000 + + + TextLabel + + + + + + 200 + 120 + 111 + 41 + + + + + 黑体 + -1 + + + + color: rgb(177, 229, 252); font-size: 35px; + + + 回路1 + + + Qt::AlignCenter + + + + + + 90 + 890 + 1821 + 171 + + + + + + + + + + border:none; + + + + + + + + 236 + 5 + 220 + 159 + + + + Index=2, Action=canvas0_camera1, SelectImag=IM05_A2.png + + + + + + + + + + 450 + 876 + + + + + + + 10 + 5 + 220 + 159 + + + + Index=1, Action=canvas0_camera0, SelectImag=IM05_A1.png + + + + + + + + + + 450 + 876 + + + + + + + 462 + 5 + 220 + 159 + + + + Index=3, Action=canvas0_camera2, SelectImag=IM05_A3.png + + + + + + + + + + 450 + 876 + + + + + + + 688 + 5 + 220 + 159 + + + + Index=4, Action=canvas0_camera3, SelectImag=IM05_A4.png + + + + + + + + + + 450 + 876 + + + + + + + 914 + 5 + 220 + 159 + + + + Index=5, Action=canvas0_camera4, SelectImag=IM05_A5.png + + + + + + + + + + 450 + 876 + + + + + + + 1140 + 5 + 220 + 159 + + + + Index=6, Action=canvas0_camera5, SelectImag=IM05_A6.png + + + + + + + + + + 450 + 876 + + + + + + + 1366 + 5 + 220 + 159 + + + + Index=7, Action=canvas0_camera6, SelectImag=IM05_A7.png + + + + + + + + + + 450 + 876 + + + + + + + 1592 + 5 + 220 + 159 + + + + Index=8, Action=canvas0_camera7, SelectImag=IM05_A8.png + + + + + + + + + + 450 + 876 + + + + + + + 12 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas1=camera0, Timeout=15000 + + + + + + QFrame::NoFrame + + + + + + Qt::AutoText + + + background/IM05_002.png + + + false + + + Qt::AlignCenter + + + + + + 238 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas2=camera1, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 464 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas3=camera2, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 690 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas4=camera3, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 916 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas5=camera4, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 1142 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas6=camera5, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 1368 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas7=camera6, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 1594 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas8=camera7, Timeout=15000 + + + + + + background/IM05_002.png + + + Canvas08 + Canvas07 + Canvas06 + Canvas05 + Canvas04 + Canvas03 + Canvas02 + Canvas01 + Btn02 + Btn01 + Btn03 + Btn04 + Btn05 + Btn06 + Btn07 + Btn08 + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P05_01_FaceCameraView.ui b/QT5_Project/KD_ZM_8_XCF/UI/P05_01_FaceCameraView.ui new file mode 100644 index 0000000..9578a15 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P05_01_FaceCameraView.ui @@ -0,0 +1,307 @@ + + + P05CameraView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=5_1 + + + + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + + + + border:none; + + + + + + + + 8 + 2 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 0 + 570 + 1291 + 381 + + + + + + + + + + border:none; + + + + + + false + + + + + 550 + 0 + 211 + 41 + + + + + + + background-color: rgb(0, 0, 0); +color: rgb(170, 0, 0); + + + 日志 + + + + 72 + 144 + + + + + + + 40 + 40 + 1111 + 321 + + + + + + + + 410 + 10 + 481 + 561 + + + + + + + USB 视频流 + + + + + 70 + 50 + 360 + 480 + + + + + 360 + 480 + + + + QFrame::Box + + + QFrame::Sunken + + + 未打开 + + + Qt::AlignCenter + + + + + + 200 + 20 + 80 + 23 + + + + Index=0 + + + 打开视频 + + + + + + + 260 + 20 + 109 + 551 + + + + + + + 命令 + + + + + 12 + 30 + 80 + 23 + + + + Index=0, Action=Reset,SelectImag=IMxx_00F.png + + + 复位 + + + + + + 12 + 59 + 80 + 23 + + + + Index=0, Action=Videomode,SelectImag=IMxx_00F.png + + + 视频模式 + + + + + + 12 + 88 + 85 + 21 + + + + + + + 显示人脸框 + + + + + + 12 + 115 + 80 + 23 + + + + Index=0, Action=Verify,SelectImag=IMxx_00F.png + + + 识别 + + + + + + 12 + 144 + 80 + 23 + + + + Index=0, Action=Enroll,SelectImag=IMxx_00F.png + + + ITG注册 + + + + + + 12 + 173 + 80 + 23 + + + + Index=0, Action=Users,SelectImag=IMxx_00F.png + + + 用户管理 + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P06FaultQuery.ui b/QT5_Project/KD_ZM_8_XCF/UI/P06FaultQuery.ui new file mode 100644 index 0000000..1c1dbce --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P06FaultQuery.ui @@ -0,0 +1,708 @@ + + + P06FaultQuery + + + + 0 + 0 + 1920 + 1076 + + + + MainWindow + + + Page=6 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 48 + 412 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 267 + 412 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 485 + 412 + 85 + 169 + + + + Index=4, Action=SetPage1, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 260 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 152 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 330 + 160 + 361 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 30 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P07SystemSet.ui b/QT5_Project/KD_ZM_8_XCF/UI/P07SystemSet.ui new file mode 100644 index 0000000..28b135a --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P07SystemSet.ui @@ -0,0 +1,932 @@ + + + P07SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=7 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 84 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SwitchType, Action=Modify, Index=1, Alias=alias_switch_type, Caption=开关类型,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 144 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 198 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 253 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 308 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 364 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 418 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 475 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 530 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CarAlarmDelay, Action=Modify, Index=9, Format=%05.1f, Caption=小车报警延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 583 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + OffVoltageDelay, Action=Modify, Index=10, Format=%06.1f, Caption=断电延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 640 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TubeDelay, Action=Modify, Index=11, Format=%06.2f, Caption=真空管粘连延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 750 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=13,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 805 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=14,SelectImag=P4_ParaSelect.png, password,groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + 270 + 695 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LoadSelect, Action=Modify, Index=12, Alias=alias_select, Caption=负载选择,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=15000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 25 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/SystemSet.png + + + P07BG + groupBox_2 + groupBox_sys_2 + indicator_Label + groupBox + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P08FieldTestAction.ui b/QT5_Project/KD_ZM_8_XCF/UI/P08FieldTestAction.ui new file mode 100644 index 0000000..8c7f6d1 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P08FieldTestAction.ui @@ -0,0 +1,391 @@ + + + P08FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=8 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/FieldTestAction.png + + + + + false + + + + 300 + 170 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 260 + 681 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 45 + 215 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 46 + 330 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 393 + 220 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 392 + 330 + 246 + 84 + + + + Index=5, Action=SetPage1,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + 422 + 95 + 173 + 69 + + + + + Arial + 12 + + + + SwitchType, ImageValue=SwitchType_%d.png, Timeout=15000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 365 + 60 + 291 + 41 + + + + + 黑体 + 16 + + + + true + + + + + + AlarmMessage,Timeout=15000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + + + + false + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 154 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 678 + 319 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P11LightDeviceMenu.ui b/QT5_Project/KD_ZM_8_XCF/UI/P11LightDeviceMenu.ui new file mode 100644 index 0000000..f1da380 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P11LightDeviceMenu.ui @@ -0,0 +1,339 @@ + + + P11DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=11 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage12+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage13+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage14+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage17+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage16+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage18+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P12LightDataView.ui b/QT5_Project/KD_ZM_8_XCF/UI/P12LightDataView.ui new file mode 100644 index 0000000..f77d7c3 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P12LightDataView.ui @@ -0,0 +1,573 @@ + + + P12DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=12 + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + + 340 + 10 + 391 + 16 + + + + cameral_url=canvas1 + + + + + + + + + 750 + 10 + 411 + 16 + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../Light_image/Light_DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 304 + 500 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 500 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=15000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 575 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 650 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 305 + 574 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 305 + 650 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 520 + 570 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ro, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 531 + 494 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 90 + 120 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + CameralUrlLabel + CameralUrlLabel_2 + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P13LightSwitchAction.ui b/QT5_Project/KD_ZM_8_XCF/UI/P13LightSwitchAction.ui new file mode 100644 index 0000000..334b755 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P13LightSwitchAction.ui @@ -0,0 +1,345 @@ + + + P13SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=13 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Ligth_SwitchAction.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 150 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 290 + 180 + 1300 + 781 + + + + + + + main=1 + + + border:none; + + + + + + + + 147 + 490 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 411 + 493 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 500 + 170 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 674 + 493 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 581 + 98 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=15000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 940 + 490 + 246 + 84 + + + + Index=7, Action=SetPage11,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + false + + + + 0 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备照明 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P14LightParamSet.ui b/QT5_Project/KD_ZM_8_XCF/UI/P14LightParamSet.ui new file mode 100644 index 0000000..bbbb45e --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P14LightParamSet.ui @@ -0,0 +1,1734 @@ + + + P14ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=14 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=照明额定电流,Timeout=15000, SelectImag=P4_ParaSelect.png, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=照明短路倍数, Format=%04.2f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=照明短路延时,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIs, Action=Modify, Index=11, Caption=Is 校正, Format=%05.1f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentIs, Action=Modify, Index=12, Caption=信号Ie Format=%05.2f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortIs, Action=Modify, Index=13, Caption=信号短路倍数, Format=%05.2f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 825 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentB, Index=14, Alias=alias_current, Action=Modify, Caption=B相电流, Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=15000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=1, Format=%03.0f, Caption=漏电延时,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=2, Format=%05.1f, Caption=串联电阻,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=3, Format=%05.1f, Caption=闭锁电阻,Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectIsShort, Index=2, Alias=alias_bool, Action=Modify, Caption=信号短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=13, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=15000, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_ParamSet.png + + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P16LightFaultQuery.ui b/QT5_Project/KD_ZM_8_XCF/UI/P16LightFaultQuery.ui new file mode 100644 index 0000000..79835c8 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P16LightFaultQuery.ui @@ -0,0 +1,637 @@ + + + P16FaultQuery + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=16 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Ligth_FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 51 + 410 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 270 + 410 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 488 + 410 + 85 + 169 + + + + Index=4, Action=SetPage11, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 7 + 149 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 320 + 170 + 421 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 20 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P17LightSystemSet.ui b/QT5_Project/KD_ZM_8_XCF/UI/P17LightSystemSet.ui new file mode 100644 index 0000000..a34dfae --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P17LightSystemSet.ui @@ -0,0 +1,792 @@ + + + P17SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=17 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 100 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Temperature, Action=Modify, Index=1, Format=%03.0f, Caption=温度设定,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 155 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 210 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 265 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 320 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 375 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 430 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 485 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 540 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=9,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 595 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=10,SelectImag=P4_ParaSelect.png, password,groupend=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=15000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_SystemSet.png + + + P07BG + groupBox + groupBox_2 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UI/P18LightFieldTestAction.ui b/QT5_Project/KD_ZM_8_XCF/UI/P18LightFieldTestAction.ui new file mode 100644 index 0000000..2f8dd09 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UI/P18LightFieldTestAction.ui @@ -0,0 +1,345 @@ + + + P18FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=18 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_FieldTestAction.png + + + + + false + + + + 290 + 174 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 280 + 691 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 53 + 243 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 53 + 357 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 400 + 248 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 365 + 135 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=15000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 79 + 93 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 400 + 357 + 246 + 84 + + + + Index=5, Action=SetPage11,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 153 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 4 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/KD_ZM_8_XCF/UIFrameWork.py b/QT5_Project/KD_ZM_8_XCF/UIFrameWork.py new file mode 100644 index 0000000..3e98499 --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/UIFrameWork.py @@ -0,0 +1,1679 @@ +# This Python file uses the following encoding: utf-8 +import sys +import os +import time +import inspect +import cv2 +import json +from itertools import chain +from PyQt5 import uic +from PyQt5.QtGui import QImage, QPixmap, QColor,QBrush, QKeySequence, QIcon, QPalette +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent, QSize, QDateTime +from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QWidget, QLayout, QLabel +from PyQt5.QtWidgets import QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from Shared_CODE.DialogModifyValue import DialogModifyValue +from Shared_CODE.DialogModifyAlias import DialogModifyAlias +from Shared_CODE.DialogModifyText import DialogModifyText +from Shared_CODE.DialogInform import DialogInform +from Shared_CODE.DialogFaceView import UserManageDialog, VerifyDialog + +from Shared_CODE.get_tip_prop import * +from print_color import * +import time +from PyQt5.QtCore import QDateTime +import re +from datetime import datetime +import platform +import subprocess +from typing import Callable, Optional +# sys.path.append(sys.path[0] + "/../..") +# sys_path = sys.path[0].replace("\\", "/") +import serial +import serial.tools.list_ports + +from Shared_CODE.FaceRecognitionProtocol import ( + build_reset, build_uvc_view, build_face_view, build_verify, + build_enroll_itg_single, build_delete_all, build_get_all_userid, + build_delete_user, unpack_frame, parse_reply, parse_note, + MID_REPLY, MID_NOTE, CMD_ENROLL, CMD_ENROLL_ITG +) + +# 设置 img 目录的路径 +img_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'background')) + + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#31D19E").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() +COLOR_VALUE_NORMAL = QColor("#31D19E").name() + +ALIAS_QUERY_NONE = 0 +ALIAS_QUERY_WAIT_RESPOINSE = 1 + + + + +#设置系统时间 + +def is_linux(): + return platform.system() == 'Linux' + +def set_system_time(year, month, day, hour, minute, second): + if is_linux(): + try: + new_time = datetime(year, month, day, hour, minute, second).strftime("%Y-%m-%d %H:%M:%S") + subprocess.run(f'sudo timedatectl set-time "{new_time}"', shell=True, check=True) + print(f"System time updated to {new_time}") + except subprocess.CalledProcessError as e: + print(f"Failed to update system time: {e}") + else: + import ctypes + import ctypes.wintypes + + TIME_ZONE_ID_UNKNOWN = 0 + TIME_ZONE_ID_STANDARD = 1 + TIME_ZONE_ID_DAYLIGHT = 2 + + class SYSTEMTIME(ctypes.Structure): + _fields_ = [ + ("wYear", ctypes.wintypes.WORD), + ("wMonth", ctypes.wintypes.WORD), + ("wDayOfWeek", ctypes.wintypes.WORD), + ("wDay", ctypes.wintypes.WORD), + ("wHour", ctypes.wintypes.WORD), + ("wMinute", ctypes.wintypes.WORD), + ("wSecond", ctypes.wintypes.WORD), + ("wMilliseconds", ctypes.wintypes.WORD), + ] + + system_time = SYSTEMTIME() + ctypes.windll.kernel32.GetSystemTime(ctypes.byref(system_time)) + + system_time.wYear = year + system_time.wMonth = month + system_time.wDay = day + system_time.wHour = hour + system_time.wMinute = minute + system_time.wSecond = second + ctypes.windll.kernel32.SetSystemTime(ctypes.byref(system_time)) + print(f"System time updated to {year}-{month:02d}-{day:02d} {hour:02d}:{minute:02d}:{second:02d}") +def set_screen_blanking_time(minutes): + """ + 设置屏幕黑屏时间:param minutes: 屏幕黑屏时间,以分钟为单位 + """ + if is_linux(): + # 如果是 Linux 系统,使用 xfconf-query 命令设置 Xfce 的屏幕黑屏时间 + try: + # Xfce 的屏幕黑屏时间是以秒为单位 + seconds = int(minutes) * 60 + subprocess.run([ + 'xfconf-query', '-c', 'xfce4-power-manager', + '-p', '/xfce4-power-manager/blank-on-ac', + '-s', str(seconds), '-t', 'int', '--create' + ], check=True) + print(f"Xfce屏幕黑屏时间设置为 {minutes} 分钟") + except subprocess.CalledProcessError as e: + print(f"设置Xfce屏幕黑屏时间失败: {e}") + except FileNotFoundError: + print("xfconf-query 命令未找到,请确保已安装 xfce4-power-manager。") + elif platform.system() == 'Windows': + # 如果是 Windows 系统,使用 powercfg 命令设置屏幕黑屏时间 + try: + # 设置交流电源时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-ac', str(minutes)], check=True) + # 设置电池供电时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-dc', str(minutes)], check=True) + print(f"屏幕黑屏时间设置为 {minutes} 分钟 (适用于交流电和电池供电)") + except subprocess.CalledProcessError as e: + print(f"设置屏幕黑屏时间失败: {e}") + else: + print("当前操作系统不支持此操作。") + +def json_load_message(message) : + json_dict = {} + if isinstance(message, bytes) : + json_dict = json.loads(message.decode('utf-8')) + elif isinstance(message, str) : + json_dict = json.loads(message.encode('utf-8')) + else : + json_dict = json.loads(message) + return json_dict + +def modify_style_sheet(type_name : str, origin_style_sheet : str, lead_str : str, value_str : str) : + if len(value_str) == 0 : + new_style_items = "" + else : + new_style_items = "%s:%s;"%(lead_str, value_str) + style_splits = origin_style_sheet.split("{") + if len(style_splits) == 1 : + style_items_str = style_splits[0] + elif len(style_splits) == 2 : + style_items_str = style_splits[1] + else : + style_items_str = "" + style_items_str = style_items_str.replace("}", "") + + prop_splits = style_items_str.split(";") + for each_style_prop in prop_splits : + if lead_str in each_style_prop : + key_value_splits = each_style_prop.split(":") + cmp_str = key_value_splits[0] + cmp_str = cmp_str.replace(" ", "") + cmp_str = cmp_str.replace("\n", "") + if lead_str == cmp_str : + continue + + if len(each_style_prop) > 0 : + new_style_items += each_style_prop + new_style_items += ";" + + if len(type_name) == 0: + return "%s"%(new_style_items) + else : + return "%s {%s}"%(type_name, new_style_items) + +def get_key_combine_str(str1, str2) : + return str1 + "," + str2 + +def search_circuit_from_topic(topic : str) : + circuit_id = -1 + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name in topic : + circuit_id = config_circuit_id + break + if circuit_id >= 0 : + break + return circuit_id + +def get_imag_value_file_name(tip_str : str, value : int) : + file_name = get_tip_value_str(tip_str, "ImageValue", default_string = None) + try : + if isinstance(value, str) : + fvalue = float(value) + value_id = round(fvalue) + else : + value_id = value + except Exception as e : + return None + + if file_name != None : + file_name_with_value = file_name%(value_id) + imag_value_file_name = os.path.join(img_path, file_name_with_value) + else : + imag_value_file_name = None + + if imag_value_file_name != None : + if os.path.exists(imag_value_file_name) : + return imag_value_file_name.replace("\\", "/") + return None + +def get_imag_file_name(tip_str : str, key_imag : str, default_string = None) : + file_name = get_tip_value_str(tip_str, key_imag, default_string) + select_image_file_name = None + if file_name != None : + select_image_file_name = os.path.join(img_path, file_name) + if os.path.exists(select_image_file_name) : + return select_image_file_name.replace("\\", "/") + return None + +def get_select_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectImag", default_string = None) + +def get_select_icon_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectIcon", default_string = None) + +def get_bk_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageBackGround", default_string = None) + +def get_indicator_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageIndicator", default_string = None) + +def get_compare_index(main_index : int, sub_index : int) : + return (main_index + 1) * 64 + sub_index + +class SerialWorker(QThread): + frame_received = pyqtSignal(dict) + log_message = pyqtSignal(str) + + def __init__(self, ser_getter: Callable[[], Optional[serial.Serial]]): + super().__init__() + self.ser_getter = ser_getter + self._running = True + self.buf = b"" + + def run(self): + self.log("[INFO] 串口线程运行") + while self._running: + ser = self.ser_getter() + if not ser or not getattr(ser, 'is_open', False): + time.sleep(0.2) + continue + try: + data = ser.read(ser.in_waiting or 1) + if data: + self.buf += data + while True: + fr, used = unpack_frame(self.buf) + if not fr: + break + self.buf = self.buf[used:] + self.frame_received.emit(fr) + except (serial.SerialException, OSError) as e: + self.log(f"[WARN] 串口异常挂起: {e}") + try: + ser.close() + except Exception: + pass + time.sleep(0.5) + except Exception as e: + self.log(f"[ERR] read: {e}") + time.sleep(0.1) + + def stop(self): + self._running = False + + def log(self, s: str): + self.log_message.emit(s) + +class VideoWorker(QThread): + pixmap_ready = pyqtSignal(QPixmap) + log_message = pyqtSignal(str) + + def __init__(self, cam_index=0, target_size=QSize(360,480)): + super().__init__() + self.cam_index = cam_index + self.target_size = target_size + self._running = True + self.cap = None + + def run(self): + try: + self.log_message.emit(f"[INFO] 尝试打开摄像头 {self.cam_index} ...") + if sys.platform.startswith("win"): + self.cap = cv2.VideoCapture(self.cam_index, cv2.CAP_DSHOW) + else: + self.cap = cv2.VideoCapture(self.cam_index) + if not self.cap or not self.cap.isOpened(): + self.log_message.emit(f"[ERR] 无法打开摄像头 index={self.cam_index}") + return + self.log_message.emit(f"[INFO] 摄像头 {self.cam_index} 已打开") + + while self._running: + ret, frame = self.cap.read() + if not ret: + time.sleep(0.03) + continue + frame = cv2.rotate(frame, cv2.ROTATE_90_CLOCKWISE) + frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) + h,w,ch = frame.shape + img = QImage(frame.data, w, h, ch*w, QImage.Format_RGB888) + pm = QPixmap.fromImage(img).scaled( + self.target_size, Qt.KeepAspectRatio, Qt.SmoothTransformation + ) + self.pixmap_ready.emit(pm) + time.sleep(0.03) + finally: + if self.cap: + self.cap.release() + self.log_message.emit("[INFO] 摄像头已关闭") + + def stop(self): + self._running = False + + def log(self, s: str): + self.log_message.emit(s) + +class UIFrameWork(QMainWindow, class_comm_mqtt_interface): + mqtt_signal : pyqtSignal = pyqtSignal(str) + + def __init__(self): + QMainWindow.__init__(self) + self.topic_message_list : list = [] + self.mutex : QMutex = QMutex() + + self.mqtt_signal.connect(self.mqtt_topic_message_process) + self.menu_list = [] + self.sort_menu_list = [] + self.menu_key_index = 0 + self.key_active = 0 + self.select_object : QWidget = None + self.wait_response_list = [] + self.mqtt_thread : class_comm_mqtt_thread= None + + self.mqtt_value_dict = {} + + self.widget_timeout_list = [] + + self.alias_dict = {} + self.alias_query_timer : QTimer = None + + self.alias_query_timer = QTimer() + self.alias_query_timer.timeout.connect(self.process_alias_query) + self.alias_query_timer.start(3000) + + self.video_visible_timer = QTimer() + self.video_visible_timer.timeout.connect(self.video_visible_timeout) + self.video_visible_timer.start(200) + + self.time_timer = QTimer() + self.time_timer.timeout.connect(self.flush_system_cycle) + self.time_timer.start(500) + + self.canvas_visible_arr = [ + False, + False, + False, + False, + False, + False, + False, + False, + False, + ] + + # 使用列表推导式动态生成 canvas_label_list + self.canvas_label_list = [[None, -1, None] for _ in range(9)] + # 使用列表推导式动态生成 set_video_image_func_arr + self.set_video_image_func_arr = [getattr(self, f'set_video_image_{i}') for i in range(9)] + + self.page = -1 + self.select_main_index = -1 + self.exist_circuit_mask = 0 + + self.check_widget_timeout_timer : QTimer = None + + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_0), self, activated=self.key_Test_process0) + QShortcut(QKeySequence(Qt.Key_1), self, activated=self.key_Test_process1) + QShortcut(QKeySequence(Qt.Key_2), self, activated=self.key_Test_process2) + QShortcut(QKeySequence(Qt.Key_3), self, activated=self.key_Test_process3) + self.bind_channel = -1 + + #虚函数, 切换到本页面时调用 + def virtual_on_page_enter(self) : + pass + + #虚函数, 退出到本页面时调用 + def virtual_on_page_leave(self) : + pass + + #虚函数, 切换到页面, 需要在派生类中实现, page=-1表示退出到上一级菜单 + def virtual_change_to_page(self, page) : + pass + + #虚函数, 画布连接到摄像头, 需要在派生类中实现。 + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + pass + + #虚函数, action处理函数, 派生类可以额外处理 + def virtual_widget_action_process(self, widget : QObject, action : str) : + return + + def set_mqtt_value(self, circuit : int, mqtt_name : str, mqtt_value) : + key = f'{circuit}+{mqtt_name}' + self.mqtt_value_dict[key] = mqtt_value + + def get_mqtt_value(self, circuit : int, mqtt_name : str) : + key = f'{circuit}+{mqtt_name}' + if key in self.mqtt_value_dict.keys() : + return self.mqtt_value_dict[key] + return None + + def modify_object_style_sheet(self, object :QWidget, lead_str : str, value_str : str) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.styleSheet() + new_style_sheet = modify_style_sheet(object_type_name, origin_style, lead_str, value_str) + object.setStyleSheet(new_style_sheet) + + def reset_object_style_sheet(self, object :QWidget) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.whatsThis() + object.setStyleSheet(origin_style) + + def load_window_ui(self, file_window_ui : str) : + if os.path.exists(file_window_ui): + uic.loadUi(file_window_ui, self) + self.load_resource_bitmap() + self.create_menu_list() + self.sort_menu_list = sorted(self.menu_list, key=lambda x: x[0]) + self.create_style_sheet_backup() + self.create_timeout_list() + self.create_alias_list() + self.update_window_circuit_mask() + self.exist_circuit_mask = self.get_circuit_mask() + self.check_widget_timeout_timer : QTimer = QTimer() + self.check_widget_timeout_timer.timeout.connect(self.process_widget_timeout_list) + self.check_widget_timeout_timer.start(100) + self.page = get_tip_page(self.statusTip()) + self.menu_selectable_object_flush() + + def get_circuit_mask(self, child_widget : QWidget = None) : + widget :QWidget = child_widget + if widget == None : + widget = self + circuit_id_mask = 0 + + for each_object in widget.children(): + child : QWidget = each_object + if hasattr(child, "statusTip") : + circuit_id = self.get_circuit_from_object(child) + if circuit_id >= 0 : + circuit_id_mask |= (0x01 << circuit_id) + circuit_id_mask |= self.get_circuit_mask(child) + return circuit_id_mask + + def update_window_circuit_mask(self) : + self.exist_circuit_mask = self.get_circuit_mask() + return + + def set_menu_main_index(self, main_index) : + self.main_index = main_index + if len(self.sort_menu_list) == 0 : + return + if self.main_index < 0 : + self.menu_key_index = 0 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + return + menu_key_index = 0 + for each_item in self.sort_menu_list : + compare_index = each_item[0] + if compare_index >= get_compare_index(main_index, 0) : + break + menu_key_index += 1 + self.menu_key_index = menu_key_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def process_alias_query(self): + if not self.mqtt_thread: + return # 如果没有 MQTT 线程,直接返回 + + for alias_unique_name, alias_value_dict in self.alias_dict.items(): # {"xxxxx,sss": 123} + if not isinstance(alias_value_dict, int) or alias_value_dict != ALIAS_QUERY_NONE: + continue # 仅处理需要查询的整数别名 + + alias_name, uniqe_name = alias_unique_name.split(",") + + # 初始化 select_object 变量 + select_object: QWidget = None + + # 将别名的值设置为等待响应状态 + self.alias_dict[alias_unique_name] = ALIAS_QUERY_WAIT_RESPOINSE + + # 发布 MQTT 消息并等待响应 + self.mqtt_publish_and_wait_response( + f"request/alias/{uniqe_name}", + json.dumps({"name": alias_name}), + select_object, + 2000, + False + ) + + def process_widget_timeout_list(self) : + list_index = 0 + for timeout_items in self.widget_timeout_list: + time_limit = timeout_items[0] + cur_time = timeout_items[1] + cur_time += 100 + if cur_time >= time_limit: + cur_time = 0 + timeout_widget : QWidget = timeout_items[2] + if isinstance(timeout_widget, QLineEdit) : + lineedit_widget : QLineEdit = timeout_widget + lineedit_widget.setText("通信超时") + elif isinstance(timeout_widget, QLabel) : + label_widget : QLabel = timeout_widget + if "canvas" in label_widget.statusTip() : + self.camera_signal_timeout(label_widget) + else : + if label_widget.isVisible() : + label_widget.setVisible(False) + #label_widget.hide() + elif isinstance(timeout_widget, QPushButton) : + button_widget : QPushButton = timeout_widget + self.reset_object_style_sheet(button_widget) + button_widget.setText("通信超时") + timeout_items[1] = cur_time + self.widget_timeout_list[list_index] = timeout_items + list_index = list_index + 1 + + def reset_widget_timeout(self, widget : QObject) : + Index = 0 + for timeout_item in self.widget_timeout_list: + cur_time = timeout_item[1] + timeout_widget : QWidget = timeout_item[2] + if timeout_widget == widget : + timeout_item[1] = 0 + self.widget_timeout_list[Index] = timeout_item + break + Index = Index + 1 + + + def connect_camera_thread(self, camera_thread : CameraThread, canvas_id : int = 0, is_visible : bool = True) : + if camera_thread == None or canvas_id < 0: + return + if canvas_id < len(self.set_video_image_func_arr) : + canvas_object : QLabel = self.search_canvas_object(canvas_id) + if canvas_object : + canvas_info_item = self.canvas_label_list[canvas_id] + + origin_camera_thread : CameraThread = canvas_info_item[2] + if origin_camera_thread != None and origin_camera_thread.is_signal_connect: + origin_camera_thread.image_signal.disconnect(self.set_video_image_func_arr[canvas_id]) + + if is_visible : + + camera_thread.signal_connect(self.set_video_image_func_arr[canvas_id]) + + list_index : int = self.get_timeout_List_index(canvas_object) + self.canvas_label_list[canvas_id] = [canvas_object, list_index, camera_thread] + else : + self.canvas_label_list[canvas_id] = [None, -1, None] + + self.canvas_visible_arr[canvas_id] = is_visible + + + + def camera_signal_timeout(self, camera_label : QLabel): + if camera_label != None : + image_path = os.path.join(img_path, 'IM05_002.png') + if os.path.exists(image_path): + image = QPixmap(image_path) + scaled_image = image.scaled(camera_label.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) + camera_label.setPixmap(scaled_image) + + def search_canvas_object(self, canvas_id = 0, child = None) : + widget :QWidget = child + if widget == None : + widget = self + child_count = 0 + for each_object in widget.children(): + child_count += 1 + child : QWidget = each_object + + if hasattr(child, "statusTip") : + tip_str : str = child.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if config_canvas_id >= 0 and config_camera_id >= 0 and config_canvas_id == canvas_id: + if isinstance(child, QLabel) : + return child + + find_canvas_object = self.search_canvas_object(canvas_id, child) + if find_canvas_object != None : + return find_canvas_object + + if child_count == 0 : + return None + + def get_canvas_prop (self, canvas_id : int= 0) : + config_camera_id = -1 + is_face_detect : int = 0 + + canvas_object : QWidget = self.search_canvas_object(canvas_id) + if canvas_object != None : + tip_str : str = canvas_object.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + is_face_detect = get_tip_face_detection(tip_str) + return config_camera_id, is_face_detect + + def load_resource_bitmap(self, child = None) : + widget :QWidget = self + if child != None : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + imag_file_name = get_bk_imag_file_name(tip_str) + if imag_file_name != None : + if isinstance(child_widget, QLabel) : + label_child_object : QLabel = child_widget + label_child_object.setScaledContents(True) + image = QPixmap(imag_file_name) + label_child_object.setPixmap(image) + elif isinstance(child_widget, QWidget) : + file_url = "url(%s)"%(imag_file_name) + self.modify_object_style_sheet(child_widget, "background-image", file_url) + self.load_resource_bitmap(child_widget) + + def create_style_sheet_backup(self, child = None) : + widget :QWidget = child + if child == None : + widget = self + for child_widget in widget.children(): + if hasattr(child_widget, "styleSheet") : + widget : QWidget = child_widget + style_sheet : str = widget.styleSheet() + widget.setWhatsThis(style_sheet) + self.create_style_sheet_backup(child_widget) + + def create_timeout_list(self, child = None) : + widget :QWidget = self + if child == None : + self.widget_timeout_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + timeout_limit_ms = get_tip_timeout(tip_str) + if timeout_limit_ms >= 0: + self.widget_timeout_list.append([timeout_limit_ms, 0, child_widget]) + self.create_timeout_list(child_widget) + + def get_timeout_List_index(self, object : QWidget) : + list_index = -1 + search_list_index = 0 + for items in self.widget_timeout_list : + child_widget : QWidget = items[2] + if child_widget == object : + list_index = search_list_index + break + search_list_index += 1 + return list_index + + def get_page_circuit(self): + if hasattr(self, "statusTip") : + return get_tip_circuit(self.statusTip()) + return -1 + + def set_page_circuit(self, circuit_id = -1) : + if hasattr(self, "statusTip") : + origin_status_tip : str = self.statusTip() + origin_tip_splits = origin_status_tip.split(",") + new_status_tip = "" + for each_str in origin_tip_splits: + if "circuit" not in each_str : + new_status_tip += each_str + new_status_tip += "," + new_status_tip += "circuit=%d"%(circuit_id) + self.setStatusTip(new_status_tip) + self.update_window_circuit_mask() + self.create_alias_list() + self.process_alias_query() + self.para_or_measure_query() + + def create_alias_list(self, child = None) : + widget :QWidget = self + if child == None : + self.alias_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + alias_str = get_tip_alias_str(tip_str) + if alias_str != None: + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None : + key_combine_str = get_key_combine_str(alias_str, unique_name) + if key_combine_str not in self.alias_dict.keys() : + self.alias_dict[key_combine_str] = ALIAS_QUERY_NONE + self.create_alias_list(child_widget) + + def create_menu_list(self, child = None) : + widget :QWidget = self + if child == None : + self.menu_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + sub_index = get_tip_menu_sub_index(tip_str) + if sub_index >= 0: + main_index = self.get_main_index_from_object(child_widget) + if main_index >= 0 : + compare_index = get_compare_index(main_index, sub_index) + else : + compare_index = sub_index + self.menu_list.append([compare_index, child_widget]) + if isinstance(child_widget, QPushButton) : + button : QPushButton = child_widget + button.clicked.connect(self.on_menu_qpush_button_click) + self.create_menu_list(child_widget) + + def on_select_object_action_process(self, select_object : QWidget) : + tip_str = select_object.statusTip() + action_str = get_tip_value_str(tip_str, "Action", None) + if action_str != None : + if "password" in tip_str : + dialog_modify_text = DialogModifyValue(self) + caption_str = "请输入密码:" + dialog_modify_text.update_modify_info("", "0000", caption_str) + input = False + + if dialog_modify_text.exec() == QDialog.Accepted: + input = True + modify_screen_time_str = dialog_modify_text.value + pass_word = system_parameter() + if modify_screen_time_str != pass_word.get_system_password() : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", "密码错误,无法修改!") + return + else: + input = True + if input : + if "CmdExecute" in action_str : + mqtt_name = get_tip_mqtt_name(tip_str) + unique_name = self.get_unique_name_from_object(select_object) + if mqtt_name != None and unique_name != None: + if len(mqtt_name) > 0 and self.mqtt_thread != None: + publish_topic = "request/action/" + unique_name + publish_message = '{"name" : "%s"}'%(mqtt_name) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, select_object, 1000) + elif "ModifySystem" in action_str: + self.on_system_param_modify(tip_str) + elif "Modify" in action_str : + if isinstance(select_object, QLineEdit) : + self.on_line_edit_modify_click(select_object) + elif "Users" in action_str : + UserManageDialog(self, self.sender()).exec_() + elif "Verify" in action_str : + dlg = VerifyDialog(self) + if dlg.exec_() == QDialog.Accepted: + pd_val, timeout_val = dlg.values() + self.send(build_verify(pd_val, timeout_val)) + + self.virtual_widget_action_process(select_object, action_str) + + def search_menu_match_object(self, object) : + match_object : QWidget = None + menu_index = 0 + for each_list in self.sort_menu_list : + search_object = each_list[1] + if search_object == object : + match_object = search_object + break + menu_index += 1 + return match_object, menu_index + + #刷新屏幕上的系统信息, 例如时间日期之类 + def flush_system_info(self, child = None) : + widget : QWidget= child + if child == None : + widget = self + else : + widget = child + + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + system_str = get_tip_system(tip_str) + + if system_str == "DateTime" : + qdate_time = QDateTime.currentDateTime() + time_str = qdate_time.toString("yyyy-MM-dd hh:mm:ss") + + if isinstance(child_widget, QPushButton) : + button_widget : QPushButton = child_widget + button_widget.setText(time_str) + elif isinstance(child_widget, QLineEdit) : + line_edit_widget : QLineEdit = child_widget + line_edit_widget.setText(time_str) + elif isinstance(child_widget, QLabel) : + label_widget : QLabel = child_widget + label_widget.setText(time_str) + self.flush_system_info(child_widget) + + def func_mqtt_param_modify(self, modify_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/modify/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, modify_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def func_call_back_on_mqtt_param_info(self, info_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/info/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, info_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def on_menu_qpush_button_click(self, sender : QPushButton): + sender : QPushButton = self.sender() + match_object : QWidget = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + self.menu_selectable_object_flush() + if isinstance(match_object, QPushButton) : + self.on_select_object_action_process(match_object) + + #修改系统时间与日期 + def func_modify_system_time(self, modify_str : str) : + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + set_system_time(year, month, day, hour, minute, second) + + return year, month, day, hour, minute, second + return None + + #修改系统黑屏时间 + def func_modify_screen_blanking_time(self, modify_str: str): + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 1: + minutes = int(numbers[0]) + set_screen_blanking_time(minutes) + return minutes + return None + + def on_system_param_modify(self, tip : str) : + system = get_tip_system(tip) + if system == "DateTime" : + dialog_modify_text : DialogModifyText = DialogModifyText(self) + caption_str = "修改系统时间" + cur_time = QDateTime.currentDateTime() + date_time_str = cur_time.toString("yyyy-MM-dd hh:mm:ss") + dialog_modify_text.update_modify_info(date_time_str, caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_date_time_str = dialog_modify_text.value + self.func_modify_system_time(modify_date_time_str) + for circuit_id in range(8) : + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None and self.mqtt_thread != None: + time_message = '{"name" : "SetupTime", "value" : "%s"}'%(modify_date_time_str) + self.mqtt_thread.publish("request/action/" + unique_name, time_message) + dialog_inform = DialogInform(self) + dialog_inform.information("系统时间修改", "系统时间修改成功") + elif system == "ScreenBlankingTime": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改屏幕黑屏时间(分钟)" + sbt = system_parameter() + dialog_modify_text.update_modify_info("", str(sbt.get_screen_blanking_time()), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + result = self.func_modify_screen_blanking_time(modify_screen_time_str) + sbt.change_screen_blanking_time(modify_screen_time_str) + + if result is not None: + self.BlankTimelineEdit.setText(str(result)) + dialog_inform = DialogInform(self) + dialog_inform.information("屏幕黑屏时间修改", "屏幕黑屏时间修改成功") + + elif system == "SystemPassWord": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改系统密码" + pass_word = system_parameter() + dialog_modify_text.update_modify_info("", pass_word.get_system_password(), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + pass_word.set_system_password(modify_screen_time_str) + dialog_inform = DialogInform(self) + dialog_inform.information("系统密码修改", "系统密码修改成功") + def on_line_edit_modify_click(self, sender :QLineEdit) : + match_object : QLineEdit = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + if isinstance(match_object, QLineEdit) : + self.dialog_modify_value = None + tip = match_object.statusTip() + alias_name = get_tip_alias_str(tip) + unique_name = self.get_unique_name_from_object(match_object) + if unique_name != None and alias_name != None : + key_combine_str = get_key_combine_str(alias_name, unique_name) + value_dict = utils.dict_or_object_get_attr(self.alias_dict, key_combine_str, None) + + if isinstance(value_dict, dict) : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + caption_str = get_tip_caption_str(match_object.statusTip()) + value_text = match_object.text() + dialog_modify_alias.set_alias_item_info(value_dict, value_text, caption_str) + self.dialog_modify_alias = dialog_modify_alias + + if dialog_modify_alias.exec() == QDialog.Accepted : + modify_value = dialog_modify_alias.value + self.func_mqtt_param_modify(modify_value) + else : + inform_box : DialogInform = DialogInform() + inform_box.information('别名数据未获取', 'message: %s'%(alias_name)) + else : + dialog_modify_value : DialogModifyValue = DialogModifyValue(self) + caption_str = get_tip_caption_str(match_object.statusTip()) + try : + origin_value = float(match_object.text()) + except Exception as e : + origin_value = None + inform_box : DialogInform = DialogInform() + inform_box.information('无效值', str(e)) + + if origin_value != None : + format_str = get_tip_format(tip) + dialog_modify_value.update_modify_info(format_str, origin_value, caption_str) + if dialog_modify_value.exec() == QDialog.Accepted : + modify_value = dialog_modify_value.value + self.func_mqtt_param_modify(modify_value) + def set_video_image(self, image_object : QObject, canvas_id = 0) : + if canvas_id >= len(self.canvas_label_list) : + return + camera_info_items = self.canvas_label_list[canvas_id] + camera_label: QLabel = camera_info_items[0] + timeout_list_index = camera_info_items[1] + camera_thread : CameraThread = camera_info_items[2] + + if camera_label != None: + shape = image_object.shape + width = shape[1] + height = shape[0] + if camera_label.isVisible() : + + qt_img = QImage(image_object.data, width, height, QImage.Format_RGB888) + + camera_label.setScaledContents(True) + camera_label.setPixmap(QPixmap.fromImage(qt_img)) + + if timeout_list_index >= 0 : + self.widget_timeout_list[timeout_list_index][1] = 0 + + def set_video_image_0(self, image_object : QObject) : + self.set_video_image(image_object, 0) + + def set_video_image_1(self, image_object : QObject) : + self.set_video_image(image_object, 1) + + def set_video_image_2(self, image_object : QObject) : + self.set_video_image(image_object, 2) + + def set_video_image_3(self, image_object : QObject) : + self.set_video_image(image_object, 3) + + def set_video_image_4(self, image_object : QObject) : + self.set_video_image(image_object, 4) + + def set_video_image_5(self, image_object : QObject) : + self.set_video_image(image_object, 5) + + def set_video_image_6(self, image_object : QObject) : + self.set_video_image(image_object, 6) + + def set_video_image_7(self, image_object : QObject) : + self.set_video_image(image_object, 7) + + def set_video_image_8(self, image_object : QObject) : + self.set_video_image(image_object, 8) + + def update_mqtt_value(self, circuit, json_dict) : + for json_key, json_value in json_dict.items() : + self.set_mqtt_value(circuit, json_key, json_value) + + #更新视频显示与否 + def update_canvas_camera_visible(self, child = None) : + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if isinstance(child, QLabel) : + widget_label : QLabel = child + tip_str = widget_label.statusTip() + visible_mqtt = get_tip_visible_mqtt(tip_str, None) + if visible_mqtt != None : + #该Label具有Visible控制, 检查一下是不是视频流 + canvas_id, camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if canvas_id >= 0 and camera_id >= 0 : + circuit_id = self.get_circuit_from_object(widget_label) + visible_value = self.get_mqtt_value(circuit_id, visible_mqtt) + + is_visible = False + if visible_value != None : + try : + is_visible = True if int(visible_value) > 0 else False + except Exception as e : + is_visible = False + + widget_label.setVisible(is_visible) + if is_visible != self.canvas_visible_arr[canvas_id] and canvas_id < len(self.canvas_visible_arr): + self.canvas_visible_arr[canvas_id] = is_visible + self.virtual_connect_canvas_to_camera(canvas_id, camera_id, is_visible) + + self.update_canvas_camera_visible(child) + + def video_visible_timeout(self) : + self.update_canvas_camera_visible() + + #通过json包刷新界面数据 + def flush_widgets(self, circuit, json_dict, child = None): + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if not hasattr(child, "statusTip") : + continue + tip_str : str = child.statusTip() + + mqtt_name = get_tip_mqtt_name(tip_str) + + circuit_id = self.get_circuit_from_object(each_object) + self.flush_widgets(circuit, json_dict, child) + + if circuit_id != circuit : + continue + + if mqtt_name in json_dict.keys() : + value_or_dict = json_dict[mqtt_name] + + if isinstance(value_or_dict, dict) : + value_text = utils.dict_or_object_get_attr(value_or_dict, "value", "") + else : + value_text = value_or_dict + + color_str = utils.dict_or_object_get_attr(value_or_dict, "color", None) + bk_color_str = utils.dict_or_object_get_attr(value_or_dict, "bk_color", None) + + imag_file_name = get_imag_value_file_name(tip_str, value_text) + timeout_ms = get_tip_timeout(tip_str) + if timeout_ms > 0 : + self.reset_widget_timeout(child) + + if isinstance(child, QPushButton) : + widget_button : QPushButton = child + if imag_file_name != None : + self.modify_object_style_sheet(widget_button, "border-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_button) + + if isinstance(child, QLabel) : + widget_label : QLabel = child + if imag_file_name != None : + if widget_label.isVisible() == False : + widget_label.setVisible(True) + self.modify_object_style_sheet(widget_label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_label) + widget_label.setText(value_text) + + if isinstance(child, QLineEdit) : + widget_line_edit : QLineEdit = child + alias_name = get_tip_alias_str(widget_line_edit.statusTip()) + unique_name = self.get_unique_name_from_object(widget_line_edit) + + if alias_name != None : + fvalue = float(value_text) + value = round(fvalue) + value_str = str(value) + display_text = "(%s)"%(value_str) + + alias_key_str = get_key_combine_str(alias_name, unique_name) + if alias_key_str in self.alias_dict.keys() : + alias_value_dict = self.alias_dict[alias_key_str] + if isinstance(alias_value_dict, dict) : + display_text = utils.dict_or_object_get_attr(alias_value_dict, value_str, value_text) + else : + display_text = value_text + widget_line_edit.setText(display_text) + + if bk_color_str != None : + if isinstance(child, QLineEdit) : + self.modify_object_style_sheet(child, "background-color", bk_color_str) + if color_str != None : + self.modify_object_style_sheet(child, "color", color_str) + + def get_circuit_from_object(self, object :QWidget) : + parent : QWidget= object + circuit_id = -1 + while parent != None : + if hasattr(parent, "statusTip") : + tip_str = parent.statusTip() + circuit_id = get_tip_circuit(tip_str) + if circuit_id >= 0 or parent == self: + break + parent = parent.parent() + return circuit_id + + def get_main_index_from_object(self, object :QWidget) : + parent : QWidget= object + main_index = -1 + while parent != None : + if not hasattr(parent, "statusTip") : + return -1 + + tip_str = parent.statusTip() + main_index = get_tip_main_index(tip_str) + if main_index >= 0 or parent == self: + break + parent = parent.parent() + return main_index + + def get_unique_name_from_circuit(self, circuit_id : int) : + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_circuit_id == circuit_id : + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + return circuit_unique_name + return None + + def get_unique_name_from_object(self, object :QWidget) : + circuit_id = self.get_circuit_from_object(object) + return self.get_unique_name_from_circuit(circuit_id) + + def key_increase_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_end(tip_str) + + if group_items_count == -1: + next_menu_index = (self.menu_key_index + 1) % menu_count + else: + next_menu_index = (self.menu_key_index - group_items_count + 1) % menu_count + + self.menu_key_index = next_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def key_decrease_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_start(tip_str) + if group_items_count == -1: + prev_menu_index = (self.menu_key_index - 1) % menu_count + else: + prev_menu_index = (self.menu_key_index + group_items_count - 1) % menu_count + + self.menu_key_index = prev_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + + def key_enter_process(self): + menu_count = len(self.sort_menu_list) + if menu_count == 0: + return + + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.on_select_object_action_process(self.select_object) + + def key_escape_process(self): + #在菜单第一项, 按下复位, 退出到上一页 + if self.menu_key_index == 0: + self.virtual_change_to_page(-1) + + menu_count = len(self.sort_menu_list) # 获取当前页面可交互控件个数 + if menu_count == 0: # 若注册可交互控件个数为0,则退出处理,返回 + return + + # 重置菜单选择 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_key_index = 0 + self.menu_selectable_object_flush() + + + def key_Test_process0(self): + json_dict = {"Uab" :"1111", + "Ubc" : "1111", + "Uca" : "1111", + "Uo" : "11" , + "Iab" : "1111", + "Ibc" : "1111", + "Ica" : "1111", + "Io" : "1111", + "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + } + + + self.flush_widgets(0, json_dict) + + def key_Test_process1(self): + json_dict = {"Uab" :"2222", + "Ubc" : "2222", + "Uca" : "2222", + "Uo" : "22" , + "Iab" : "2222", + "Ibc" : "2222", + "Ica" : "2222", + "Io" : "2222", + "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + + + } + self.flush_widgets(1, json_dict) + + def key_Test_process2(self): + json_dict = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + self.flush_widgets(2, json_dict) + + def key_Test_process3(self): + json_dict = {"Uab" :"33333", "Ubc" : "33333", "Uca" : "33333"} + self.flush_widgets(3, json_dict) + + def menu_selectable_object_flush(self) : + menu_count = len(self.sort_menu_list) + for i in range(menu_count): + object : QWidget = self.sort_menu_list[i][1] + is_select_object_draw = False + + if isinstance(object, QPushButton) : + button_object : QPushButton = object + image_file_name = get_select_imag_file_name(object.statusTip()) + image_icon_name = get_select_icon_file_name(object.statusTip()) + + if i == self.menu_key_index: + button_object.setFocus() + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(button_object, "border-image", file_url) + elif image_icon_name != None : + is_select_object_draw = True + button_size : QSize = button_object.size() + button_object.setIcon(QIcon(image_icon_name)) + button_object.setIconSize(button_size) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(button_object) + elif image_icon_name != None : + is_select_object_draw = True + button_object.setIcon(QIcon()) + + elif isinstance(object, QLabel) : + label_object : QLabel = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(label_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(label_object) + + elif isinstance(object, QLineEdit) : + line_object : QLineEdit = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(line_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(line_object) + + + if is_select_object_draw == False : + if i == self.menu_key_index : + self.modify_object_style_sheet(object, "background-color", COLOR_BLUE) + else : + self.reset_object_style_sheet(object) + + def response_topic_message_process(self, topic: str, + message : str, + is_timeout :bool = False, inform : bool = False) : + find_reponse_topic_msg = None + for wait_topic_msg in self.wait_response_list : + if wait_topic_msg[0] == topic : + find_reponse_topic_msg = wait_topic_msg + self.wait_response_list.remove(wait_topic_msg) + break + + if find_reponse_topic_msg == None : + return + + select_object :QWidget = find_reponse_topic_msg[2] + request_message : str = find_reponse_topic_msg[1] + + inform_box : DialogInform = None + if inform : + inform_box : DialogInform = DialogInform() + + try : + json_dict = json_load_message(message) + result = utils.dict_or_object_get_attr(json_dict, "result", 0) + result = int(result) + except Exception as e: + json_dict = None + result = 0 + print_error_msg(str(e) + "invalid json message: %s" % (message)) + + if "response/action" in topic : + if is_timeout : + inform_message = "命令执行超时" + if inform == True: + inform_box.information('命令执行超时', inform_message) + else : + inform_message = '命令执行成功' if result == 1 else '命令执行失败!!!' + if inform == True: + inform_box.information('命令执行', inform_message) + elif "response/param/modify" in topic : + if is_timeout : + inform_message = '参数修改超时' + if inform == True: + inform_box.information('参数修改超时', inform_message) + else : + inform_message = '参数修改成功' if result == 1 else '参数修改失败!!!' + if inform == True: + inform_box.information('参数修改', inform_message) + if result == 1 : + self.para_or_measure_query() + elif "response/alias" in topic : + unique_name = topic.replace("response/alias/", "") + + if is_timeout : + if json_dict != None : + alias_name = None + if "name" in json_dict.keys() : + alias_name = json_dict["name"] + + if alias_name != None : + key_str = get_key_combine_str(alias_name, unique_name) + if key_str in self.alias_dict.keys() : + if isinstance(self.alias_dict[key_str], int) : + self.alias_dict[key_str] = ALIAS_QUERY_NONE + + if inform == True: + inform_box.information('获取别名超时', message) + else : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + if isinstance(json_dict, list): + for item in json_dict: + for alias_key_name, alias_dict in item.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + else: + for alias_key_name, alias_dict in json_dict.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + + def mqtt_topic_message_process(self, msg) : + topic_msg_item = True + while topic_msg_item != None : + self.mutex.lock() + topic_msg_count = len(self.topic_message_list) + if topic_msg_count > 0: + topic_msg_item = self.topic_message_list.pop(0) + else : + topic_msg_item = None + self.mutex.unlock() + if topic_msg_item != None : + topic = topic_msg_item[0] + message = topic_msg_item[1] + try : + json_dict = json_load_message(message) + except Exception as e : + json_dict = None + print_error_msg("invalid json message : %s"%(message)) + if json_dict != None: + if "measure" in topic : + circuit_id = search_circuit_from_topic(topic) + self.update_mqtt_value(circuit_id, json_dict) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.flush_widgets(circuit_id, json_dict) + elif "param/info" in topic: + circuit_id = search_circuit_from_topic(topic) + #print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response/alarm" in topic : + circuit_id = search_circuit_from_topic(topic) + self.flush_alarminfo(circuit_id, json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response" in topic : + self.response_topic_message_process(topic, message, is_timeout = False, inform = True) + + elif "alarm/test" in topic : + circuit_id = search_circuit_from_topic(topic) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + + # 将告警信息刷新到页面 + def flush_alarminfo(self, circuit, json_dict, child = None): + + alarmTitle : QLineEdit = self.findChild(QLineEdit,"alarmTitle") + if alarmTitle != None: + display_title = "%s"%(json_dict["index"]) + alarmTitle.setText(display_title) + + alarmTime : QLineEdit = self.findChild(QLineEdit,"alarmTime") + if alarmTime != None: + display_year = "%s-"%(json_dict["AlarmYear"]) + display_month = "%s-"%(json_dict["AlarmMonth"]) + display_day = "%s"%(json_dict["AlarmDay"]) + display_hour = " %s:"%(json_dict["AlarmHour"]) + display_minute = "%s: "%(json_dict["AlarmMinute"]) + display_second = "%s"%(json_dict["AlarmSecond"]) + + disp_time = display_year + display_month + display_day + display_hour+ display_minute+ display_second + alarmTime.setText(disp_time) + + alarmMsg : QLineEdit = self.findChild(QLineEdit,"alarmMsg") + if alarmMsg != None: + display_msg = "%s"%(json_dict["AlarmCodeMsg"]) + alarmMsg.setText(display_msg) + + + def on_connect(self, mqtt_thread, userdata, flags, rc) : + if rc == 0: + self.mqtt_thread = mqtt_thread + self.mqtt_thread.subscribe("response/#") + self.mqtt_thread.subscribe("param/info/#") + self.mqtt_thread.subscribe("param/modify/#") + self.mqtt_thread.subscribe("measure/#") + self.mqtt_thread.subscribe("status/#") + self.mqtt_thread.subscribe("alarm/#") + self.mqtt_thread.subscribe("response/alarm/#") + self.mqtt_thread.subscribe("action/#") + else : + self.mqtt_thread = None + + def on_message(self, mqtt_thread, topic, message) : + circuit_id = search_circuit_from_topic(topic) + if circuit_id < 0 : + return + if (self.exist_circuit_mask & (0x1 << circuit_id)) == 0 : + return + self.mutex.lock() + if len(self.topic_message_list) < 100 : + self.topic_message_list.append([topic, message]) + self.mutex.unlock() + self.mqtt_signal.emit("Refresh UI") + + def response_topic_messge_timeout(self): + timer = self.sender() + for wait_response_items in self.wait_response_list: + wait_timer : QTimer = wait_response_items[3] + _inform : bool = wait_response_items[4] + + if wait_timer == timer : + topic : str = wait_response_items[0] + message : str = wait_response_items[1] + wait_timer.stop() + self.response_topic_message_process(topic, message, is_timeout=True, inform = _inform) + break + + # def mqtt_publish_and_wait_response(self, publish_topic : str, publish_message : str, select_object : QWidget = None, timeout_ms : int = 1000, inform : bool = True) : + # if self.mqtt_thread != None : + # self.mqtt_thread.publish(publish_topic, publish_message) + + # response_topic = publish_topic.replace("request", "response") + # #开启超时定时器 + # wait_timer = QTimer() + # wait_timer.timeout.connect(self.response_topic_messge_timeout) + # wait_timer.start(timeout_ms) + # self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + + + def mqtt_publish_and_wait_response(self, publish_topic: str, publish_message: str, select_object: QWidget = None, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda: self.response_topic_message_timeout(response_topic)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + def response_topic_message_timeout(self, response_topic): + # 处理超时事件 + for response_info in self.wait_response_list: + if response_info[0] == response_topic: + response_info[3].stop() # 停止定时器 + self.wait_response_list.remove(response_info) + # 在这里添加超时后的处理逻辑,例如通知用户请求超时 + if response_info[4]: # 检查是否需要通知 + self.inform_timeout(response_info) + break + + def inform_timeout(self, response_info): + # 通知用户请求超时的逻辑 + # response_info[2] 是 select_object + # 根据具体需求实现通知逻辑 + print(f"Request for {response_info[1]} on topic {response_info[0]} timed out.") + + def batch_mqtt_publish_and_wait_response(self, publish_list: list, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + for publish_topic, publish_message, select_object in publish_list: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda rt=response_topic: self.response_topic_message_timeout(rt)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + def para_or_measure_query(self, child = None) : + widget :QWidget = self + if child == None : + self.param_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + if "ScreenBlankingTime" in tip_str : + sbt = system_parameter() + child_widget.setText(sbt.get_screen_blanking_time()) + continue + mqtt_str = get_tip_mqtt_name(tip_str) + if mqtt_str != None and mqtt_str not in self.param_dict.keys(): + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None and self.mqtt_thread != None: + self.mqtt_thread.publish("request/param/info/"+unique_name, '{"name":"%s"}'%mqtt_str) + self.param_dict[mqtt_str] = ALIAS_QUERY_NONE + self.para_or_measure_query(child_widget) + + + def flush_system_cycle(self) : + self.flush_system_info() + +if __name__ == '__main__': + + style_sheet = "QLabel {color : RED;\nbackground-color : GREEN;}" + print(style_sheet) + + new_style_items = modify_style_sheet("QLabel", style_sheet, "background-color", "WHITE") + new_style_items = modify_style_sheet("QLabel", new_style_items, "color", "YELLOW") + + print(new_style_items) + sys.exit(0) diff --git a/QT5_Project/KD_ZM_8_XCF/__init__.py b/QT5_Project/KD_ZM_8_XCF/__init__.py new file mode 100644 index 0000000..81c647b --- /dev/null +++ b/QT5_Project/KD_ZM_8_XCF/__init__.py @@ -0,0 +1,5 @@ +import sys +sys_path = sys.path[0].replace("\\", "/") +sys_path_linux = sys_path + "/../.." +if sys_path_linux not in sys.path : + sys.path.append(sys_path_linux) diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM00_01B.png b/QT5_Project/KD_ZM_8_XCF/background/IM00_01B.png new file mode 100644 index 0000000..7895e62 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM00_01B.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchStatus_0.png b/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchStatus_0.png new file mode 100644 index 0000000..7af2bc2 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchStatus_1.png b/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchStatus_1.png new file mode 100644 index 0000000..3b8eec3 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchType_0.png b/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchType_0.png new file mode 100644 index 0000000..6d93e04 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchType_1.png b/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchType_1.png new file mode 100644 index 0000000..bc57853 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM00_SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM01_01.png b/QT5_Project/KD_ZM_8_XCF/background/IM01_01.png new file mode 100644 index 0000000..ca8ba7b Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM01_01.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM01_0122.png b/QT5_Project/KD_ZM_8_XCF/background/IM01_0122.png new file mode 100644 index 0000000..1e0fc04 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM01_0122.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchStatus_0.png b/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchStatus_0.png new file mode 100644 index 0000000..3846172 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchStatus_1.png b/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchStatus_1.png new file mode 100644 index 0000000..a648e14 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchType_0.png b/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchType_0.png new file mode 100644 index 0000000..62cb1a4 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchType_1.png b/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchType_1.png new file mode 100644 index 0000000..841ccfa Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM02_SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM03_001.png b/QT5_Project/KD_ZM_8_XCF/background/IM03_001.png new file mode 100644 index 0000000..164c3b2 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM03_001.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM03_SwitchStatus_0.png b/QT5_Project/KD_ZM_8_XCF/background/IM03_SwitchStatus_0.png new file mode 100644 index 0000000..f2796ca Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM03_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM03_SwitchStatus_1.png b/QT5_Project/KD_ZM_8_XCF/background/IM03_SwitchStatus_1.png new file mode 100644 index 0000000..3d469ef Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM03_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM04_00.png b/QT5_Project/KD_ZM_8_XCF/background/IM04_00.png new file mode 100644 index 0000000..8e19fb2 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM04_00.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_001.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_001.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_001.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_002.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_002.png new file mode 100644 index 0000000..d1c3db6 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_002.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_A1.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_A1.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_A1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_A2.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_A2.png new file mode 100644 index 0000000..ca50d84 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_A2.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_A3.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_A3.png new file mode 100644 index 0000000..9462fc6 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_A3.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_A4.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_A4.png new file mode 100644 index 0000000..e4d3b74 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_A4.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_A5.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_A5.png new file mode 100644 index 0000000..85544ac Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_A5.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_A6.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_A6.png new file mode 100644 index 0000000..bff0217 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_A6.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_A7.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_A7.png new file mode 100644 index 0000000..a5832fc Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_A7.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IM05_A8.png b/QT5_Project/KD_ZM_8_XCF/background/IM05_A8.png new file mode 100644 index 0000000..d8ab1f4 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IM05_A8.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_00D.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_00D.png new file mode 100644 index 0000000..b47cc71 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_00D.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_00E.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_00E.png new file mode 100644 index 0000000..f00eef7 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_00E.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_00F.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_00F.png new file mode 100644 index 0000000..28446f1 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_00F.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_0.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_0.png new file mode 100644 index 0000000..b2d9427 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_0.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_1.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_1.png new file mode 100644 index 0000000..02ccba6 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_2.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_2.png new file mode 100644 index 0000000..b3c036c Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_2.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_3.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_3.png new file mode 100644 index 0000000..4de3901 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_3.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_4.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_4.png new file mode 100644 index 0000000..7de2f89 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_4.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_5.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_5.png new file mode 100644 index 0000000..1c3cd15 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_5.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_6.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_6.png new file mode 100644 index 0000000..0f628d3 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_6.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_7.png b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_7.png new file mode 100644 index 0000000..003e551 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/IMxx_A_7.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/P4_ParaSelect.png b/QT5_Project/KD_ZM_8_XCF/background/P4_ParaSelect.png new file mode 100644 index 0000000..489633e Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/P4_ParaSelect.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/P4_ToggleSelect.png b/QT5_Project/KD_ZM_8_XCF/background/P4_ToggleSelect.png new file mode 100644 index 0000000..d190adf Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/P4_ToggleSelect.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/SR_001.png b/QT5_Project/KD_ZM_8_XCF/background/SR_001.png new file mode 100644 index 0000000..654c93b Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/SR_001.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/SwitchStatus_0.png b/QT5_Project/KD_ZM_8_XCF/background/SwitchStatus_0.png new file mode 100644 index 0000000..108f3f0 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/SwitchStatus_1.png b/QT5_Project/KD_ZM_8_XCF/background/SwitchStatus_1.png new file mode 100644 index 0000000..25bafe1 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/SwitchType_0.png b/QT5_Project/KD_ZM_8_XCF/background/SwitchType_0.png new file mode 100644 index 0000000..3bf1062 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/background/SwitchType_1.png b/QT5_Project/KD_ZM_8_XCF/background/SwitchType_1.png new file mode 100644 index 0000000..700b4f6 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/background/SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/CameraView.png b/QT5_Project/KD_ZM_8_XCF/image/CameraView.png new file mode 100644 index 0000000..9407354 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/CameraView.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/DataView.png b/QT5_Project/KD_ZM_8_XCF/image/DataView.png new file mode 100644 index 0000000..bc1ebd9 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/DataView.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/DeviceList.png b/QT5_Project/KD_ZM_8_XCF/image/DeviceList.png new file mode 100644 index 0000000..89192a8 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/DeviceList.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/DeviceMenu.png b/QT5_Project/KD_ZM_8_XCF/image/DeviceMenu.png new file mode 100644 index 0000000..d537525 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/DeviceMenu.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/FaceCameraView.png b/QT5_Project/KD_ZM_8_XCF/image/FaceCameraView.png new file mode 100644 index 0000000..4580135 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/FaceCameraView.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/FaultQuery.png b/QT5_Project/KD_ZM_8_XCF/image/FaultQuery.png new file mode 100644 index 0000000..a9736fd Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/FaultQuery.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/FieldTestAction.png b/QT5_Project/KD_ZM_8_XCF/image/FieldTestAction.png new file mode 100644 index 0000000..37471f8 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/FieldTestAction.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/ParamSet.png b/QT5_Project/KD_ZM_8_XCF/image/ParamSet.png new file mode 100644 index 0000000..1c40246 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/ParamSet.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/SwitchAction.png b/QT5_Project/KD_ZM_8_XCF/image/SwitchAction.png new file mode 100644 index 0000000..ff445cb Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/SwitchAction.png differ diff --git a/QT5_Project/KD_ZM_8_XCF/image/SystemSet.png b/QT5_Project/KD_ZM_8_XCF/image/SystemSet.png new file mode 100644 index 0000000..dc91356 Binary files /dev/null and b/QT5_Project/KD_ZM_8_XCF/image/SystemSet.png differ diff --git a/QT5_Project/Shared_CODE/CameraThread.py b/QT5_Project/Shared_CODE/CameraThread.py index b54e07e..e24de72 100644 --- a/QT5_Project/Shared_CODE/CameraThread.py +++ b/QT5_Project/Shared_CODE/CameraThread.py @@ -1,281 +1,31 @@ -# import sys -# import cv2 -# import os -# import time -# from PyQt5.QtCore import QThread, pyqtSignal, QObject -# import face_recognition - -# current_dir = os.path.dirname(__file__) -# share_code_dir = os.path.abspath(os.path.join(current_dir, '..', '..')) -# sys.path.append(share_code_dir) - -# from print_color import * - -# DEFAULT_VIDEO_SLEEP_MS = 20 - -# # 图像处理线程 -# class ImageProcessingThread(QThread): -# processed_image_signal = pyqtSignal(object) - -# def __init__(self): -# super().__init__() - -# def run(self): -# while True: -# # 在这里添加图像处理代码 -# # 这里暂时只是将图像传递给下一个线程 -# time.sleep(0.01) -# self.processed_image_signal.emit(None) - -# # 摄像头采集线程 -# class CameraThread(QThread): -# image_signal = pyqtSignal(object) - -# def __init__(self, camera_url, circuit_id: int = 0): -# super().__init__() - -# self.camera_url = camera_url # 摄像头url地址, 整数 或者 字符串 -# self.face_detection: bool = False - -# if isinstance(camera_url, int): -# self.camera_url_str = str(camera_url) -# else: -# self.camera_url_str = camera_url - -# self.cap: cv2.VideoCapture = None -# self.running: bool = True - -# self.fps = 0 - -# self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS -# self.cycle_ms = 0 -# self.circuit_id = circuit_id # 摄像头对应的回路, 组合开关每一个回路都有对应的摄像头 -# self.is_signal_connect = False -# self.is_emit = False - -# self.set_video_cycle_ms(2000) - -# def signal_connect(self, slot_func): -# self.image_signal.connect(slot_func) -# self.is_signal_connect = True - -# def signal_disconnect(self): -# # 判断信号是否已连接 -# if self.is_signal_connect: -# self.image_signal.disconnect() -# self.is_signal_connect = False - -# def set_video_cycle_ms(self, cycle_ms: int = 10): -# if self.cycle_limit != cycle_ms: -# if cycle_ms <= DEFAULT_VIDEO_SLEEP_MS: -# self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS -# else: -# self.cycle_limit = cycle_ms - -# # 新建函数,改变函数延时方法 -# def change_camera_url(self, camera_url: str): -# if self.circuit_id == camera_url: -# self.set_video_cycle_ms(DEFAULT_VIDEO_SLEEP_MS) -# else: -# self.set_video_cycle_ms(1000) - -# def close(self): -# if self.cap == None: # 初始化一直未完成 -# self.terminate() -# self.running = False - -# def run(self): -# process_count = 0 -# fps_time = 0 - -# while self.running == True: -# inform_msg = "cameral init start, url = " + self.camera_url_str -# print_inform_msg(inform_msg) - -# try: -# if isinstance(self.camera_url, int): -# # 在 Windows 平台下,使用默认的 cv2.VideoCapture 接口 -# self.cap = cv2.VideoCapture(self.camera_url, cv2.CAP_DSHOW) -# else: -# # 在 Linux 平台下,使用默认的 cv2.VideoCapture 接口 -# self.cap = cv2.VideoCapture(self.camera_url) - -# if self.cap != None: -# inform_msg = "cameral Init Success, url = " + self.camera_url_str -# self.is_emit = True -# print_inform_msg(inform_msg) -# else: -# inform_msg = "cameral connection timeout, url = " + self.camera_url_str -# print_inform_msg(inform_msg) - -# except Exception as e: -# self.cap = None -# inform_msg = "cameral camera Init Fail, url = " + self.camera_url_str -# print_error_msg(inform_msg) - -# base_time = time.time() - -# while self.running and self.cap != None: -# # 延时20ms -# time.sleep(DEFAULT_VIDEO_SLEEP_MS / 1000) -# if self.cycle_ms + DEFAULT_VIDEO_SLEEP_MS < self.cycle_limit: -# self.cycle_ms += DEFAULT_VIDEO_SLEEP_MS -# self.cap.grab() # 抛弃多余的帧,保持最新帧 -# continue -# else: -# self.cycle_ms = 0 - -# try: -# ret, frame = self.cap.read() -# cur_time = time.time() - -# execution_time = cur_time - base_time -# base_time = cur_time -# process_count += 1 - -# fps_time += execution_time - -# if fps_time >= 1: -# self.fps = process_count -# process_count = 0 -# fps_time = 0 - -# if execution_time < 5: -# image_object: QObject = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) -# self.image_signal.emit(image_object) -# else: # 时间差大于5秒, 表示网络可能中断过, 退出并重新连接 -# err_message = "cameral read timeout, url = " + self.camera_url_str -# print_error_msg(err_message) -# break -# except Exception as e: -# err_message = "cameral read timeout, url = " + self.camera_url_str -# self.is_emit = False -# print_error_msg(err_message) -# if self.running == True: -# time.sleep(2) -# break - -# print_inform_msg("cameral connection End") -# time.sleep(0.01) - -# if self.cap != None: -# self.cap.release() -# self.cap = None -# - * - coding:utf - 8 - * - import sys import cv2 import os import time -import subprocess -import face_recognition -import numpy as np -from PIL import Image, ImageDraw, ImageFont from PyQt5.QtCore import QThread, pyqtSignal, QObject -from print_color import * +import face_recognition + current_dir = os.path.dirname(__file__) share_code_dir = os.path.abspath(os.path.join(current_dir, '..', '..')) sys.path.append(share_code_dir) +from print_color import * + DEFAULT_VIDEO_SLEEP_MS = 20 -# 定义路径常量 -npy_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'face_data/face_data.npy')) -image_folder_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'face_data')) -font_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'font/hanzi.ttc')) -def load_face_data(): - face_data = {} - try: - face_data = np.load(npy_file_path, allow_pickle=True).item() - print_debug_msg(f"Loaded {len(face_data)} face encodings from {npy_file_path}.") - except Exception as e: - print_error_msg(f"Error loading face encodings: {e}") - - current_images = [f for f in os.listdir(image_folder_path) if f.endswith('.jpg')] - current_image_set = set(os.path.splitext(f)[0] for f in current_images) - known_image_set = set(face_data.keys()) - - added_images = current_image_set - known_image_set - removed_images = known_image_set - current_image_set - - for image_name in added_images: - image_path = os.path.join(image_folder_path, f"{image_name}.jpg") - try: - image = face_recognition.load_image_file(image_path) - face_encodings = face_recognition.face_encodings(image) - if face_encodings: - face_data[image_name] = face_encodings[0].tolist() - print_debug_msg(f"Added encoding for {image_name}.") - else: - print_warning_msg(f"[WARNING] No face detected in {image_name}.jpg.") - except Exception as e: - print_error_msg(f"[ERROR] Error processing {image_name}.jpg: {e}") - - for removed_image in removed_images: - del face_data[removed_image] - print_debug_msg(f"Removed encoding for {removed_image}.") - - np.save(npy_file_path, face_data) - print_debug_msg(f"Updated face data saved with {len(face_data)} entries.") - return face_data - +# 图像处理线程 class ImageProcessingThread(QThread): processed_image_signal = pyqtSignal(object) - def __init__(self, frame=None): + def __init__(self): super().__init__() - self.frame = frame # 添加 frame 参数 - self.face_encodings = [] - self.face_names = [] - self.face_locations = [] - self.face_data = load_face_data() - self.total_image_name = list(self.face_data.keys()) - self.total_face_encoding = [np.array(self.face_data[name]) for name in self.total_image_name] - - def process_frame(self, frame): - """实时处理帧,匹配已知人脸""" - self.face_locations = face_recognition.face_locations(frame) - face_encodings = face_recognition.face_encodings(frame, self.face_locations) - names = [] - for face_encoding in face_encodings: - name = "Unknown" - face_distances = face_recognition.face_distance(self.total_face_encoding, face_encoding) - - if face_distances.size > 0: - min_distance = np.min(face_distances) - best_match_index = np.argmin(face_distances) - - if min_distance < self.dynamic_tolerance(): # 使用动态容忍度 - name = self.total_image_name[best_match_index] - - names.append(name) - - self.face_names = names - return frame - - def dynamic_tolerance(self): - # 动态调整容忍度,可以基于一些规则来调整,如帧内错误率、识别准确率等 - error_rate = self.calculate_error_rate() - if error_rate > 0.1: - return 0.5 # 高容忍度以减少错误 - else: - return 0.4 # 适中容忍度 - - def calculate_error_rate(self): - # 计算识别错误率,作为动态调整容忍度的依据 - total_faces = len(self.total_face_encoding) - unmatched_faces = sum(1 for name in self.face_names if name == "Unknown") - return unmatched_faces / total_faces if total_faces > 0 else 0 - - def set_frame(self, frame): - self.frame = frame def run(self): while True: - if self.frame is not None: - self.process_frame(self.frame) - self.processed_image_signal.emit(self.frame) - time.sleep(0.01) # 控制帧率 - + # 在这里添加图像处理代码 + # 这里暂时只是将图像传递给下一个线程 + time.sleep(0.01) + self.processed_image_signal.emit(None) # 摄像头采集线程 class CameraThread(QThread): @@ -283,8 +33,9 @@ class CameraThread(QThread): def __init__(self, camera_url, circuit_id: int = 0): super().__init__() - self.camera_url = camera_url - self.face_detection: bool = True + + self.camera_url = camera_url # 摄像头url地址, 整数 或者 字符串 + self.face_detection: bool = False if isinstance(camera_url, int): self.camera_url_str = str(camera_url) @@ -295,12 +46,10 @@ class CameraThread(QThread): self.running: bool = True self.fps = 0 - self.frame_count = 0 - self.fps_time = 0 self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS self.cycle_ms = 0 - self.circuit_id = circuit_id + self.circuit_id = circuit_id # 摄像头对应的回路, 组合开关每一个回路都有对应的摄像头 self.is_signal_connect = False self.is_emit = False @@ -311,6 +60,7 @@ class CameraThread(QThread): self.is_signal_connect = True def signal_disconnect(self): + # 判断信号是否已连接 if self.is_signal_connect: self.image_signal.disconnect() self.is_signal_connect = False @@ -322,6 +72,7 @@ class CameraThread(QThread): else: self.cycle_limit = cycle_ms + # 新建函数,改变函数延时方法 def change_camera_url(self, camera_url: str): if self.circuit_id == camera_url: self.set_video_cycle_ms(DEFAULT_VIDEO_SLEEP_MS) @@ -329,115 +80,364 @@ class CameraThread(QThread): self.set_video_cycle_ms(1000) def close(self): - if self.cap is None: + if self.cap == None: # 初始化一直未完成 self.terminate() self.running = False def run(self): process_count = 0 fps_time = 0 - face_thread = ImageProcessingThread() - face_thread.start() - self.match_count = 0 # 初始化匹配帧数计数器 - - while self.running: - inform_msg = "Camera init start, URL = " + self.camera_url_str + while self.running == True: + inform_msg = "cameral init start, url = " + self.camera_url_str print_inform_msg(inform_msg) try: - self.cap = cv2.VideoCapture(self.camera_url) # 强制使用 BGR 格式 - if self.cap.isOpened(): - inform_msg = "Camera Init Success, URL = " + self.camera_url_str + if isinstance(self.camera_url, int): + # 在 Windows 平台下,使用默认的 cv2.VideoCapture 接口 + self.cap = cv2.VideoCapture(self.camera_url, cv2.CAP_DSHOW) + else: + # 在 Linux 平台下,使用默认的 cv2.VideoCapture 接口 + self.cap = cv2.VideoCapture(self.camera_url) + + if self.cap != None: + inform_msg = "cameral Init Success, url = " + self.camera_url_str self.is_emit = True print_inform_msg(inform_msg) else: - inform_msg = "Camera connection timeout, URL = " + self.camera_url_str - print_error_msg(inform_msg) + inform_msg = "cameral connection timeout, url = " + self.camera_url_str + print_inform_msg(inform_msg) except Exception as e: self.cap = None - inform_msg = "Camera Init Fail, URL = " + self.camera_url_str + inform_msg = "cameral camera Init Fail, url = " + self.camera_url_str print_error_msg(inform_msg) base_time = time.time() - while self.running and self.cap: + while self.running and self.cap != None: + # 延时20ms time.sleep(DEFAULT_VIDEO_SLEEP_MS / 1000) - if self.cycle_ms + DEFAULT_VIDEO_SLEEP_MS < self.cycle_limit: self.cycle_ms += DEFAULT_VIDEO_SLEEP_MS - self.cap.grab() + self.cap.grab() # 抛弃多余的帧,保持最新帧 continue else: self.cycle_ms = 0 try: ret, frame = self.cap.read() - if not ret: - break - - face_thread.set_frame(frame) - cur_time = time.time() + execution_time = cur_time - base_time base_time = cur_time process_count += 1 fps_time += execution_time - if fps_time >= 1: # 每隔1秒重新计算 FPS + + if fps_time >= 1: self.fps = process_count process_count = 0 fps_time = 0 if execution_time < 5: - frame: QObject = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) - for (top, right, bottom, left), name in zip(face_thread.face_locations, face_thread.face_names): - if name != "Unknown": # 只绘制已匹配的结果 - self.match_count += 1 # 计数成功匹配的帧 - # cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2) - # cv2.putText(frame, name, (left + 6, bottom - 6), cv2.FONT_HERSHEY_DUPLEX, 1.0, (255, 255, 255), 1) - - # 将OpenCV图像转换为PIL图像格式(注意要转换色彩空间,OpenCV是BGR,PIL是RGB) - pil_image = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) - draw = ImageDraw.Draw(pil_image) - # 这里选择合适的中文字体文件路径,比如系统自带的宋体(不同系统路径可能有差异),并设置字体大小 - font = ImageFont.truetype(font_path, 15) - # 在指定位置绘制中文 - draw.text((left + 12, bottom + 12), name, font=font, fill=(255, 255, 255)) - # 再将PIL图像转换回OpenCV图像格式 - frame = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) - cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2) - else: - name = "未在人脸库中,无操作权限" - pil_image = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) - draw = ImageDraw.Draw(pil_image) - #设置字体大小 - font = ImageFont.truetype(font_path, 15) - # 在指定位置绘制中文 - draw.text((left + 12, bottom + 12), name, font=font, fill=(255, 255, 255)) - # 再将PIL图像转换回OpenCV图像格式 - frame = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) - cv2.rectangle(frame, (left, top), (right, bottom), (255, 0, 0), 2) - self.image_signal.emit(frame) - else: - err_message = "Camera read timeout, URL = " + self.camera_url_str + image_object: QObject = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) + self.image_signal.emit(image_object) + else: # 时间差大于5秒, 表示网络可能中断过, 退出并重新连接 + err_message = "cameral read timeout, url = " + self.camera_url_str print_error_msg(err_message) break - except Exception as e: - err_message = "Camera read exception, URL = " + self.camera_url_str + err_message = "cameral read timeout, url = " + self.camera_url_str + self.is_emit = False print_error_msg(err_message) - if self.running: + if self.running == True: time.sleep(2) break - if self.cap: - self.cap.release() - self.cap = None - - print_inform_msg("Camera connection ended") + print_inform_msg("cameral connection End") time.sleep(0.01) + if self.cap != None: + self.cap.release() + self.cap = None +# - * - coding:utf - 8 - * - +# import sys +# import cv2 +# import os +# import time +# import subprocess +# import face_recognition +# import numpy as np +# from PIL import Image, ImageDraw, ImageFont +# from PyQt5.QtCore import QThread, pyqtSignal, QObject +# from print_color import * +# current_dir = os.path.dirname(__file__) +# share_code_dir = os.path.abspath(os.path.join(current_dir, '..', '..')) +# sys.path.append(share_code_dir) + +# DEFAULT_VIDEO_SLEEP_MS = 20 + +# # 定义路径常量 +# npy_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'face_data/face_data.npy')) +# image_folder_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'face_data')) +# font_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'font/hanzi.ttc')) +# def load_face_data(): +# face_data = {} +# try: +# face_data = np.load(npy_file_path, allow_pickle=True).item() +# print_debug_msg(f"Loaded {len(face_data)} face encodings from {npy_file_path}.") +# except Exception as e: +# print_error_msg(f"Error loading face encodings: {e}") + +# current_images = [f for f in os.listdir(image_folder_path) if f.endswith('.jpg')] +# current_image_set = set(os.path.splitext(f)[0] for f in current_images) +# known_image_set = set(face_data.keys()) + +# added_images = current_image_set - known_image_set +# removed_images = known_image_set - current_image_set + +# for image_name in added_images: +# image_path = os.path.join(image_folder_path, f"{image_name}.jpg") +# try: +# image = face_recognition.load_image_file(image_path) +# face_encodings = face_recognition.face_encodings(image) +# if face_encodings: +# face_data[image_name] = face_encodings[0].tolist() +# print_debug_msg(f"Added encoding for {image_name}.") +# else: +# print_warning_msg(f"[WARNING] No face detected in {image_name}.jpg.") +# except Exception as e: +# print_error_msg(f"[ERROR] Error processing {image_name}.jpg: {e}") + +# for removed_image in removed_images: +# del face_data[removed_image] +# print_debug_msg(f"Removed encoding for {removed_image}.") + +# np.save(npy_file_path, face_data) +# print_debug_msg(f"Updated face data saved with {len(face_data)} entries.") +# return face_data + +# class ImageProcessingThread(QThread): +# processed_image_signal = pyqtSignal(object) + +# def __init__(self, frame=None): +# super().__init__() +# self.frame = frame # 添加 frame 参数 +# self.face_encodings = [] +# self.face_names = [] +# self.face_locations = [] +# self.face_data = load_face_data() +# self.total_image_name = list(self.face_data.keys()) +# self.total_face_encoding = [np.array(self.face_data[name]) for name in self.total_image_name] + +# def process_frame(self, frame): +# """实时处理帧,匹配已知人脸""" +# self.face_locations = face_recognition.face_locations(frame) +# face_encodings = face_recognition.face_encodings(frame, self.face_locations) +# names = [] +# for face_encoding in face_encodings: +# name = "Unknown" +# face_distances = face_recognition.face_distance(self.total_face_encoding, face_encoding) + +# if face_distances.size > 0: +# min_distance = np.min(face_distances) +# best_match_index = np.argmin(face_distances) + +# if min_distance < self.dynamic_tolerance(): # 使用动态容忍度 +# name = self.total_image_name[best_match_index] + +# names.append(name) + +# self.face_names = names +# return frame + +# def dynamic_tolerance(self): +# # 动态调整容忍度,可以基于一些规则来调整,如帧内错误率、识别准确率等 +# error_rate = self.calculate_error_rate() +# if error_rate > 0.1: +# return 0.5 # 高容忍度以减少错误 +# else: +# return 0.4 # 适中容忍度 + +# def calculate_error_rate(self): +# # 计算识别错误率,作为动态调整容忍度的依据 +# total_faces = len(self.total_face_encoding) +# unmatched_faces = sum(1 for name in self.face_names if name == "Unknown") +# return unmatched_faces / total_faces if total_faces > 0 else 0 + +# def set_frame(self, frame): +# self.frame = frame + +# def run(self): +# while True: +# if self.frame is not None: +# self.process_frame(self.frame) +# self.processed_image_signal.emit(self.frame) +# time.sleep(0.01) # 控制帧率 + + +# # 摄像头采集线程 +# class CameraThread(QThread): +# image_signal = pyqtSignal(object) + +# def __init__(self, camera_url, circuit_id: int = 0): +# super().__init__() +# self.camera_url = camera_url +# self.face_detection: bool = True + +# if isinstance(camera_url, int): +# self.camera_url_str = str(camera_url) +# else: +# self.camera_url_str = camera_url + +# self.cap: cv2.VideoCapture = None +# self.running: bool = True + +# self.fps = 0 +# self.frame_count = 0 +# self.fps_time = 0 + +# self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS +# self.cycle_ms = 0 +# self.circuit_id = circuit_id +# self.is_signal_connect = False +# self.is_emit = False + +# self.set_video_cycle_ms(2000) + +# def signal_connect(self, slot_func): +# self.image_signal.connect(slot_func) +# self.is_signal_connect = True + +# def signal_disconnect(self): +# if self.is_signal_connect: +# self.image_signal.disconnect() +# self.is_signal_connect = False + +# def set_video_cycle_ms(self, cycle_ms: int = 10): +# if self.cycle_limit != cycle_ms: +# if cycle_ms <= DEFAULT_VIDEO_SLEEP_MS: +# self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS +# else: +# self.cycle_limit = cycle_ms + +# def change_camera_url(self, camera_url: str): +# if self.circuit_id == camera_url: +# self.set_video_cycle_ms(DEFAULT_VIDEO_SLEEP_MS) +# else: +# self.set_video_cycle_ms(1000) + +# def close(self): +# if self.cap is None: +# self.terminate() +# self.running = False + +# def run(self): +# process_count = 0 +# fps_time = 0 +# face_thread = ImageProcessingThread() +# face_thread.start() + +# self.match_count = 0 # 初始化匹配帧数计数器 + +# while self.running: +# inform_msg = "Camera init start, URL = " + self.camera_url_str +# print_inform_msg(inform_msg) + +# try: +# self.cap = cv2.VideoCapture(self.camera_url) # 强制使用 BGR 格式 +# if self.cap.isOpened(): +# inform_msg = "Camera Init Success, URL = " + self.camera_url_str +# self.is_emit = True +# print_inform_msg(inform_msg) +# else: +# inform_msg = "Camera connection timeout, URL = " + self.camera_url_str +# print_error_msg(inform_msg) + +# except Exception as e: +# self.cap = None +# inform_msg = "Camera Init Fail, URL = " + self.camera_url_str +# print_error_msg(inform_msg) + +# base_time = time.time() + +# while self.running and self.cap: +# time.sleep(DEFAULT_VIDEO_SLEEP_MS / 1000) + +# if self.cycle_ms + DEFAULT_VIDEO_SLEEP_MS < self.cycle_limit: +# self.cycle_ms += DEFAULT_VIDEO_SLEEP_MS +# self.cap.grab() +# continue +# else: +# self.cycle_ms = 0 + +# try: +# ret, frame = self.cap.read() +# if not ret: +# break + +# face_thread.set_frame(frame) + +# cur_time = time.time() +# execution_time = cur_time - base_time +# base_time = cur_time +# process_count += 1 + +# fps_time += execution_time +# if fps_time >= 1: # 每隔1秒重新计算 FPS +# self.fps = process_count +# process_count = 0 +# fps_time = 0 + +# if execution_time < 5: +# frame: QObject = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) +# for (top, right, bottom, left), name in zip(face_thread.face_locations, face_thread.face_names): +# if name != "Unknown": # 只绘制已匹配的结果 +# self.match_count += 1 # 计数成功匹配的帧 +# # cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2) +# # cv2.putText(frame, name, (left + 6, bottom - 6), cv2.FONT_HERSHEY_DUPLEX, 1.0, (255, 255, 255), 1) + +# # 将OpenCV图像转换为PIL图像格式(注意要转换色彩空间,OpenCV是BGR,PIL是RGB) +# pil_image = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) +# draw = ImageDraw.Draw(pil_image) +# # 这里选择合适的中文字体文件路径,比如系统自带的宋体(不同系统路径可能有差异),并设置字体大小 +# font = ImageFont.truetype(font_path, 15) +# # 在指定位置绘制中文 +# draw.text((left + 12, bottom + 12), name, font=font, fill=(255, 255, 255)) +# # 再将PIL图像转换回OpenCV图像格式 +# frame = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) +# cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2) +# else: +# name = "未在人脸库中,无操作权限" +# pil_image = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) +# draw = ImageDraw.Draw(pil_image) +# #设置字体大小 +# font = ImageFont.truetype(font_path, 15) +# # 在指定位置绘制中文 +# draw.text((left + 12, bottom + 12), name, font=font, fill=(255, 255, 255)) +# # 再将PIL图像转换回OpenCV图像格式 +# frame = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) +# cv2.rectangle(frame, (left, top), (right, bottom), (255, 0, 0), 2) +# self.image_signal.emit(frame) +# else: +# err_message = "Camera read timeout, URL = " + self.camera_url_str +# print_error_msg(err_message) +# break + +# except Exception as e: +# err_message = "Camera read exception, URL = " + self.camera_url_str +# print_error_msg(err_message) +# if self.running: +# time.sleep(2) +# break + +# if self.cap: +# self.cap.release() +# self.cap = None + +# print_inform_msg("Camera connection ended") +# time.sleep(0.01) + diff --git a/QT5_Project/Shared_CODE/DialogFaceView.py b/QT5_Project/Shared_CODE/DialogFaceView.py new file mode 100644 index 0000000..50620d8 --- /dev/null +++ b/QT5_Project/Shared_CODE/DialogFaceView.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +from __future__ import annotations +import sys, os, io, csv, time, datetime +from typing import Callable, Optional + +# PyQt5 +from PyQt5 import QtWidgets, uic +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer, QSize +from PyQt5.QtGui import QImage, QPixmap +from PyQt5.QtWidgets import ( + QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, + QLabel, QPushButton, QComboBox, QTextEdit, QFileDialog, QMessageBox, + QGroupBox, QGridLayout, QDialog, QFormLayout, QSpinBox, QCheckBox, + QLineEdit, QTableWidget, QTableWidgetItem +) +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +import cv2 +from PIL import Image +import serial +import serial.tools.list_ports + +# ---------- 协议导入---------- +from Shared_CODE.FaceRecognitionProtocol import ( + build_reset, build_uvc_view, build_face_view, build_verify, + build_enroll_itg_single, build_delete_all, build_get_all_userid,build_delete_user, + MID_REPLY, MID_NOTE, CMD_ENROLL, CMD_ENROLL_ITG, + parse_reply, parse_note +) + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../Shared_UI')) +users_ui_file_path = os.path.join(ui_path, "users.ui") +verify_ui_file_path = os.path.join(ui_path, "verify.ui") +enrill_ui_file_path = os.path.join(ui_path, "enroll.ui") + +CSV_FILE = os.path.join(ui_path, "users.csv") +# -------------------- CSV 工具 --------------------" + +def load_users(): + users = [] + try: + with open(CSV_FILE, "r", encoding="utf-8") as f: + reader = csv.reader(f) + for row in reader: + if len(row) >= 2: + user = {"user_id": row[0], "user_name": row[1]} + user["created_at"] = row[2] if len(row) >= 3 else "" + users.append(user) + except FileNotFoundError: + pass + return users + + +def save_users_list(users): + with open(CSV_FILE, "w", newline="", encoding="utf-8") as f: + w = csv.writer(f) + for u in users: + w.writerow([u.get("user_id", ""), u.get("user_name", ""), u.get("created_at", "")]) + + +def save_user(user_id: int, user_name: str) -> bool: + users = load_users() + for u in users: + if str(u["user_id"]) == str(user_id): + return False + created_at = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + users.append({"user_id": str(user_id), "user_name": user_name, "created_at": created_at}) + save_users_list(users) + return True + +class UserManageDialog(QDialog): + def __init__(self, parent, send_func): + super().__init__(parent) + uic.loadUi(users_ui_file_path, self) + self.send_func = send_func + self.btn_delete.clicked.connect(self.delete_selected) + self.btn_refresh.clicked.connect(self.refresh) + self.btn_get.clicked.connect(self.get_from_device) + self.btn_del_all.clicked.connect(self.delete_all_users) + self.refresh() + + + def refresh(self): + users = load_users() + self.table.setRowCount(len(users)) + for r, u in enumerate(users): + self.table.setItem(r, 0, QTableWidgetItem(str(u.get("user_id", "")))) + self.table.setItem(r, 1, QTableWidgetItem(u.get("user_name", ""))) + self.table.setItem(r, 2, QTableWidgetItem(u.get("created_at", ""))) + + def delete_selected(self): + row = self.table.currentRow() + if row < 0: + QMessageBox.warning(self, "提示", "请选择要删除的用户") + return + uid = self.table.item(row, 0).text() + uname = self.table.item(row, 1).text() + try: + uid_int = int(uid) + self.send_func(build_delete_user(uid_int)) + except: + pass + users = [u for u in load_users() if str(u["user_id"]) != uid] + save_users_list(users) + self.refresh() + QMessageBox.information(self, "提示", f"用户 {uname}(ID={uid}) 已删除") + + def get_from_device(self): + self.send_func(build_get_all_userid()) + + def delete_all_users(self): + self.send_func(build_delete_all()) + save_users_list([]) + self.refresh() + QMessageBox.information(self, "提示", "已请求删除所有用户并清空本地记录") + +class VerifyDialog(QDialog): + def __init__(self, parent=None): + super().__init__(parent) + uic.loadUi(verify_ui_file_path, self) + self.cb_rightaway.setCurrentIndex(0) + self.sb_timeout.setValue(10) + self.btn_ok.clicked.connect(self.accept) + + def values(self): + pd_val = self.cb_rightaway.currentIndex() + timeout_val = self.sb_timeout.value() + return pd_val, timeout_val + + +class EnrollItgSingleDialog(QDialog): + def __init__(self, parent=None): + super().__init__(parent) + uic.loadUi(enrill_ui_file_path, self) + self.cb_admin.setCurrentIndex(0) + self.btn_ok.clicked.connect(self.accept) + + def values(self): + admin_val = self.cb_admin.currentIndex() + uname = self.le_name.text().strip()[:32] + face_dir = 0 + if self.chk_mid.isChecked(): face_dir |= 0x01 + if self.chk_right.isChecked(): face_dir |= 0x02 + if self.chk_left.isChecked(): face_dir |= 0x04 + if self.chk_down.isChecked(): face_dir |= 0x08 + if self.chk_up.isChecked(): face_dir |= 0x10 + if face_dir == 0: face_dir = 0x01 + timeout_val = self.sb_timeout.value() + try: + itg_val = int(self.le_itg.text().strip(), 0) + except ValueError: + itg_val = 0 + return admin_val, uname, face_dir, timeout_val, itg_val + +if __name__ == '__main__': + app = QApplication(sys.argv) + dialog = UserManageDialog() + dialog.exec() + sys.exit(0) diff --git a/QT5_Project/Shared_CODE/FaceRecognitionProtocol.py b/QT5_Project/Shared_CODE/FaceRecognitionProtocol.py new file mode 100644 index 0000000..f4534f3 --- /dev/null +++ b/QT5_Project/Shared_CODE/FaceRecognitionProtocol.py @@ -0,0 +1,382 @@ +# -*- coding: utf-8 -*- +from __future__ import annotations +import struct +from dataclasses import dataclass +from typing import Optional, Tuple, List + +SYNC = b"\xEF\xAA" + +# Msg IDs +MID_REPLY = 0x00 +MID_NOTE = 0x01 +MID_IMAGE = 0x02 + +# Host->Module (Command) IDs (subset used by the tool) +CMD_RESET = 0x10 +CMD_GET_STATUS = 0x11 +CMD_VERIFY = 0x12 +CMD_ENROLL = 0x13 +CMD_DELETE_USER = 0x20 +CMD_DELETE_ALL = 0x21 +CMD_GET_USER_INFO = 0x22 +CMD_FACE_RESET = 0x23 +CMD_GET_ALL_USERID = 0x24 +CMD_ENROLL_ITG = 0x26 +CMD_GET_VERSION = 0x30 +CMD_INIT_ENCRYPTION = 0x50 +CMD_SET_RELEASE_KEY = 0x52 +CMD_SET_DEBUG_KEY = 0x53 +CMD_GET_SN = 0x93 + +CMD_READ_USB_UVC = 0xB0 +CMD_SET_USB_UVC = 0xB1 +CMD_FACE_VIEW = 0xB5 + +CMD_UVC_VIEW = 0xC0 + +CMD_UPGRADE_FW = 0xF6 +CMD_ENROLL_WITH_PHOTO = 0xF7 +CMD_LED_CONTROL = 0xF9 + +CMD_ENROLL_SINGLE = 0x1D +CMD_DEMO_MODE = 0xFE + +# NOTE nids +NID_READY = 0x00 +NID_FACE_STATE = 0x01 +NID_UNKNOWNERROR = 0x02 +NID_OTA_DONE = 0x03 +NID_EYE_STATE = 0x04 + +# REPLY result codes (partial) +MR_SUCCESS = 0x00 +MR_REJECTED = 0x01 +MR_ABORTED = 0x02 +MR_FAILED4_CAMERA = 0x04 +MR_FAILED4_UNKNOWNREASON = 0x05 +MR_FAILED4_INVALIDPARAM = 0x06 +MR_FAILED4_NOMEMORY = 0x07 +MR_FAILED4_UNKNOWNUSER = 0x08 +MR_FAILED4_MAXUSER = 0x09 +MR_FAILED4_FACEENROLLED = 0x0A +MR_FAILED4_LIVENESSCHECK = 0x0C +MR_FAILED4_TIMEOUT = 0x0D +MR_FAILED4_AUTHORIZATION = 0x0E +MR_FAILED4_READ_FILE = 0x13 +MR_FAILED4_WRITE_FILE = 0x14 +MR_FAILED4_NO_ENCRYPT = 0x15 +MR_FAILED4_NO_RGBIMAGE = 0x17 +MR_FAILED4_JPGPHOTO_LARGE = 0x18 +MR_FAILED4_JPGPHOTO_SMALL = 0x19 + +# ---- 映射表 ---- +# 指令名称映射(指令ID -> 中文名称) +CMD_NAMES = { + CMD_RESET: "复位", + CMD_GET_STATUS: "获取状态", + CMD_VERIFY: "人脸验证", + CMD_LED_CONTROL: "LED控制", + CMD_ENROLL: "人脸录入(多帧)", + CMD_ENROLL_SINGLE: "人脸录入(单帧)", + CMD_ENROLL_ITG: "人脸录入(集成式)", + CMD_DELETE_USER: "删除单个用户", + CMD_DELETE_ALL: "删除所有用户", + CMD_GET_USER_INFO: "获取用户信息", + CMD_GET_ALL_USERID: "获取所有用户ID", + CMD_GET_VERSION: "获取版本信息", + CMD_INIT_ENCRYPTION: "初始化加密", + CMD_ENROLL_WITH_PHOTO: "照片录入注册", +} + +# 结果码名称映射(结果码 -> 中文名称) +RESULT_NAMES = { + 0x00: "成功", + 0x01: "被拒绝", + 0x02: "已中止", + 0x04: "失败:相机异常", + 0x05: "失败:未知错误", + 0x06: "失败:参数无效", + 0x07: "失败:内存不足", + 0x08: "失败:用户不存在", + 0x09: "失败:超过最大用户数", + 0x0A: "失败:已录入该用户", + 0x0C: "失败:活体检测未通过", + 0x0D: "失败:超时", + 0x0E: "失败:认证失败", + 0x13: "失败:文件读取错误", + 0x14: "失败:文件写入错误", + 0x15: "失败:未启用加密", + 0x17: "失败:无RGB图像", + 0x18: "失败:JPG文件过大", + 0x19: "失败:JPG文件过小", +} + +# 通知状态名称映射(状态码 -> 中文名称) +NOTE_NAMES = { + 0x00: "就绪", + 0x01: "人脸状态", + 0x02: "未知错误", + 0x03: "OTA升级完成", + 0x04: "眼睛状态", +} + +# 帧头同步字 +SYNC = b"\xEF\xAA" + +def xor_checksum(data: bytes) -> int: + """ + 计算异或校验 (XOR),范围为整个帧的 MsgID + Size + Data 部分, + 不包括 SYNC(2字节) 和最后的校验字节本身。 + """ + chk = 0 + for b in data: + chk ^= b + return chk & 0xFF + + +def pack_frame(msg_id: int, data: bytes = b"") -> bytes: + """ + 封装一帧数据 + 格式: SYNC(2) + MsgID(1) + Size(2) + Data(N) + Chk(1) + - MsgID: 命令字 + - Size : Data 长度 (big endian, 2字节) + - Data : 负载 + - Chk : 校验 = MsgID..Data 的所有字节异或 + """ + size = struct.pack(">H", len(data)) # 大端编码 + head = bytes([msg_id]) + size + data # MsgID + Size + Data + chk = xor_checksum(head) # 计算校验 + return SYNC + head + bytes([chk]) # 拼装完整帧 + + +def unpack_frame(buf: bytes) -> Tuple[Optional[dict], int]: + """ + 尝试从缓冲区中解析出一帧。 + 返回: (frame_dict, consumed_bytes) + - 如果没有完整帧: (None, 0) + - 如果解析成功: ({"msg_id":..,"size":..,"data":..,"raw":..}, 已消耗字节数) + - 如果校验失败: ({"error":"checksum","raw":..}, 已消耗字节数) + + buf: 原始接收缓冲区 + """ + if len(buf) < 6: # 最小帧长: SYNC(2) + MsgID(1) + Size(2) + Chk(1) + return None, 0 + + # 查找 SYNC + idx = buf.find(SYNC) + if idx == -1: + # 没找到帧头,整个缓冲区丢弃 + return None, len(buf) + + # 余下字节不足以解析长度字段,继续等待 + if len(buf) - idx < 6: + return None, 0 + + msg_id = buf[idx+2] + size = struct.unpack(">H", buf[idx+3:idx+5])[0] + total = 2 + 1 + 2 + size + 1 # 整个帧长度 + + # 数据不完整,继续等待 + if len(buf) - idx < total: + return None, 0 + + # 截取一帧 + frame = buf[idx: idx+total] + content = frame[2:-1] # 不包括 SYNC 和最后的校验字节 + chk = frame[-1] + + # 校验 + if xor_checksum(content) != chk: + return {"error": "checksum", "raw": frame}, total + + # 提取有效载荷 + data = frame[5:-1] + return { + "msg_id": msg_id, + "size": size, + "data": data, + "raw": frame + }, total + +# ------ Builders for key commands ------ + +def build_reset() -> bytes: + return pack_frame(CMD_RESET) + +def build_get_status() -> bytes: + return pack_frame(CMD_GET_STATUS) + +def build_led_control(state: int) -> bytes: + """ + 构建LED控制指令帧(0xF9指令),符合校验位逻辑 + :param state: LED状态值,0=灭,1=亮 + """ + # 数据部分:1字节状态值(根据模组要求定义,如0x00=灭,0x01=亮) + data = struct.pack("B", state & 0xFF) # 确保是单字节 + return pack_frame(CMD_LED_CONTROL, data) # CMD_LED_CONTROL = 0xF9 + +#pd_rightaway: int,验证成功后是否立即断电(0=不立即断电,1=立即断电),仅保留低8位有效(通过&0xFF确保) +#timeout: int,验证超时时间(单位:秒),范围通常为1-255秒,仅保留低8位有效(通过&0xFF确保) +def build_verify(pd_rightaway: int = 0, timeout: int = 10) -> bytes: + data = struct.pack("BB", pd_rightaway & 0xFF, timeout & 0xFF) + return pack_frame(CMD_VERIFY, data) + +def build_enroll(admin: int, user_name: str, face_dir: int, timeout: int = 10) -> bytes: + name_bytes = user_name.encode("utf-8")[:32] + name_bytes = name_bytes + bytes(32 - len(name_bytes)) + data = struct.pack("B", admin & 0xFF) + name_bytes + struct.pack("BB", face_dir & 0xFF, timeout & 0xFF) + return pack_frame(CMD_ENROLL, data) + +def build_enroll_single(admin: int, user_name: str, timeout: int = 10) -> bytes: + name_bytes = user_name.encode("utf-8")[:32] + name_bytes = name_bytes + bytes(32 - len(name_bytes)) + # face_dir not used per manual for ENROLL_SINGLE + data = struct.pack("B", admin & 0xFF) + name_bytes + struct.pack("BB", 0x00, timeout & 0xFF) + return pack_frame(0x1D, data) + +def build_enroll_itg_single(admin: int, user_name: str, face_dir: int, timeout: int, itg_param: int) -> bytes: + """ + 构造 ENROLL_ITG_SINGLE 命令帧 + admin: 0=普通用户, 1=管理员 + user_name: 最多 32 字节 + face_dir: 人脸方向 bitmask + timeout: 超时时间 (秒) + itg_param: ITG 参数 (4 字节) + """ + # user_name 补齐到 32 字节 + name_bytes = user_name.encode("utf-8")[:32] + name_bytes = name_bytes.ljust(32, b"\x00") + + payload = struct.pack( + ">B32sBBI", + admin & 0xFF, + name_bytes, + face_dir & 0xFF, + timeout & 0xFF, + itg_param & 0xFFFFFFFF, + ) + return pack_frame(CMD_ENROLL_ITG, payload) + +def build_delete_user(user_id: int) -> bytes: + return pack_frame(CMD_DELETE_USER, struct.pack("BB", (user_id>>8)&0xFF, user_id&0xFF)) + +def build_delete_all() -> bytes: + return pack_frame(CMD_DELETE_ALL) + +def build_get_user_info(user_id: int) -> bytes: + return pack_frame(CMD_GET_USER_INFO, struct.pack("BB", (user_id>>8)&0xFF, user_id&0xFF)) + +def build_get_all_userid() -> bytes: + return pack_frame(CMD_GET_ALL_USERID) + +def build_get_version() -> bytes: + return pack_frame(CMD_GET_VERSION) + +def build_uvc_view(state: int) -> bytes: + return pack_frame(CMD_UVC_VIEW, struct.pack("B", state & 0xFF)) + +def build_face_view(state: int) -> bytes: + return pack_frame(CMD_FACE_VIEW, struct.pack("B", state & 0xFF)) + +def build_init_encryption(seed4: bytes, mode: int = 0) -> bytes: + if len(seed4) != 4: + raise ValueError("seed must be 4 bytes") + return pack_frame(CMD_INIT_ENCRYPTION, seed4 + bytes([mode & 0xFF])) + +def build_enroll_with_photo_begin(photo_size: int) -> bytes: + # According to manual: Seq=0, Photo data=4-byte big-endian size + data = b"\x00\x00" + struct.pack(">I", photo_size) + return pack_frame(CMD_ENROLL_WITH_PHOTO, data) + +def build_enroll_with_photo_chunk(seq: int, chunk: bytes) -> bytes: + # Seq starts from 1 and increases; MTU=246 + data = struct.pack(">H", seq & 0xFFFF) + chunk + return pack_frame(CMD_ENROLL_WITH_PHOTO, data) + +# ---- Parsers (Reply / Note / Image) ---- +def parse_reply(data: bytes) -> dict: + if len(data) < 2: + return {"type":"REPLY","error":"short"} + mid = data[0] + result = data[1] + rest = data[2:] + + # 初始化 info 字典 + info = { + "type":"REPLY", + "mid": mid, + "mid_name": CMD_NAMES.get(mid, f"0x{mid:02X}"), + "result": result, + "result_name": RESULT_NAMES.get(result, f"0x{result:02X}") + } + + if mid == CMD_VERIFY and len(rest) >= 36: + uid = (rest[0]<<8)|rest[1] + name = rest[2:34].rstrip(b"\x00").decode("utf-8", errors="ignore") + admin = rest[34] + unlock = rest[35] + info.update({"user_id": uid, "user_name": name, "admin": admin, "unlock_status": unlock}) + + elif mid in (CMD_ENROLL, 0x1D, CMD_ENROLL_ITG) and len(rest) >= 3: + uid = (rest[0]<<8)|rest[1] + face_dir = rest[2] + info.update({"user_id": uid, "face_direction": face_dir}) + + elif mid == CMD_GET_STATUS and len(rest) >= 1: + status = rest[0] + info.update({"status": status, "status_name": { + 0: "空闲", + 1: "录入中", + 2: "验证中" + }.get(status, f"0x{status:02X}")}) + + elif mid == CMD_GET_USER_INFO and len(rest) >= 35: + uid = (rest[0]<<8)|rest[1] + name = rest[2:34].decode("ascii", errors="ignore") + admin = rest[34] + info.update({"user_id": uid, "user_name": name, "admin": admin}) + + elif mid == CMD_GET_ALL_USERID and len(rest) >= 1: + n = rest[0] + ids = [(rest[i]<<8)|rest[i+1] for i in range(1, 1+2*n, 2) if i+1 < len(rest)] + info.update({"count": n, "user_ids": ids}) + + elif mid == CMD_GET_VERSION: + info["version_str"] = rest.decode("ascii", errors="ignore") + + elif mid == CMD_LED_CONTROL and len(rest) >= 1: + led_state = rest[0] + info.update({"led_state": led_state, "led_state_name": { + 0: "灭", + 1: "亮" + }.get(led_state, f"0x{led_state:02X}")}) + + elif mid == CMD_ENROLL_WITH_PHOTO: + if len(rest) >= 2: + seq = (rest[0]<<8)|rest[1] + info["seq"] = seq + if len(rest) >= 6: + uid = (rest[2]<<8)|rest[3] + info["user_id"] = uid + + return info + +def parse_note(data: bytes) -> dict: + if len(data) < 1: + return {"type":"NOTE","error":"short"} + nid = data[0] + rest = data[1:] + info = {"type":"NOTE","nid": nid, "nid_name": NOTE_NAMES.get(nid, f"0x{nid:02X}")} + + if nid == NID_FACE_STATE and len(rest) >= 16: + vals = struct.unpack(">hhhhhhhh", rest[:16]) + info.update({ + "state": vals[0], + "left": vals[1], "top": vals[2], "right": vals[3], "bottom": vals[4], + "yaw": vals[5], "pitch": vals[6], "roll": vals[7] + }) + + return info + +def parse_image(data: bytes) -> dict: + return {"type":"IMAGE","jpeg":data} diff --git a/QT5_Project/Shared_CODE/__pycache__/CameraThread.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/CameraThread.cpython-311.pyc index 84048c1..f149ab4 100644 Binary files a/QT5_Project/Shared_CODE/__pycache__/CameraThread.cpython-311.pyc and b/QT5_Project/Shared_CODE/__pycache__/CameraThread.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/DialogInform.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/DialogInform.cpython-311.pyc index 892605e..fb7372f 100644 Binary files a/QT5_Project/Shared_CODE/__pycache__/DialogInform.cpython-311.pyc and b/QT5_Project/Shared_CODE/__pycache__/DialogInform.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/DialogModifyAlias.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/DialogModifyAlias.cpython-311.pyc index 6e81536..bd5d1cc 100644 Binary files a/QT5_Project/Shared_CODE/__pycache__/DialogModifyAlias.cpython-311.pyc and b/QT5_Project/Shared_CODE/__pycache__/DialogModifyAlias.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/DialogModifyText.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/DialogModifyText.cpython-311.pyc index 6c97ba4..0dff932 100644 Binary files a/QT5_Project/Shared_CODE/__pycache__/DialogModifyText.cpython-311.pyc and b/QT5_Project/Shared_CODE/__pycache__/DialogModifyText.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/DialogModifyValue.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/DialogModifyValue.cpython-311.pyc index f10ee1f..a26d401 100644 Binary files a/QT5_Project/Shared_CODE/__pycache__/DialogModifyValue.cpython-311.pyc and b/QT5_Project/Shared_CODE/__pycache__/DialogModifyValue.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/__init__.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/__init__.cpython-311.pyc index 37a1170..7c5810a 100644 Binary files a/QT5_Project/Shared_CODE/__pycache__/__init__.cpython-311.pyc and b/QT5_Project/Shared_CODE/__pycache__/__init__.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/get_tip_prop.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/get_tip_prop.cpython-311.pyc index 7c7c4bf..36a5c51 100644 Binary files a/QT5_Project/Shared_CODE/__pycache__/get_tip_prop.cpython-311.pyc and b/QT5_Project/Shared_CODE/__pycache__/get_tip_prop.cpython-311.pyc differ diff --git a/QT5_Project/Shared_UI/FaceRecognition.ui b/QT5_Project/Shared_UI/FaceRecognition.ui new file mode 100644 index 0000000..8da125d --- /dev/null +++ b/QT5_Project/Shared_UI/FaceRecognition.ui @@ -0,0 +1,123 @@ + + + DialogInform + + + + 0 + 0 + 587 + 290 + + + + Dialog + + + false + + + border:none; +background-color: rgba(0, 0, 0, 0); + + + + + 110 + 160 + 381 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::NoButton + + + + + + 75 + 97 + 411 + 51 + + + + + Microsoft YaHei UI + 16 + false + false + + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 0); +font: 16pt "Microsoft YaHei UI"; + + + TextLabel + + + Qt::AlignCenter + + + + + + 0 + 0 + 731 + 291 + + + + + + + img/infrom.png + + + BG + buttonBox + label + + + + + buttonBox + accepted() + DialogInform + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogInform + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/QT5_Project/Shared_UI/enroll.ui b/QT5_Project/Shared_UI/enroll.ui new file mode 100644 index 0000000..992d391 --- /dev/null +++ b/QT5_Project/Shared_UI/enroll.ui @@ -0,0 +1,144 @@ + + + EnrollDialog + + + + 0 + 0 + 480 + 254 + + + + ENROLL_ITG_SINGLE + + + + + + 是否管理员: + + + + + + + + 0 - 普通用户 + + + + + 1 - 管理员 + + + + + + + + 用户名: + + + + + + + + + + 人脸方向: + + + + + + + 人脸方向 + + + + + + MID + + + + + + + RIGHT + + + + + + + LEFT + + + + + + + DOWN + + + + + + + UP + + + + + + + + + + 超时时间(秒): + + + + + + + 1 + + + 300 + + + 10 + + + + + + + ITG 参数: + + + + + + + 0 + + + + + + + 发送 + + + + + + + + diff --git a/QT5_Project/Shared_UI/main.ui b/QT5_Project/Shared_UI/main.ui new file mode 100644 index 0000000..bd31b54 --- /dev/null +++ b/QT5_Project/Shared_UI/main.ui @@ -0,0 +1,104 @@ + + + MainWindow + + + 人脸识别测试软件 (PyQt5) + + + + + 8 + + + + + + + 串口设置 + + + Port: + + Baud: + + 刷新端口 + 连接 + + + + + + + + + Qt::Horizontal + + + + + 命令 + + 6 + 复位 + 视频模式 + 显示人脸框 + 识别 + ITG注册 + 用户管理 + + + Qt::Vertical + + 2040 + + + + + + + + + USB 视频流 + + 6 + + + 未打开 + Qt::AlignCenter + 360480 + QFrame::Box + QFrame::Sunken + + + 打开视频 + + + + + + + + + 日志 + + 6 + + + true + + Consolas10 + + + + 保存日志 + + + + + + + + + + diff --git a/QT5_Project/Shared_UI/users.csv b/QT5_Project/Shared_UI/users.csv new file mode 100644 index 0000000..41bb842 --- /dev/null +++ b/QT5_Project/Shared_UI/users.csv @@ -0,0 +1 @@ +1,冯佳,2025-09-02 09:05:45 diff --git a/QT5_Project/Shared_UI/users.ui b/QT5_Project/Shared_UI/users.ui new file mode 100644 index 0000000..290b3e3 --- /dev/null +++ b/QT5_Project/Shared_UI/users.ui @@ -0,0 +1,31 @@ + + + UserManageDialog + + 用户管理 + + + + + 用户ID + + + 用户名 + + + 注册时间 + + + + + + 删除选中用户 + 刷新 + 获取设备用户列表 + 删除所有用户 + Qt::Horizontal + + + + + diff --git a/QT5_Project/Shared_UI/verify.ui b/QT5_Project/Shared_UI/verify.ui new file mode 100644 index 0000000..875b753 --- /dev/null +++ b/QT5_Project/Shared_UI/verify.ui @@ -0,0 +1,69 @@ + + + VerifyDialog + + + + 0 + 0 + 480 + 100 + + + + VERIFY + + + + + + 是否立即比对: + + + + + + + + 0 - 等待检测人脸 + + + + + 1 - 立即比对 + + + + + + + + 超时时间(秒): + + + + + + + 1 + + + 300 + + + 10 + + + + + + + 发送 + + + + + + + + diff --git a/main.py b/main.py new file mode 100644 index 0000000..12d68af --- /dev/null +++ b/main.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +from kivy.app import App +from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem +from kivy.uix.boxlayout import BoxLayout +from kivy.uix.label import Label +from kivy.uix.button import Button +from kivy.clock import Clock +import threading + +from comm_modbus_device import class_modbus_comm_device +from menu_mine import mqtt_pack_measure, mqtt_pack_param, mqtt_pack_alarm + +class DataTab(BoxLayout): + def __init__(self, device, data_pack, title, **kwargs): + super().__init__(orientation='vertical', **kwargs) + self.device = device + self.data_pack = data_pack + self.labels = {} + self.title = title + self.build_ui() + + def build_ui(self): + title_label = Label(text=f"[b]{self.title}[/b]", markup=True, size_hint_y=None, height=40) + self.add_widget(title_label) + + for item in self.data_pack: + name = item.get("name") + label = Label(text=f"{name}: --", size_hint_y=None, height=30) + self.labels[name] = label + self.add_widget(label) + + refresh_btn = Button(text="Refresh", size_hint_y=None, height=40) + refresh_btn.bind(on_press=self.refresh_data) + self.add_widget(refresh_btn) + + def refresh_data(self, instance): + def _task(): + for item in self.data_pack: + try: + name = item.get("name") + value = self.device.comm_get_value_from_menu_item(item) + if value is not None: + text = f"{name}: {value}" + else: + text = f"{name}: Read failed" + Clock.schedule_once(lambda dt, n=name, t=text: self.update_label(n, t)) + except Exception as e: + Clock.schedule_once(lambda dt: self.update_label(name, f"{name}: Error")) + threading.Thread(target=_task, daemon=True).start() + + def update_label(self, name, text): + if name in self.labels: + self.labels[name].text = text + +class MainPanel(TabbedPanel): + def __init__(self, device, **kwargs): + super().__init__(**kwargs) + self.do_default_tab = False + + self.measure_tab = DataTab(device, mqtt_pack_measure, "Measurements") + self.add_widget(self.create_tab("Measure", self.measure_tab)) + + self.param_tab = DataTab(device, mqtt_pack_param, "Parameters") + self.add_widget(self.create_tab("Params", self.param_tab)) + + self.alarm_tab = DataTab(device, mqtt_pack_alarm, "Alarms") + self.add_widget(self.create_tab("Alarms", self.alarm_tab)) + + def create_tab(self, tab_title, content_widget): + tab = TabbedPanelItem(text=tab_title) + tab.add_widget(content_widget) + return tab + +class ModbusTabbedApp(App): + def build(self): + self.device = class_modbus_comm_device() + from modbus_tk import modbus_tcp + self.device.master = modbus_tcp.TcpMaster('192.168.1.119', 502) + self.device.master.set_timeout(5.0) + # self.device.set_slave_id(1) + return MainPanel(self.device) + +if __name__ == '__main__': + ModbusTabbedApp().run() diff --git a/uart_group_config.py b/uart_group_config.py index 7305212..86d9869 100644 --- a/uart_group_config.py +++ b/uart_group_config.py @@ -2,6 +2,13 @@ mqtt_server = {"remote":"192.168.1.59", "port":1883, "user_name": " # mqtt_server = {"remote":"192.168.1.70", "port":1883, "user_name": "admin", "password": "miler502"} # mqtt_server = {"remote":"127.0.0.1", "port":1883, "user_name": "admin", "password": "miler502"} +#人脸识别串口模块配置 +DEFAULT_PORT = { + "Windows": "COM9", + "Linux": "/dev/ttyUSB0", + "Darwin": "/dev/tty.usbserial-0001", +} +BAUDRATE = 115200 #UART列表可以有多个设备, unique_name 应用于MQTT协议, 用于区分设备 uart_list1 = [