cell.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. from ui.own.frame_theme import MyFrame
  4. from utils.qt import QtWidgets, QMetaObject, QVBoxLayout, QGroupBox, Qt, QtCore
  5. from utils.globalvar import SD
  6. from ui.own.switch_button import SwitchButton
  7. class Cell(MyFrame):
  8. def setupUi(self, Cell):
  9. self.cell = MyFrame(Cell)
  10. self.cell_layout = QVBoxLayout(self.cell)
  11. self.cell_layout.setContentsMargins(0, 0, 0, 0)
  12. self.cell_layout.setSpacing(0)
  13. self.group_cell_box = QGroupBox(self.cell)
  14. self.group_cell_box.setTitle("单体信息")
  15. self.group_cell_box_layout = QVBoxLayout(self.group_cell_box)
  16. self.btn_widget = QtWidgets.QWidget(self.group_cell_box)
  17. self.btn_widget_layout = QtWidgets.QHBoxLayout(self.btn_widget)
  18. self.btn_cell_vol = QtWidgets.QPushButton("单体电压")
  19. self.btn_widget_layout.addWidget(self.btn_cell_vol)
  20. self.btn_cell_temp = QtWidgets.QPushButton("单体温度")
  21. self.btn_widget_layout.addWidget(self.btn_cell_temp)
  22. self.btn_jz_temp = QtWidgets.QPushButton("极柱温度")
  23. self.btn_widget_layout.addWidget(self.btn_jz_temp)
  24. self.btn_bcu_temp = QtWidgets.QPushButton("极柱温度")
  25. self.btn_widget_layout.addWidget(self.btn_bcu_temp)
  26. self.btn_widget_layout.addStretch()
  27. self.wdwdw = QtWidgets.QWidget(self.btn_widget)
  28. self.wdwdw_layout = QtWidgets.QVBoxLayout(self.wdwdw)
  29. self.plot_switch = SwitchButton(self.btn_widget)
  30. self.plot_switch.setMinimumSize(QtCore.QSize(70, 30))
  31. # size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
  32. # size_policy.setHorizontalStretch(0)
  33. # size_policy.setVerticalStretch(0)
  34. # size_policy.setHeightForWidth(self.plot_switch.sizePolicy().hasHeightForWidth())
  35. self.wdwdw_layout.addWidget(self.plot_switch)
  36. self.btn_widget_layout.addWidget(self.wdwdw)
  37. self.lb_plot_switch = QtWidgets.QLabel("柱状图")
  38. self.btn_widget_layout.addWidget(self.lb_plot_switch)
  39. # self.btn_widget_layout.addStretch()
  40. self.group_cell_box_layout.addWidget(self.btn_widget)
  41. self.under_right_widget = QtWidgets.QWidget(self.group_cell_box)
  42. self.under_right_layout = QVBoxLayout(self.under_right_widget)
  43. self.under_right_layout.setContentsMargins(0, 0, 0, 0)
  44. self.under_right_layout.setSpacing(0)
  45. self.cell_tab = QtWidgets.QStackedWidget(self.under_right_widget)
  46. self.cell_vol_table = QtWidgets.QTableWidget(self.cell_tab)
  47. self.cell_vol_table.setColumnCount(16)
  48. self.cell_vol_table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
  49. # 设置只能选择行
  50. self.cell_vol_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
  51. self.cell_vol_table.setHorizontalHeaderLabels(["CMU ID", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"])
  52. self.cell_vol_table.verticalHeader().setVisible(False)
  53. self.cell_vol_table.verticalHeader().setHighlightSections(True)
  54. self.cell_vol_table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
  55. self.cell_vol_table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
  56. self.cell_vol_table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
  57. self.cell_vol_table.setRowCount(72)
  58. for i in range(72):
  59. item = QtWidgets.QTableWidgetItem("C" + str(i + 1))
  60. item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
  61. self.cell_vol_table.setItem(i, 0, item)
  62. for j in range(15):
  63. item = QtWidgets.QLineEdit("mV")
  64. item.setAlignment(Qt.AlignRight)
  65. item.setReadOnly(True)
  66. self.cell_vol_table.setCellWidget(i, j + 1, item)
  67. self.cell_tab.addWidget(self.cell_vol_table)
  68. # self.cell_vol_table.cellWidget(0, 1).setText("333333mV")
  69. # self.cell_vol_table.cellWidget(1, 1).setText("333333mV")
  70. self.cell_temp_table = QtWidgets.QTableWidget(self.cell_tab)
  71. self.cell_temp_table.setColumnCount(16)
  72. self.cell_temp_table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
  73. # 设置只能选择行
  74. self.cell_temp_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
  75. self.cell_temp_table.setHorizontalHeaderLabels(["CMU ID", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"])
  76. self.cell_temp_table.verticalHeader().setVisible(False)
  77. self.cell_temp_table.verticalHeader().setHighlightSections(True)
  78. self.cell_temp_table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
  79. self.cell_temp_table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
  80. self.cell_temp_table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
  81. self.cell_temp_table.setRowCount(72)
  82. for i in range(72):
  83. item = QtWidgets.QTableWidgetItem("T" + str(i + 1))
  84. item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
  85. self.cell_temp_table.setItem(i, 0, item)
  86. for j in range(15):
  87. item = QtWidgets.QLineEdit("℃")
  88. item.setAlignment(Qt.AlignRight)
  89. item.setReadOnly(True)
  90. self.cell_temp_table.setCellWidget(i, j + 1, item)
  91. self.cell_tab.addWidget(self.cell_temp_table)
  92. self.under_right_layout.addWidget(self.cell_tab)
  93. self.group_cell_box_layout.addWidget(self.under_right_widget)
  94. self.cell_layout.addWidget(self.group_cell_box)
  95. if SD.CCU_TYPE == 0:
  96. self.btn_jz_temp.setHidden(True)
  97. self.btn_bcu_temp.setHidden(True)
  98. # #============================================================
  99. # self.home_cell_table = QtWidgets.QTableWidget(self.group_cell_box)
  100. # self.home_cell_table.setColumnCount(12)
  101. # self.home_cell_table.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
  102. # # 设置只能选择行
  103. # self.home_cell_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
  104. # self.home_cell_table.setHorizontalHeaderLabels(["编号", "电压", "温度", "编号", "电压", "温度", "编号", "电压", "温度", "编号", "电压", "温度"])
  105. # self.home_cell_table.verticalHeader().setVisible(False)
  106. # self.home_cell_table.verticalHeader().setHighlightSections(True)
  107. # self.home_cell_table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
  108. # self.home_cell_table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
  109. # # self.home_cell_table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
  110. # self.home_cell_table.setRowCount(4)
  111. # for i in range(4):
  112. # for j in range(12):
  113. # if j%3 == 0:
  114. # item = QtWidgets.QTableWidgetItem(str(int((i + 1) + 4 * (j/3))))
  115. # item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
  116. # self.home_cell_table.setItem(i, j, item)
  117. # if j%3 == 1:
  118. # item = QtWidgets.QLineEdit("mV")
  119. # item.setAlignment(Qt.AlignRight)
  120. # item.setReadOnly(True)
  121. # self.home_cell_table.setCellWidget(i, j, item)
  122. # if j%3 == 2:
  123. # item = QtWidgets.QLineEdit("℃")
  124. # item.setAlignment(Qt.AlignRight)
  125. # item.setReadOnly(True)
  126. # self.home_cell_table.setCellWidget(i, j, item)
  127. # self.group_cell_box_layout.addWidget(self.home_cell_table)
  128. # # self.cell_layout.addWidget(self.group_cell_box_layout)
  129. # if SD.CCU_TYPE == 1:
  130. # self.btn_widget.setHidden(False)
  131. # self.home_cell_table.setHidden(True)
  132. # else:
  133. # self.btn_widget.setHidden(True)
  134. # self.cell_tab.setHidden(True)
  135. # self.home_cell_table.setHidden(False)
  136. # self.group_cell_box_layout.addStretch()
  137. # self.group_set_box = QGroupBox(self.cell)
  138. # self.group_set_box.setTitle("基本配置")
  139. # self.group_set_box_layout = QtWidgets.QHBoxLayout(self.group_set_box)
  140. # self.set_widget = QtWidgets.QWidget(self.group_set_box)
  141. # self.set_widget_layout = QtWidgets.QGridLayout(self.set_widget)
  142. # self.lb_cell_dccs = QtWidgets.QLabel("电池串数")
  143. # self.set_widget_layout.addWidget(self.lb_cell_dccs, 0, 0)
  144. # self.edt_cell_dccs = QtWidgets.QLineEdit("")
  145. # self.set_widget_layout.addWidget(self.edt_cell_dccs, 0, 1)
  146. # self.lb_cell_d = QtWidgets.QLabel("串")
  147. # self.set_widget_layout.addWidget(self.lb_cell_d, 0, 2)
  148. # self.lb_cell_temp = QtWidgets.QLabel("电池温度")
  149. # self.set_widget_layout.addWidget(self.lb_cell_temp, 1, 0)
  150. # self.edt_cell_temp = QtWidgets.QLineEdit("")
  151. # self.set_widget_layout.addWidget(self.edt_cell_temp, 1, 1)
  152. # self.lb_cell_dd = QtWidgets.QLabel("个")
  153. # self.set_widget_layout.addWidget(self.lb_cell_dd, 1, 2)
  154. # self.lb_mos_temp = QtWidgets.QLabel("MOS温度")
  155. # self.set_widget_layout.addWidget(self.lb_mos_temp, 2, 0)
  156. # self.edt_mos_temp = QtWidgets.QLineEdit("")
  157. # self.set_widget_layout.addWidget(self.edt_mos_temp, 2, 1)
  158. # self.lb_mos_dd = QtWidgets.QLabel("个")
  159. # self.set_widget_layout.addWidget(self.lb_mos_dd, 2, 2)
  160. # self.wgpe = QtWidgets.QLabel("温感配置")
  161. # self.set_widget_layout.addWidget(self.wgpe, 0, 4, 1, 2)
  162. # self.lb_t1 = QtWidgets.QLabel("T1")
  163. # self.set_widget_layout.addWidget(self.lb_t1, 1, 4, 1, 1)
  164. # self.cb_t1 = QtWidgets.QCheckBox(self.set_widget)
  165. # self.set_widget_layout.addWidget(self.cb_t1, 1, 5, 1, 1)
  166. # self.lb_t2 = QtWidgets.QLabel("T2")
  167. # self.set_widget_layout.addWidget(self.lb_t2, 2, 4, 1, 1)
  168. # self.cb_t2 = QtWidgets.QCheckBox(self.set_widget)
  169. # self.set_widget_layout.addWidget(self.cb_t2, 2, 5, 1, 1)
  170. # self.lb_t3 = QtWidgets.QLabel("T3")
  171. # self.set_widget_layout.addWidget(self.lb_t3, 3, 4, 1, 1)
  172. # self.cb_t3 = QtWidgets.QCheckBox(self.set_widget)
  173. # self.set_widget_layout.addWidget(self.cb_t3, 3, 5, 1, 1)
  174. # self.lb_t4 = QtWidgets.QLabel("T4")
  175. # self.set_widget_layout.addWidget(self.lb_t4, 4, 4, 1, 1)
  176. # self.cb_t4 = QtWidgets.QCheckBox(self.set_widget)
  177. # self.set_widget_layout.addWidget(self.cb_t4, 4, 5, 1, 1)
  178. # self.lb_t5 = QtWidgets.QLabel("T5")
  179. # self.set_widget_layout.addWidget(self.lb_t5, 1, 7, 1, 1)
  180. # self.cb_t5 = QtWidgets.QCheckBox(self.set_widget)
  181. # self.set_widget_layout.addWidget(self.cb_t5, 1, 8, 1, 1)
  182. # self.lb_t6 = QtWidgets.QLabel("T6")
  183. # self.set_widget_layout.addWidget(self.lb_t6, 2, 7, 1, 1)
  184. # self.cb_t6 = QtWidgets.QCheckBox(self.set_widget)
  185. # self.set_widget_layout.addWidget(self.cb_t6, 2, 8, 1, 1)
  186. # self.lb_t7 = QtWidgets.QLabel("T7")
  187. # self.set_widget_layout.addWidget(self.lb_t7, 3, 7, 1, 1)
  188. # self.cb_t7 = QtWidgets.QCheckBox(self.set_widget)
  189. # self.set_widget_layout.addWidget(self.cb_t7, 3, 8, 1, 1)
  190. # self.lb_t8 = QtWidgets.QLabel("T8")
  191. # self.set_widget_layout.addWidget(self.lb_t8, 4, 7, 1, 1)
  192. # self.cb_t8 = QtWidgets.QCheckBox(self.set_widget)
  193. # self.set_widget_layout.addWidget(self.cb_t8, 4, 8, 1, 1)
  194. # self.group_set_box_layout.addWidget(self.set_widget)
  195. # self.btn_set_widget = QtWidgets.QWidget(self.group_set_box)
  196. # self.btn_set_widget_layout = QtWidgets.QVBoxLayout(self.btn_set_widget)
  197. # self.btn_read_set_param = QtWidgets.QPushButton("读取参数")
  198. # self.btn_set_widget_layout.addWidget(self.btn_read_set_param)
  199. # self.btn_update_set_param = QtWidgets.QPushButton("更新参数")
  200. # self.btn_set_widget_layout.addWidget(self.btn_update_set_param)
  201. # self.group_set_box_layout.addWidget(self.btn_set_widget)
  202. # self.group_set_box_layout.addStretch()
  203. # self.cell_layout.addWidget(self.group_set_box)
  204. # if SD.CCU_TYPE == 1:
  205. # self.group_set_box.setHidden(True)
  206. QMetaObject.connectSlotsByName(Cell)