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

from ui.own.frame_theme import MyFrame
from ui.main.top_page import TopPage
from ui.main.center_page import CenterPage
from ui.main.under_page import UnderPage
from utils.qt import QtWidgets, QtCore


class DoubleCcu(MyFrame):
    def setupUi(self, DoubleCcu):
        self.double_ccu = MyFrame(DoubleCcu)
        self.double_ccu_layout = QtWidgets.QVBoxLayout(self.double_ccu)
        self.double_ccu_layout.setContentsMargins(0, 0, 0, 0)
        self.double_ccu_layout.setSpacing(0)

        self.double_ccu_top_widget = MyFrame(self.double_ccu)
        self.group_cell_box_layout = QtWidgets.QHBoxLayout(self.double_ccu_top_widget)

        self.on_line_ccu = QtWidgets.QLabel("在线簇数")
        self.group_cell_box_layout.addWidget(self.on_line_ccu)
        self.on_line_ccu_value = QtWidgets.QLabel("")
        self.group_cell_box_layout.addWidget(self.on_line_ccu_value)

        self.double_ccu_layout.addWidget(self.double_ccu_top_widget)

        self.double_ccu_under_widget = MyFrame(self.double_ccu)
        self.double_ccu_under_layout = QtWidgets.QHBoxLayout(self.double_ccu_under_widget)

        self.on_line_ccu_table = QtWidgets.QTableWidget(self.double_ccu_under_widget)
        self.on_line_ccu_table.setColumnCount(15)
        self.on_line_ccu_table.verticalHeader().setVisible(False)
        self.on_line_ccu_table.verticalHeader().setHighlightSections(True)
        self.on_line_ccu_table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
        # self.on_line_ccu_table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
        # self.on_line_ccu_table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)

        self.on_line_ccu_table.setHorizontalHeaderLabels(["簇号", "运行状态", "总电压", "总电流", "SOC", "SOH", "SOE", "绝缘阻值", "最高单体电压", "最高单体电压编号", "最低单体电压", "最低单体电压编号", "最高单体温度", "最高单体温度编号", "最低单体温度", "最低单体温度编号"])
        self.on_line_ccu_table.setRowCount(20)
        self.double_ccu_under_layout.addWidget(self.on_line_ccu_table)

        self.double_ccu_layout.addWidget(self.double_ccu_under_widget)

        QtCore.QMetaObject.connectSlotsByName(DoubleCcu)
