123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- '''
- @文件 :home.py
- @时间 :2022/01/22 09:53:31
- @作者 :None
- @版本 :1.0
- @说明 :主页面
- '''
- from ui.own.frame_theme import MyFrame
- from ui.own.switch_button import SwitchButton
- from ui.own.led import Led
- from ui.own.palette_theme import set_my_palette
- from utils.qt import Qt, QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QLabel, QGroupBox, QLineEdit, QPushButton, QSizePolicy, QComboBox, QSize, QCoreApplication, QMetaObject
- class UiPcsHomePage(object):
- def setupUi(self, main):
- main.resize(650, 780)
- main.setMinimumSize(650, 780)
- set_my_palette(main)
- self.central_widget = QWidget(main)
- self.main_layout = QHBoxLayout(self.central_widget)
- self.main_layout.setContentsMargins(0, 0, 0, 0)
- self.main_layout.setSpacing(0)
- # 主窗口左侧布局
- self.left_widget = QWidget(self.central_widget)
- # 主窗口左侧采用垂直布局
- self.left_layout = QVBoxLayout(self.left_widget)
- self.left_layout.setContentsMargins(0, 0, 0, 0)
- self.left_layout.setSpacing(0)
- # 数据接口
- self.interface_widget = MyFrame(self.left_widget)
- self.interface_hlayout = QHBoxLayout(self.interface_widget)
- self.interface_hlayout.setContentsMargins(0, 0, 0, 0)
- self.interface_hlayout.setSpacing(0)
- self.groupbox_interface = QGroupBox(self.interface_widget)
- self.interface_vlayout = QVBoxLayout(self.groupbox_interface)
- self.cb_interface = QComboBox(self.groupbox_interface)
- self.cb_interface.addItems(["CAN通讯", "串口通讯"])
- self.interface_vlayout.addWidget(self.cb_interface)
- self.interface_hlayout.addWidget(self.groupbox_interface)
- self.left_layout.addWidget(self.interface_widget)
- # CAN通讯配置
- self.can_interface_widget = MyFrame(self.left_widget)
- self.can_interface_hlayout = QHBoxLayout(self.can_interface_widget)
- self.can_interface_hlayout.setContentsMargins(0, 0, 0, 0)
- self.can_interface_hlayout.setSpacing(0)
- self.groupbox_can_interface = QGroupBox(self.interface_widget)
- self.can_interface_glayout = QGridLayout(self.groupbox_can_interface)
- self.lb_can_interface_channel = QLabel(self.groupbox_can_interface)
- self.lb_can_interface_channel.setText("设备索引号:")
- self.can_interface_glayout.addWidget(self.lb_can_interface_channel, 0, 0)
- self.cb_can_interface_channel = QComboBox(self.groupbox_can_interface)
- self.cb_can_interface_channel.addItems([str(i) for i in range(9)])
- self.can_interface_glayout.addWidget(self.cb_can_interface_channel, 0, 1)
- self.lb_can_interface_index = QLabel(self.groupbox_can_interface)
- self.lb_can_interface_index.setText("设备通道号:")
- self.can_interface_glayout.addWidget(self.lb_can_interface_index, 1, 0)
- self.cb_can_interface_index = QComboBox(self.groupbox_can_interface)
- self.cb_can_interface_index.addItems(["0", "1"])
- self.can_interface_glayout.addWidget(self.cb_can_interface_index, 1, 1)
- self.lb_can_interface_baudrate = QLabel(self.groupbox_can_interface)
- self.lb_can_interface_baudrate.setText("CAN波特率:")
- self.can_interface_glayout.addWidget(self.lb_can_interface_baudrate, 2, 0)
- self.cb_can_interface_baudrate = QComboBox(self.groupbox_can_interface)
- self.cb_can_interface_baudrate.addItems(["125Kbps", "250Kbps", "500Kbps"])
- self.cb_can_interface_baudrate.setCurrentText("250Kbps")
- self.can_interface_glayout.addWidget(self.cb_can_interface_baudrate, 2, 1)
- self.can_interface_hlayout.addWidget(self.groupbox_can_interface)
- self.left_layout.addWidget(self.can_interface_widget)
- # 串口通讯配置
- self.com_interface_widget = MyFrame(self.left_widget)
- self.com_interface_hlayout = QHBoxLayout(self.com_interface_widget)
- self.com_interface_hlayout.setContentsMargins(0, 0, 0, 0)
- self.com_interface_hlayout.setSpacing(0)
- self.groupbox_com_interface = QGroupBox(self.interface_widget)
- self.com_interface_glayout = QGridLayout(self.groupbox_com_interface)
- self.lb_com_interface_port = QLabel(self.groupbox_com_interface)
- self.lb_com_interface_port.setText("端口号:")
- self.com_interface_glayout.addWidget(self.lb_com_interface_port, 0, 0)
- self.cb_com_interface_port = QComboBox(self.groupbox_com_interface)
- self.cb_com_interface_port.addItems([str(i + 1) for i in range(9)])
- self.com_interface_glayout.addWidget(self.cb_com_interface_port, 0, 1)
- self.lb_com_interface_baudrate = QLabel(self.groupbox_com_interface)
- self.lb_com_interface_baudrate.setText("波特率:")
- self.com_interface_glayout.addWidget(self.lb_com_interface_baudrate, 1, 0)
- self.cb_com_interface_baudrate = QComboBox(self.groupbox_com_interface)
- self.cb_com_interface_baudrate.addItems(["9600", "115200"])
- self.com_interface_glayout.addWidget(self.cb_com_interface_baudrate, 1, 1)
- self.lb_com_interface_parity = QLabel(self.groupbox_com_interface)
- self.lb_com_interface_parity.setText("校验位:")
- self.com_interface_glayout.addWidget(self.lb_com_interface_parity, 2, 0)
- self.cb_com_interface_parity = QComboBox(self.groupbox_com_interface)
- self.cb_com_interface_parity.addItems(["无校验", "偶校验", "奇校验"])
- self.com_interface_glayout.addWidget(self.cb_com_interface_parity, 2, 1)
- self.lb_com_interface_word_length = QLabel(self.groupbox_com_interface)
- self.lb_com_interface_word_length.setText("数据位:")
- self.com_interface_glayout.addWidget(self.lb_com_interface_word_length, 3, 0)
- self.cb_com_interface_word_length = QComboBox(self.groupbox_com_interface)
- self.cb_com_interface_word_length.addItems(["8", "9"])
- self.com_interface_glayout.addWidget(self.cb_com_interface_word_length, 3, 1)
- self.lb_com_interface_stop = QLabel(self.groupbox_com_interface)
- self.lb_com_interface_stop.setText("停止位:")
- self.com_interface_glayout.addWidget(self.lb_com_interface_stop, 4, 0)
- self.cb_com_interface_stop = QComboBox(self.groupbox_com_interface)
- self.cb_com_interface_stop.addItems(["1", "1.5", "2"])
- self.com_interface_glayout.addWidget(self.cb_com_interface_stop, 4, 1)
- self.groupbox_com_interface.hide()
- self.com_interface_hlayout.addWidget(self.groupbox_com_interface)
- self.left_layout.addWidget(self.com_interface_widget)
- # BMS连接开关
- self.pcs_connect_widget = MyFrame(self.left_widget)
- self.pcs_connect_layout = QHBoxLayout(self.pcs_connect_widget)
- self.pcs_connect_layout.setContentsMargins(0, 0, 0, 0)
- self.pcs_connect_layout.setSpacing(0)
- self.groupbox_pcs_connect = QGroupBox(self.pcs_connect_widget)
- self.bms_connect_hlayout = QHBoxLayout(self.groupbox_pcs_connect)
- self.pcs_switch = SwitchButton(self.groupbox_pcs_connect)
- size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
- size_policy.setHorizontalStretch(0)
- size_policy.setVerticalStretch(0)
- size_policy.setHeightForWidth(self.pcs_switch.sizePolicy().hasHeightForWidth())
- self.pcs_switch.setSizePolicy(size_policy)
- self.pcs_switch.setMinimumSize(QSize(70, 30))
- self.bms_connect_hlayout.addWidget(self.pcs_switch)
- self.pcs_connect_layout.addWidget(self.groupbox_pcs_connect)
- self.left_layout.addWidget(self.pcs_connect_widget)
- # 其他信息
- self.other_widget = MyFrame(self.left_widget)
- self.other_layout = QHBoxLayout(self.other_widget)
- self.other_layout.setContentsMargins(0, 0, 0, 0)
- self.other_layout.setSpacing(0)
- self.groupbox_other = QGroupBox(self.other_widget)
- size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
- size_policy.setHorizontalStretch(0)
- size_policy.setVerticalStretch(0)
- size_policy.setHeightForWidth(self.groupbox_other.sizePolicy().hasHeightForWidth())
- self.groupbox_other.setSizePolicy(size_policy)
- self.other_layout.addWidget(self.groupbox_other)
- self.left_layout.addWidget(self.other_widget)
- self.main_layout.addWidget(self.left_widget, stretch=1)
- self.right_widget = QWidget(self.central_widget)
- # 主窗口右侧采用垂直布局
- self.right_layout = QVBoxLayout(self.right_widget)
- self.right_layout.setContentsMargins(0, 0, 0, 0)
- self.right_layout.setSpacing(0)
- # 数据接口
- self.important_data_widget = MyFrame(self.right_widget)
- self.important_data_hlayout = QHBoxLayout(self.important_data_widget)
- self.important_data_hlayout.setContentsMargins(0, 0, 0, 0)
- self.important_data_hlayout.setSpacing(0)
- self.groupbox_important_data = QGroupBox(self.important_data_widget)
- self.groupbox_important_data.setTitle("实时数据")
- self.important_data_glayout = QGridLayout(self.groupbox_important_data)
- self.lb_param = QLabel(self.groupbox_important_data)
- self.lb_param.setText("参数")
- self.important_data_glayout.addWidget(self.lb_param, 0, 0, 1, 1, Qt.AlignCenter)
- # self.lb_param_address = QLabel(self.groupbox_important_data)
- # self.lb_param_address.setText("地址")
- # self.important_data_glayout.addWidget(self.lb_param_address, 0, 1, 1, 1, Qt.AlignCenter)
- self.lb_param_value = QLabel(self.groupbox_important_data)
- self.lb_param_value.setText("值")
- self.important_data_glayout.addWidget(self.lb_param_value, 0, 2, 1, 1, Qt.AlignCenter)
- # 当前荷电状态(SOC)
- self.lb_soc = QLabel(self.groupbox_important_data)
- self.lb_soc.setText("当前荷电状态 [%]")
- self.important_data_glayout.addWidget(self.lb_soc, 1, 0, 1, 1, Qt.AlignCenter)
- # self.edt_soc_address = QLineEdit(self.groupbox_important_data)
- # self.edt_soc_address.setText("1800")
- # self.important_data_glayout.addWidget(self.edt_soc_address, 1, 1, 1, 1, Qt.AlignCenter)
- self.edt_soc = QLineEdit(self.groupbox_important_data)
- self.edt_soc.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_soc, 1, 2, 1, 1, Qt.AlignCenter)
- # BMS是否已准备好
- self.lb_bms_ready = QLabel(self.groupbox_important_data)
- self.lb_bms_ready.setText("BMS就绪状态")
- self.important_data_glayout.addWidget(self.lb_bms_ready, 2, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_ready_address = QLineEdit(self.groupbox_important_data)
- # self.edt_bms_ready_address.setText("1801")
- # self.important_data_glayout.addWidget(self.edt_bms_ready_address, 2, 1, 1, 1, Qt.AlignCenter)
- self.led_bms_ready = Led(self.groupbox_important_data)
- self.important_data_glayout.addWidget(self.led_bms_ready, 2, 2, 1, 1, Qt.AlignCenter)
- # 充放电使能标志
- self.lb_bms_chg_enabled = QLabel(self.groupbox_important_data)
- self.lb_bms_chg_enabled.setText("充放电使能标志")
- self.important_data_glayout.addWidget(self.lb_bms_chg_enabled, 3, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_chg_enabled_address = QLineEdit(self.groupbox_important_data)
- # self.edt_bms_chg_enabled_address.setText("1802")
- # self.important_data_glayout.addWidget(self.edt_bms_chg_enabled_address, 3, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_chg_enabled = QLineEdit(self.groupbox_important_data)
- self.edt_bms_chg_enabled.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_chg_enabled, 3, 2, 1, 1, Qt.AlignCenter)
- # BMS停机指令
- self.lb_bms_stop = QLabel(self.groupbox_important_data)
- self.lb_bms_stop.setText("BMS停机指令")
- self.important_data_glayout.addWidget(self.lb_bms_stop, 4, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_stop_address = QLineEdit(self.groupbox_important_data)
- # self.edt_bms_stop_address.setText("1803")
- # self.important_data_glayout.addWidget(self.edt_bms_stop_address, 4, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_stop = QLineEdit(self.groupbox_important_data)
- self.edt_bms_stop.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_stop, 4, 2, 1, 1, Qt.AlignCenter)
- # BMS故障标志
- self.lb_bms_fault = QLabel(self.groupbox_important_data)
- self.lb_bms_fault.setText("BMS故障标志")
- self.important_data_glayout.addWidget(self.lb_bms_fault, 5, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_fault_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_fault_address, 5, 1, 1, 1, Qt.AlignCenter)
- self.led_bms_fault = Led(self.groupbox_important_data)
- self.important_data_glayout.addWidget(self.led_bms_fault, 5, 2, 1, 1, Qt.AlignCenter)
- # 电池堆SOH
- self.lb_bms_soh = QLabel(self.groupbox_important_data)
- self.lb_bms_soh.setText("电池堆SOH [%]")
- self.important_data_glayout.addWidget(self.lb_bms_soh, 6, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_soh_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_soh_address, 6, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_soh = QLineEdit(self.groupbox_important_data)
- self.edt_bms_soh.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_soh, 6, 2, 1, 1, Qt.AlignCenter)
- # 最高单体温度值
- self.lb_bms_high_temp = QLabel(self.groupbox_important_data)
- self.lb_bms_high_temp.setText("最高单体温度值 [℃]")
- self.important_data_glayout.addWidget(self.lb_bms_high_temp, 7, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_high_temp_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_high_temp_address, 7, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_high_temp = QLineEdit(self.groupbox_important_data)
- self.edt_bms_high_temp.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_high_temp, 7, 2, 1, 1, Qt.AlignCenter)
- # 最低单体温度值
- self.lb_bms_low_temp = QLabel(self.groupbox_important_data)
- self.lb_bms_low_temp.setText("最低单体温度值 [℃]")
- self.important_data_glayout.addWidget(self.lb_bms_low_temp, 8, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_low_temp_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_low_temp_address, 8, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_low_temp = QLineEdit(self.groupbox_important_data)
- self.edt_bms_low_temp.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_low_temp, 8, 2, 1, 1, Qt.AlignCenter)
- # 重要信息2 BAMS->EMS(上位机)
- # 当前最大允许放电功率
- self.lb_bms_dischg_power_max = QLabel(self.groupbox_important_data)
- self.lb_bms_dischg_power_max.setText("当前最大允许放电功率 [kW]")
- self.important_data_glayout.addWidget(self.lb_bms_dischg_power_max, 9, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_dischg_power_max_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_dischg_power_max_address, 9, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_dischg_power_max = QLineEdit(self.groupbox_important_data)
- self.edt_bms_dischg_power_max.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_dischg_power_max, 9, 2, 1, 1, Qt.AlignCenter)
- # 当前最大允许充电功率
- self.lb_bms_chg_power_max = QLabel(self.groupbox_important_data)
- self.lb_bms_chg_power_max.setText("当前最大允许充电功率 [kW]")
- self.important_data_glayout.addWidget(self.lb_bms_chg_power_max, 10, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_chg_power_max_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_chg_power_max_address, 10, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_chg_power_max = QLineEdit(self.groupbox_important_data)
- self.edt_bms_chg_power_max.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_chg_power_max, 10, 2, 1, 1, Qt.AlignCenter)
- # 当前最大允许充电电流
- self.lb_bms_chg_cur_max = QLabel(self.groupbox_important_data)
- self.lb_bms_chg_cur_max.setText("当前最大允许充电电流 [A]")
- self.important_data_glayout.addWidget(self.lb_bms_chg_cur_max, 11, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_chg_cur_max_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_chg_cur_max_address, 11, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_chg_cur_max = QLineEdit(self.groupbox_important_data)
- self.edt_bms_chg_cur_max.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_chg_cur_max, 11, 2, 1, 1, Qt.AlignCenter)
- # 当前最大允许放电电流
- self.lb_bms_dischg_cur_max = QLabel(self.groupbox_important_data)
- self.lb_bms_dischg_cur_max.setText("当前最大允许放电电流 [A]")
- self.important_data_glayout.addWidget(self.lb_bms_dischg_cur_max, 12, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_dischg_cur_max_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_dischg_cur_max_address, 12, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_dischg_cur_max = QLineEdit(self.groupbox_important_data)
- self.edt_bms_dischg_cur_max.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_dischg_cur_max, 12, 2, 1, 1, Qt.AlignCenter)
- # 重要信息3 BAMS->EMS(上位机)
- # 最高单体电压值
- self.lb_bms_high_volt = QLabel(self.groupbox_important_data)
- self.lb_bms_high_volt.setText("最高单体电压值 [V]")
- self.important_data_glayout.addWidget(self.lb_bms_high_volt, 13, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_high_volt_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_high_volt_address, 13, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_high_volt = QLineEdit(self.groupbox_important_data)
- self.edt_bms_high_volt.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_high_volt, 13, 2, 1, 1, Qt.AlignCenter)
- # 最低单体电压值
- self.lb_bms_low_volt = QLabel(self.groupbox_important_data)
- self.lb_bms_low_volt.setText("最低单体电压值 [V]")
- self.important_data_glayout.addWidget(self.lb_bms_low_volt, 14, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_low_volt_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_low_volt_address, 14, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_low_volt = QLineEdit(self.groupbox_important_data)
- self.edt_bms_low_volt.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_low_volt, 14, 2, 1, 1, Qt.AlignCenter)
- # 最大允许充电电压
- self.lb_bms_chg_volt_high = QLabel(self.groupbox_important_data)
- self.lb_bms_chg_volt_high.setText("最大允许充电电压 [V]")
- self.important_data_glayout.addWidget(self.lb_bms_chg_volt_high, 15, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_chg_volt_high_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_chg_volt_high_address, 15, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_chg_volt_high = QLineEdit(self.groupbox_important_data)
- self.edt_bms_chg_volt_high.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_chg_volt_high, 15, 2, 1, 1, Qt.AlignCenter)
- # 最大允许放电电压
- self.lb_bms_dischg_volt_high = QLabel(self.groupbox_important_data)
- self.lb_bms_dischg_volt_high.setText("最大允许放电电压 [V]")
- self.important_data_glayout.addWidget(self.lb_bms_dischg_volt_high, 16, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_dischg_volt_high_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_dischg_volt_high_address, 16, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_dischg_volt_high = QLineEdit(self.groupbox_important_data)
- self.edt_bms_dischg_volt_high.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_dischg_volt_high, 16, 2, 1, 1, Qt.AlignCenter)
- # 重要信息4 BAMS->EMS(上位机)
- # 电池堆实时总电压
- self.lb_bms_volt = QLabel(self.groupbox_important_data)
- self.lb_bms_volt.setText("电池堆实时总电压 [V]")
- self.important_data_glayout.addWidget(self.lb_bms_volt, 17, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_volt_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_volt_address, 17, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_volt = QLineEdit(self.groupbox_important_data)
- self.edt_bms_volt.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_volt, 17, 2, 1, 1, Qt.AlignCenter)
- # 电池堆实时总电流
- self.lb_bms_cur = QLabel(self.groupbox_important_data)
- self.lb_bms_cur.setText("电池堆实时总电流 [A]")
- self.important_data_glayout.addWidget(self.lb_bms_cur, 18, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_cur_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_cur_address, 18, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_cur = QLineEdit(self.groupbox_important_data)
- self.edt_bms_cur.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_cur, 18, 2, 1, 1, Qt.AlignCenter)
- # 当前可充电能量
- self.lb_bms_chg_power_real = QLabel(self.groupbox_important_data)
- self.lb_bms_chg_power_real.setText("当前可充电能量 [kWh]")
- self.important_data_glayout.addWidget(self.lb_bms_chg_power_real, 19, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_chg_power_real_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_chg_power_real_address, 19, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_chg_power_real = QLineEdit(self.groupbox_important_data)
- self.edt_bms_chg_power_real.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_chg_power_real, 19, 2, 1, 1, Qt.AlignCenter)
- # 当前可放电能量
- self.lb_bms_dischg_power_real = QLabel(self.groupbox_important_data)
- self.lb_bms_dischg_power_real.setText("当前可放电能量 [kWh]")
- self.important_data_glayout.addWidget(self.lb_bms_dischg_power_real, 20, 0, 1, 1, Qt.AlignCenter)
- # self.edt_bms_dischg_power_real_address = QLineEdit(self.groupbox_important_data)
- # self.important_data_glayout.addWidget(self.edt_bms_dischg_power_real_address, 20, 1, 1, 1, Qt.AlignCenter)
- self.edt_bms_dischg_power_real = QLineEdit(self.groupbox_important_data)
- self.edt_bms_dischg_power_real.setReadOnly(True)
- self.important_data_glayout.addWidget(self.edt_bms_dischg_power_real, 20, 2, 1, 1, Qt.AlignCenter)
- self.important_data_hlayout.addWidget(self.groupbox_important_data)
- self.right_layout.addWidget(self.important_data_widget)
- # 数据接口
- self.relay_widget = MyFrame(self.right_widget)
- self.relay_vlayout = QVBoxLayout(self.relay_widget)
- self.relay_vlayout.setContentsMargins(0, 0, 0, 0)
- self.relay_vlayout.setSpacing(0)
- self.groupbox_relay = QGroupBox(self.relay_widget)
- self.groupbox_relay.setTitle("PCS 控制指令")
- self.relay_glayout = QGridLayout(self.groupbox_relay)
- self.btn_all_on = QPushButton(self.groupbox_relay)
- self.btn_all_on.setText("一键闭合")
- self.relay_glayout.addWidget(self.btn_all_on, 0, 2, 1, 1, Qt.AlignCenter)
- self.btn_all_off = QPushButton(self.groupbox_relay)
- self.btn_all_off.setText("一键断开")
- self.relay_glayout.addWidget(self.btn_all_off, 1, 2, 1, 1, Qt.AlignCenter)
- self.lb_cls = QLabel(self.groupbox_relay)
- self.lb_cls.setText("簇号:")
- self.relay_glayout.addWidget(self.lb_cls, 0, 0, 1, 1, Qt.AlignCenter)
- self.cb_cls = QComboBox(self.groupbox_relay)
- self.cb_cls.addItems([str(i + 1) for i in range(16)])
- self.relay_glayout.addWidget(self.cb_cls, 0, 1, 1, 1)
- self.btn_cls_on = QPushButton(self.groupbox_relay)
- self.btn_cls_on.setText("闭合")
- self.relay_glayout.addWidget(self.btn_cls_on, 1, 0, 1, 1, Qt.AlignCenter)
- self.btn_cls_off = QPushButton(self.groupbox_relay)
- self.btn_cls_off.setText("断开")
- self.relay_glayout.addWidget(self.btn_cls_off, 1, 1, 1, 1, Qt.AlignCenter)
- self.relay_vlayout.addWidget(self.groupbox_relay)
- self.right_layout.addWidget(self.relay_widget)
- self.main_layout.addWidget(self.right_widget, stretch=2)
- main.setCentralWidget(self.central_widget)
- self.retranslateUi(main)
- QMetaObject.connectSlotsByName(main)
- def retranslateUi(self, MainWindow):
- _translate = QCoreApplication.translate
- MainWindow.setWindowTitle(_translate("MainWindow", "PCS模拟器"))
- self.groupbox_interface.setTitle(_translate("MainWindow", "数据接口"))
- # self.groupbox_pcs_connect.setTitle(_translate("MainWindow", "BMS开关"))
|