#!/usr/bin/env python
# -*- encoding: utf-8 -*-

import os
from ui.own.frame_theme import MyFrame
from ui.own.palette_theme import set_edt_bg
from utils.qt import QtWidgets, QtGui, QIcon, QPixmap, Qt, QColor
from utils.resource import resource_path
from utils.globalvar import SD


class UnderPage(QtWidgets.QWidget):

    def __init__(self, parent=None):
        super(UnderPage, self).__init__(parent)
        self.initUI()

    def initUI(self):
        self.verticalLayout = QtWidgets.QVBoxLayout(self)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)

        # 设置参数
        self.under_widget = MyFrame(self)
        self.under_layout = QtWidgets.QHBoxLayout(self.under_widget)
        self.under_layout.setContentsMargins(0, 0, 0, 0)
        self.under_layout.setSpacing(0)
        self.under_left_groupbox = QtWidgets.QGroupBox(self.under_widget)
        self.under_left_groupbox.setTitle("运行状态")
        self.under_left_groupbox_layout = QtWidgets.QGridLayout(self.under_left_groupbox)

        self.lb_status = QtWidgets.QLabel("（灰色：断开/状态不成立 绿色：闭合/状态成立  红色：禁止）")
        self.under_left_groupbox_layout.addWidget(self.lb_status, 0, 8, 1, 9)

        self.sys_status = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.sys_status.setText("系统状态")
        self.sys_status.setAlignment(Qt.AlignCenter)
        self.sys_status.setReadOnly(True)
        set_edt_bg(self.sys_status, QColor("#99CC99"))
        self.under_left_groupbox_layout.addWidget(self.sys_status, 1, 0, 1, 2)

        # spacerItem1 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        # self.under_left_groupbox_layout.addItem(spacerItem1)

        self.sys_status_no = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.sys_status_no.setText("低压上电")
        self.sys_status_no.setAlignment(Qt.AlignCenter)
        self.sys_status_no.setReadOnly(True)
        set_edt_bg(self.sys_status_no, QColor(Qt.gray))
        self.under_left_groupbox_layout.addWidget(self.sys_status_no, 1, 3, 1, 2)

        self.sys_status_high_no = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.sys_status_high_no.setText("待机")
        self.sys_status_high_no.setAlignment(Qt.AlignCenter)
        self.sys_status_high_no.setReadOnly(True)
        set_edt_bg(self.sys_status_high_no, QColor(Qt.gray))
        self.under_left_groupbox_layout.addWidget(self.sys_status_high_no, 1, 5, 1, 4)

        # self.sys_status_high_no = QtWidgets.QLineEdit(self.under_left_groupbox)
        # self.sys_status_high_no.setText("高压待机")
        # self.sys_status_high_no.setAlignment(Qt.AlignCenter)
        # self.sys_status_high_no.setReadOnly(True)
        # set_edt_bg(self.sys_status_high_no, QColor(Qt.gray))
        # self.under_left_groupbox_layout.addWidget(self.sys_status_high_no, 1, 7, 1, 2)

        self.sys_status_chg = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.sys_status_chg.setText("充电")
        self.sys_status_chg.setAlignment(Qt.AlignCenter)
        self.sys_status_chg.setReadOnly(True)
        set_edt_bg(self.sys_status_chg, QColor(Qt.gray))
        self.under_left_groupbox_layout.addWidget(self.sys_status_chg, 1, 9, 1, 2)

        self.sys_status_dchg = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.sys_status_dchg.setText("放电")
        self.sys_status_dchg.setAlignment(Qt.AlignCenter)
        self.sys_status_dchg.setReadOnly(True)
        set_edt_bg(self.sys_status_dchg, QColor(Qt.gray))
        self.under_left_groupbox_layout.addWidget(self.sys_status_dchg, 1, 11, 1, 2)

        self.sys_status_stop = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.sys_status_stop.setText("停机")
        self.sys_status_stop.setAlignment(Qt.AlignCenter)
        self.sys_status_stop.setReadOnly(True)
        set_edt_bg(self.sys_status_stop, QColor(Qt.gray))
        self.under_left_groupbox_layout.addWidget(self.sys_status_stop, 1, 13, 1, 2)

        self.sys_status_sleep = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.sys_status_sleep.setText("休眠")
        self.sys_status_sleep.setAlignment(Qt.AlignCenter)
        self.sys_status_sleep.setReadOnly(True)
        set_edt_bg(self.sys_status_sleep, QColor(Qt.gray))
        self.under_left_groupbox_layout.addWidget(self.sys_status_sleep, 1, 15, 1, 2)

        # self.sys_status_nononono = QtWidgets.QLabel("       ")
        # self.under_left_groupbox_layout.addWidget(self.sys_status_nononono, 0, 9, 1, 1)
        spacerItem2 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.under_left_groupbox_layout.addItem(spacerItem2)

        # self.up_and_down = QtWidgets.QLineEdit(self.under_left_groupbox)
        # self.up_and_down.setText("指令")
        # self.up_and_down.setAlignment(Qt.AlignCenter)
        # self.up_and_down.setReadOnly(True)
        # set_edt_bg(self.up_and_down, QColor("#99CC99"))
        # self.under_left_groupbox_layout.addWidget(self.up_and_down, 2, 0, 1, 2)

        # spacerItem2 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        # self.under_left_groupbox_layout.addItem(spacerItem2)

        # self.sys_up = QtWidgets.QLineEdit(self.under_left_groupbox)
        # self.sys_up.setText("上电")
        # self.sys_up.setAlignment(Qt.AlignCenter)
        # self.sys_up.setReadOnly(True)
        # set_edt_bg(self.sys_up, QColor(Qt.gray))
        # self.under_left_groupbox_layout.addWidget(self.sys_up, 2, 3, 1, 3)

        # self.sys_down = QtWidgets.QLineEdit(self.under_left_groupbox)
        # self.sys_down.setText("下电")
        # self.sys_down.setAlignment(Qt.AlignCenter)
        # self.sys_down.setReadOnly(True)
        # set_edt_bg(self.sys_down, QColor(Qt.gray))
        # self.under_left_groupbox_layout.addWidget(self.sys_down, 2, 6, 1, 3)

        # spacerItem2 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        # self.under_left_groupbox_layout.addItem(spacerItem2)
        if SD.CCU_TYPE == 1:
            self.do_status = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_status.setText("DO状态")
            self.do_status.setAlignment(Qt.AlignCenter)
            self.do_status.setReadOnly(True)
            set_edt_bg(self.do_status, QColor("#99CC99"))
            self.under_left_groupbox_layout.addWidget(self.do_status, 3, 0, 1, 3)

            spacerItem2 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
            self.under_left_groupbox_layout.addItem(spacerItem2)

            self.do_1 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_1.setText("主正接触器")
            self.do_1.setAlignment(Qt.AlignCenter)
            self.do_1.setReadOnly(True)
            set_edt_bg(self.do_1, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.do_1, 3, 3, 1, 3)

            self.do_2 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_2.setText("主负接触器")
            self.do_2.setAlignment(Qt.AlignCenter)
            self.do_2.setReadOnly(True)
            set_edt_bg(self.do_2, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.do_2, 3, 6, 1, 3)

            self.do_3 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_3.setText("预充接触器")
            self.do_3.setAlignment(Qt.AlignCenter)
            self.do_3.setReadOnly(True)
            set_edt_bg(self.do_3, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.do_3, 3, 9, 1, 3)

            self.do_4 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_4.setText("中间接触器")
            self.do_4.setAlignment(Qt.AlignCenter)
            self.do_4.setReadOnly(True)
            set_edt_bg(self.do_4, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.do_4, 3, 12, 1, 3)

            self.do_5 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_5.setText("断路器控制")
            self.do_5.setAlignment(Qt.AlignCenter)
            self.do_5.setReadOnly(True)
            set_edt_bg(self.do_5, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.do_5, 4, 3, 1, 3)

            self.do_6 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_6.setText("DO6")
            self.do_6.setAlignment(Qt.AlignCenter)
            self.do_6.setReadOnly(True)
            set_edt_bg(self.do_6, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.do_6, 4, 6, 1, 3)

            self.do_7 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_7.setText("DO7")
            self.do_7.setAlignment(Qt.AlignCenter)
            self.do_7.setReadOnly(True)
            set_edt_bg(self.do_7, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.do_7, 4, 9, 1, 3)

            self.do_8 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.do_8.setText("DO8")
            self.do_8.setAlignment(Qt.AlignCenter)
            self.do_8.setReadOnly(True)
            set_edt_bg(self.do_8, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.do_8, 4, 12, 1, 3)


            self.di_status = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_status.setText("DI状态")
            self.di_status.setAlignment(Qt.AlignCenter)
            self.di_status.setReadOnly(True)
            set_edt_bg(self.di_status, QColor("#99CC99"))
            self.under_left_groupbox_layout.addWidget(self.di_status, 5, 0, 1, 3)

            spacerItem2 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
            self.under_left_groupbox_layout.addItem(spacerItem2)

            self.di_1 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_1.setText("DI1")
            self.di_1.setAlignment(Qt.AlignCenter)
            self.di_1.setReadOnly(True)
            set_edt_bg(self.di_1, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.di_1, 5, 3, 1, 3)

            self.di_2 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_2.setText("DI2")
            self.di_2.setAlignment(Qt.AlignCenter)
            self.di_2.setReadOnly(True)
            set_edt_bg(self.di_2, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.di_2, 5, 6, 1, 3)

            self.di_3 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_3.setText("DI3")
            self.di_3.setAlignment(Qt.AlignCenter)
            self.di_3.setReadOnly(True)
            set_edt_bg(self.di_3, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.di_3, 5, 9, 1, 3)

            self.di_4 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_4.setText("DI4")
            self.di_4.setAlignment(Qt.AlignCenter)
            self.di_4.setReadOnly(True)
            set_edt_bg(self.di_4, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.di_4, 5, 12, 1, 3)

            self.di_5 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_5.setText("DI5")
            self.di_5.setAlignment(Qt.AlignCenter)
            self.di_5.setReadOnly(True)
            set_edt_bg(self.di_5, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.di_5, 6, 3, 1, 3)

            self.di_6 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_6.setText("DI6")
            self.di_6.setAlignment(Qt.AlignCenter)
            self.di_6.setReadOnly(True)
            set_edt_bg(self.di_6, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.di_6, 6, 6, 1, 3)

            self.di_7 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_7.setText("DI7")
            self.di_7.setAlignment(Qt.AlignCenter)
            self.di_7.setReadOnly(True)
            set_edt_bg(self.di_7, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.di_7, 6, 9, 1, 3)

            self.di_8 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.di_8.setText("DI8")
            self.di_8.setAlignment(Qt.AlignCenter)
            self.di_8.setReadOnly(True)
            set_edt_bg(self.di_8, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.di_8, 6, 12, 1, 3)
        else:
            # self.sys_sleep = QtWidgets.QLineEdit(self.under_left_groupbox)
            # self.sys_sleep.setText("休眠")
            # self.sys_sleep.setAlignment(Qt.AlignCenter)
            # self.sys_sleep.setReadOnly(True)
            # set_edt_bg(self.sys_sleep, QColor(Qt.gray))
            # self.under_left_groupbox_layout.addWidget(self.sys_sleep, 2, 9, 1, 3)

            self.mos_status = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.mos_status.setText("MOS状态")
            self.mos_status.setAlignment(Qt.AlignCenter)
            self.mos_status.setReadOnly(True)
            set_edt_bg(self.mos_status, QColor("#99CC99"))
            self.under_left_groupbox_layout.addWidget(self.mos_status, 3, 0, 1, 3)

            spacerItem2 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
            self.under_left_groupbox_layout.addItem(spacerItem2)

            self.mos_chg = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.mos_chg.setText("充电MOS")
            self.mos_chg.setAlignment(Qt.AlignCenter)
            self.mos_chg.setReadOnly(True)
            set_edt_bg(self.mos_chg, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.mos_chg, 3, 3, 1, 3)

            self.mos_dchg = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.mos_dchg.setText("放电MOS")
            self.mos_dchg.setAlignment(Qt.AlignCenter)
            self.mos_dchg.setReadOnly(True)
            set_edt_bg(self.mos_dchg, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.mos_dchg, 3, 6, 1, 3)

            self.mos_pre = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.mos_pre.setText("预充MOS")
            self.mos_pre.setAlignment(Qt.AlignCenter)
            self.mos_pre.setReadOnly(True)
            set_edt_bg(self.mos_pre, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.mos_pre, 3, 9, 1, 3)

            self.fjd_status = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.fjd_status.setText("干接点状态")
            self.fjd_status.setAlignment(Qt.AlignCenter)
            self.fjd_status.setReadOnly(True)
            set_edt_bg(self.fjd_status, QColor("#99CC99"))
            self.under_left_groupbox_layout.addWidget(self.fjd_status, 5, 0, 1, 3)

            spacerItem2 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
            self.under_left_groupbox_layout.addItem(spacerItem2)

            self.fjd_1 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.fjd_1.setText("干接点1")
            self.fjd_1.setAlignment(Qt.AlignCenter)
            self.fjd_1.setReadOnly(True)
            set_edt_bg(self.fjd_1, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.fjd_1, 5, 3, 1, 3)

            self.fjd_2 = QtWidgets.QLineEdit(self.under_left_groupbox)
            self.fjd_2.setText("干接点2")
            self.fjd_2.setAlignment(Qt.AlignCenter)
            self.fjd_2.setReadOnly(True)
            set_edt_bg(self.fjd_2, QColor(Qt.gray))
            self.under_left_groupbox_layout.addWidget(self.fjd_2, 5, 6, 1, 3)         

        self.chd_dsg_status = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.chd_dsg_status.setText("标志位")
        self.chd_dsg_status.setAlignment(Qt.AlignCenter)
        self.chd_dsg_status.setReadOnly(True)
        set_edt_bg(self.chd_dsg_status, QColor("#99CC99"))
        self.under_left_groupbox_layout.addWidget(self.chd_dsg_status, 7, 0, 1, 3)

        spacerItem2 = QtWidgets.QSpacerItem(30, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.under_left_groupbox_layout.addItem(spacerItem2)

        self.permit_chg = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.permit_chg.setText("禁止充电")
        self.permit_chg.setAlignment(Qt.AlignCenter)
        self.permit_chg.setReadOnly(True)
        set_edt_bg(self.permit_chg, QColor(Qt.gray))
        self.under_left_groupbox_layout.addWidget(self.permit_chg, 7, 3, 1, 3)

        self.permit_dchg = QtWidgets.QLineEdit(self.under_left_groupbox)
        self.permit_dchg.setText("禁止放电")
        self.permit_dchg.setAlignment(Qt.AlignCenter)
        self.permit_dchg.setReadOnly(True)
        set_edt_bg(self.permit_dchg, QColor(Qt.gray))
        self.under_left_groupbox_layout.addWidget(self.permit_dchg, 7, 6, 1, 3)

        self.under_layout.addWidget(self.under_left_groupbox, 1)

        self.under_right_groupbox = QtWidgets.QGroupBox(self.under_widget)
        self.under_right_groupbox.setTitle("控制指令")
        self.under_right_groupbox_layout = QtWidgets.QGridLayout(self.under_right_groupbox)

        self.btn_up = QtWidgets.QPushButton("系统上电")
        self.under_right_groupbox_layout.addWidget(self.btn_up, 0, 0, 1, 2)
        self.btn_down = QtWidgets.QPushButton("系统下电")
        self.under_right_groupbox_layout.addWidget(self.btn_down, 0, 2, 1, 2)

        self.lb_snkz = QtWidgets.QLabel("使能控制")
        self.under_right_groupbox_layout.addWidget(self.lb_snkz, 0, 4, 1, 1)
        self.snkz_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.snkz_check_box, 0, 5, 1, 1)

        self.lb_p = QtWidgets.QLabel("主正控制")
        self.p_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.lb_do7 = QtWidgets.QLabel("干接点1")
        self.do7_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)

        self.lb_n = QtWidgets.QLabel("主负控制")
        self.n_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.lb_do8 = QtWidgets.QLabel("干接点2")
        self.do8_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)

        self.lb_center = QtWidgets.QLabel("中间控制")
        self.center_check_box = QtWidgets.QCheckBox(self.under_right_groupbox) 

        self.lb_dlq = QtWidgets.QLabel("断路器控制")
        self.dlq_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)  

        self.lb_do6 = QtWidgets.QLabel("DO6")
        self.do6_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)  

        self.lb_chg_1 = QtWidgets.QLabel("充电控制")
        self.chg_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.lb_dchg_1 = QtWidgets.QLabel("放电控制")
        self.dchg_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.lb_gjd_1 = QtWidgets.QLabel("干接点1")
        self.gjd1_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.lb_gjd2_1 = QtWidgets.QLabel("干接点2")
        self.gjd2_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)


        if SD.CCU_TYPE == 1:
            self.chg_check_box.setHidden(True)
            self.dchg_check_box.setHidden(True)
            self.gjd1_check_box.setHidden(True)
            self.gjd2_check_box.setHidden(True)
            self.under_right_groupbox_layout.addWidget(self.lb_p, 1, 0, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.p_check_box, 1, 1, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.lb_n, 2, 0, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.n_check_box, 2, 1, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.lb_do7, 1, 3, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.do7_check_box, 1, 4, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.lb_do8, 2, 3, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.do8_check_box, 2, 4, 1, 1) 
            self.under_right_groupbox_layout.addWidget(self.lb_center, 4, 0, 1, 1) 
            self.under_right_groupbox_layout.addWidget(self.center_check_box, 4, 1, 1, 1) 
            self.under_right_groupbox_layout.addWidget(self.lb_dlq, 5, 0, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.dlq_check_box, 5, 1, 1, 1) 
            self.under_right_groupbox_layout.addWidget(self.lb_do6, 6, 0, 1, 1) 
            self.under_right_groupbox_layout.addWidget(self.do6_check_box, 6, 1, 1, 1) 
        else:
            self.p_check_box.setHidden(True)
            self.do7_check_box.setHidden(True)
            self.n_check_box.setHidden(True)
            self.do8_check_box.setHidden(True)
            self.center_check_box.setHidden(True)
            self.dlq_check_box.setHidden(True)
            self.do6_check_box.setHidden(True)
            self.under_right_groupbox_layout.addWidget(self.lb_chg_1, 1, 0, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.chg_check_box, 1, 1, 1, 1) 
            self.under_right_groupbox_layout.addWidget(self.lb_dchg_1, 2, 0, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.dchg_check_box, 2, 1, 1, 1)    
            self.under_right_groupbox_layout.addWidget(self.lb_gjd_1, 4, 0, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.gjd1_check_box, 4, 1, 1, 1) 
            self.under_right_groupbox_layout.addWidget(self.lb_gjd2_1, 5, 0, 1, 1)
            self.under_right_groupbox_layout.addWidget(self.gjd2_check_box, 5, 1, 1, 1)  

        self.lb_fault = QtWidgets.QLabel("故障强制释放")
        self.under_right_groupbox_layout.addWidget(self.lb_fault, 1, 6, 1, 1)
        self.fault_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.fault_check_box, 1, 7, 1, 1)   
        self.lb_clear_balance = QtWidgets.QLabel("清空均衡时间")
        self.under_right_groupbox_layout.addWidget(self.lb_clear_balance, 1, 9, 1, 1)
        self.clear_balance_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.clear_balance_check_box, 1, 10, 1, 1)   

      
        self.lb_again = QtWidgets.QLabel("绝缘检测")
        self.under_right_groupbox_layout.addWidget(self.lb_again, 2, 6, 1, 1)
        self.again_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.again_check_box, 2, 7, 1, 1)   
        self.lb_fan = QtWidgets.QLabel("开启风扇")
        self.under_right_groupbox_layout.addWidget(self.lb_fan, 2, 9, 1, 1)
        self.fan_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.fan_check_box, 2, 10, 1, 1) 

        self.lb_pre = QtWidgets.QLabel("预充控制")
        self.under_right_groupbox_layout.addWidget(self.lb_pre, 3, 0, 1, 1)
        self.pre_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.pre_check_box, 3, 1, 1, 1)      
        self.lb_again_one = QtWidgets.QLabel("绝缘检测开启一次")
        self.under_right_groupbox_layout.addWidget(self.lb_again_one, 3, 6, 1, 1)
        self.again_one_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.again_one_check_box, 3, 7, 1, 1)   
   
        self.lb_chg = QtWidgets.QLabel("强制充电指令")
        self.under_right_groupbox_layout.addWidget(self.lb_chg, 4, 6, 1, 1)
        self.qiangzhi_chg_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.qiangzhi_chg_check_box, 4, 7, 1, 1)
   
        self.lb_sleep = QtWidgets.QLabel("系统休眠指令")
        self.under_right_groupbox_layout.addWidget(self.lb_sleep, 5, 6, 1, 1)
        self.sleep_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.sleep_check_box, 5, 7, 1, 1)
   
        self.lb_reset = QtWidgets.QLabel("系统复位指令")
        self.under_right_groupbox_layout.addWidget(self.lb_reset, 6, 6, 1, 1)
        self.reset_check_box = QtWidgets.QCheckBox(self.under_right_groupbox)
        self.under_right_groupbox_layout.addWidget(self.reset_check_box, 6, 7, 1, 1)

        self.under_layout.addWidget(self.under_right_groupbox, 1)

        self.verticalLayout.addWidget(self.under_widget)
