导航

QT Designer设计界面一, 升级测试

Posted on 2022-02-23 19:35  初之萌萌  阅读(128)  评论(0编辑  收藏  举报

功能:

两个版本文件互升

 

 

 

 

界面UI

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'upgrade_ui.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(981, 819)
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.horizontalLayout_9 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_9.setContentsMargins(-1, 10, -1, 10)
        self.horizontalLayout_9.setObjectName("horizontalLayout_9")
        self.verticalLayout_7 = QtWidgets.QVBoxLayout()
        self.verticalLayout_7.setObjectName("verticalLayout_7")
        self.result_table = QtWidgets.QTableWidget(Form)
        self.result_table.setDragEnabled(True)
        self.result_table.setDragDropOverwriteMode(False)
        self.result_table.setAlternatingRowColors(True)
        self.result_table.setShowGrid(False)
        self.result_table.setObjectName("result_table")
        self.result_table.setColumnCount(6)
        self.result_table.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.result_table.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.result_table.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.result_table.setHorizontalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        self.result_table.setHorizontalHeaderItem(3, item)
        item = QtWidgets.QTableWidgetItem()
        self.result_table.setHorizontalHeaderItem(4, item)
        item = QtWidgets.QTableWidgetItem()
        self.result_table.setHorizontalHeaderItem(5, item)
        self.result_table.horizontalHeader().setDefaultSectionSize(100)
        self.verticalLayout_7.addWidget(self.result_table)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setContentsMargins(0, -1, -1, -1)
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.label_4 = QtWidgets.QLabel(Form)
        self.label_4.setObjectName("label_4")
        self.horizontalLayout_6.addWidget(self.label_4)
        self.valid_lines_lbl = QtWidgets.QLabel(Form)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.valid_lines_lbl.setFont(font)
        self.valid_lines_lbl.setObjectName("valid_lines_lbl")
        self.horizontalLayout_6.addWidget(self.valid_lines_lbl)
        spacerItem = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_6.addItem(spacerItem)
        self.clear_all_line_btn = QtWidgets.QPushButton(Form)
        self.clear_all_line_btn.setObjectName("clear_all_line_btn")
        self.horizontalLayout_6.addWidget(self.clear_all_line_btn)
        self.delete_line_btn = QtWidgets.QPushButton(Form)
        self.delete_line_btn.setObjectName("delete_line_btn")
        self.horizontalLayout_6.addWidget(self.delete_line_btn)
        self.export_btn = QtWidgets.QPushButton(Form)
        self.export_btn.setObjectName("export_btn")
        self.horizontalLayout_6.addWidget(self.export_btn)
        self.verticalLayout_7.addLayout(self.horizontalLayout_6)
        self.horizontalLayout_9.addLayout(self.verticalLayout_7)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout()
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")
        self.groupBox_2 = QtWidgets.QGroupBox(Form)
        self.groupBox_2.setObjectName("groupBox_2")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_2)
        self.verticalLayout_2.setContentsMargins(20, 12, -1, -1)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.single_ip_chk = QtWidgets.QCheckBox(self.groupBox_2)
        self.single_ip_chk.setChecked(True)
        self.single_ip_chk.setObjectName("single_ip_chk")
        self.buttonGroup = QtWidgets.QButtonGroup(Form)
        self.buttonGroup.setObjectName("buttonGroup")
        self.buttonGroup.addButton(self.single_ip_chk)
        self.horizontalLayout.addWidget(self.single_ip_chk)
        self.input_ip_editline = QtWidgets.QLineEdit(self.groupBox_2)
        self.input_ip_editline.setObjectName("input_ip_editline")
        self.horizontalLayout.addWidget(self.input_ip_editline)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.horizontalLayout.setStretch(0, 1)
        self.horizontalLayout.setStretch(1, 3)
        self.horizontalLayout.setStretch(2, 2)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.batch_ip_chk = QtWidgets.QCheckBox(self.groupBox_2)
        self.batch_ip_chk.setObjectName("batch_ip_chk")
        self.buttonGroup.addButton(self.batch_ip_chk)
        self.horizontalLayout_2.addWidget(self.batch_ip_chk)
        self.file_editline = QtWidgets.QLineEdit(self.groupBox_2)
        self.file_editline.setEnabled(False)
        self.file_editline.setReadOnly(True)
        self.file_editline.setObjectName("file_editline")
        self.horizontalLayout_2.addWidget(self.file_editline)
        self.select_file_btn = QtWidgets.QPushButton(self.groupBox_2)
        self.select_file_btn.setEnabled(False)
        self.select_file_btn.setObjectName("select_file_btn")
        self.horizontalLayout_2.addWidget(self.select_file_btn)
        self.horizontalLayout_2.setStretch(0, 1)
        self.horizontalLayout_2.setStretch(1, 4)
        self.horizontalLayout_2.setStretch(2, 1)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem2)
        self.upload_table_btn = QtWidgets.QPushButton(self.groupBox_2)
        self.upload_table_btn.setObjectName("upload_table_btn")
        self.horizontalLayout_4.addWidget(self.upload_table_btn)
        spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem3)
        self.verticalLayout_2.addLayout(self.horizontalLayout_4)
        self.horizontalLayout_8.addWidget(self.groupBox_2)
        self.verticalLayout_3.addLayout(self.horizontalLayout_8)
        self.groupBox = QtWidgets.QGroupBox(Form)
        self.groupBox.setObjectName("groupBox")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox)
        self.verticalLayout.setContentsMargins(20, 12, -1, -1)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.label_2 = QtWidgets.QLabel(self.groupBox)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout_5.addWidget(self.label_2)
        self.username_editline = QtWidgets.QLineEdit(self.groupBox)
        self.username_editline.setObjectName("username_editline")
        self.horizontalLayout_5.addWidget(self.username_editline)
        spacerItem4 = QtWidgets.QSpacerItem(20, 16, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_5.addItem(spacerItem4)
        self.label_3 = QtWidgets.QLabel(self.groupBox)
        self.label_3.setObjectName("label_3")
        self.horizontalLayout_5.addWidget(self.label_3)
        self.password_editline = QtWidgets.QLineEdit(self.groupBox)
        self.password_editline.setObjectName("password_editline")
        self.horizontalLayout_5.addWidget(self.password_editline)
        spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_5.addItem(spacerItem5)
        self.verticalLayout.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.label = QtWidgets.QLabel(self.groupBox)
        self.label.setObjectName("label")
        self.horizontalLayout_3.addWidget(self.label)
        self.upgrade_times_editline = QtWidgets.QLineEdit(self.groupBox)
        self.upgrade_times_editline.setObjectName("upgrade_times_editline")
        self.horizontalLayout_3.addWidget(self.upgrade_times_editline)
        spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem6)
        self.horizontalLayout_3.setStretch(0, 1)
        self.horizontalLayout_3.setStretch(1, 1)
        self.horizontalLayout_3.setStretch(2, 6)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_10 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_10.setObjectName("horizontalLayout_10")
        self.label_6 = QtWidgets.QLabel(self.groupBox)
        self.label_6.setObjectName("label_6")
        self.horizontalLayout_10.addWidget(self.label_6)
        self.upgrade_file1_editline = QtWidgets.QLineEdit(self.groupBox)
        self.upgrade_file1_editline.setObjectName("upgrade_file1_editline")
        self.horizontalLayout_10.addWidget(self.upgrade_file1_editline)
        self.select_upgrade_file1_btn = QtWidgets.QPushButton(self.groupBox)
        self.select_upgrade_file1_btn.setObjectName("select_upgrade_file1_btn")
        self.horizontalLayout_10.addWidget(self.select_upgrade_file1_btn)
        self.verticalLayout.addLayout(self.horizontalLayout_10)
        self.horizontalLayout_11 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_11.setObjectName("horizontalLayout_11")
        self.label_5 = QtWidgets.QLabel(self.groupBox)
        self.label_5.setObjectName("label_5")
        self.horizontalLayout_11.addWidget(self.label_5)
        self.upgrade_file2_editline = QtWidgets.QLineEdit(self.groupBox)
        self.upgrade_file2_editline.setObjectName("upgrade_file2_editline")
        self.horizontalLayout_11.addWidget(self.upgrade_file2_editline)
        self.select_upgrade_file2_btn = QtWidgets.QPushButton(self.groupBox)
        self.select_upgrade_file2_btn.setObjectName("select_upgrade_file2_btn")
        self.horizontalLayout_11.addWidget(self.select_upgrade_file2_btn)
        self.verticalLayout.addLayout(self.horizontalLayout_11)
        self.verticalLayout_6 = QtWidgets.QVBoxLayout()
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.verticalLayout.addLayout(self.verticalLayout_6)
        self.horizontalLayout_12 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_12.setObjectName("horizontalLayout_12")
        self.label_7 = QtWidgets.QLabel(self.groupBox)
        self.label_7.setObjectName("label_7")
        self.horizontalLayout_12.addWidget(self.label_7)
        self.file1_ver_editline = QtWidgets.QLineEdit(self.groupBox)
        self.file1_ver_editline.setText("")
        self.file1_ver_editline.setObjectName("file1_ver_editline")
        self.horizontalLayout_12.addWidget(self.file1_ver_editline)
        self.verticalLayout.addLayout(self.horizontalLayout_12)
        self.horizontalLayout_13 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_13.setObjectName("horizontalLayout_13")
        self.label_8 = QtWidgets.QLabel(self.groupBox)
        self.label_8.setObjectName("label_8")
        self.horizontalLayout_13.addWidget(self.label_8)
        self.file2_ver_editline = QtWidgets.QLineEdit(self.groupBox)
        self.file2_ver_editline.setText("")
        self.file2_ver_editline.setObjectName("file2_ver_editline")
        self.horizontalLayout_13.addWidget(self.file2_ver_editline)
        self.verticalLayout.addLayout(self.horizontalLayout_13)
        spacerItem7 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
        self.verticalLayout.addItem(spacerItem7)
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.start_btn = QtWidgets.QPushButton(self.groupBox)
        self.start_btn.setObjectName("start_btn")
        self.horizontalLayout_7.addWidget(self.start_btn)
        self.calcel_btn = QtWidgets.QPushButton(self.groupBox)
        self.calcel_btn.setObjectName("calcel_btn")
        self.horizontalLayout_7.addWidget(self.calcel_btn)
        self.verticalLayout.addLayout(self.horizontalLayout_7)
        self.verticalLayout_3.addWidget(self.groupBox)
        self.groupBox_3 = QtWidgets.QGroupBox(Form)
        self.groupBox_3.setObjectName("groupBox_3")
        self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.groupBox_3)
        self.verticalLayout_5.setObjectName("verticalLayout_5")
        self.receive_msg_plaineditline = QtWidgets.QPlainTextEdit(self.groupBox_3)
        self.receive_msg_plaineditline.setObjectName("receive_msg_plaineditline")
        self.verticalLayout_5.addWidget(self.receive_msg_plaineditline)
        self.verticalLayout_3.addWidget(self.groupBox_3)
        self.horizontalLayout_9.addLayout(self.verticalLayout_3)
        self.horizontalLayout_9.setStretch(0, 3)
        self.horizontalLayout_9.setStretch(1, 2)
        self.verticalLayout_4.addLayout(self.horizontalLayout_9)
        self.verticalLayout_4.setStretch(0, 6)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "升级测试"))
        self.result_table.setSortingEnabled(False)
        item = self.result_table.horizontalHeaderItem(0)
        item.setText(_translate("Form", "设备IP"))
        item = self.result_table.horizontalHeaderItem(1)
        item.setText(_translate("Form", "成功数"))
        item = self.result_table.horizontalHeaderItem(2)
        item.setText(_translate("Form", "失败数"))
        item = self.result_table.horizontalHeaderItem(3)
        item.setText(_translate("Form", "升级状态"))
        item = self.result_table.horizontalHeaderItem(4)
        item.setText(_translate("Form", "已升级次数"))
        item = self.result_table.horizontalHeaderItem(5)
        item.setText(_translate("Form", "版本"))
        self.label_4.setText(_translate("Form", "共有设备数:"))
        self.valid_lines_lbl.setText(_translate("Form", "0"))
        self.clear_all_line_btn.setText(_translate("Form", "清空表格"))
        self.delete_line_btn.setText(_translate("Form", "删除一行"))
        self.export_btn.setText(_translate("Form", "导出IP"))
        self.groupBox_2.setTitle(_translate("Form", "设备添加:"))
        self.single_ip_chk.setText(_translate("Form", "添加单台设备"))
        self.input_ip_editline.setText(_translate("Form", "192.168.7.173"))
        self.input_ip_editline.setPlaceholderText(_translate("Form", "请输入设备IP"))
        self.batch_ip_chk.setText(_translate("Form", "批量添加设备"))
        self.select_file_btn.setText(_translate("Form", "选择文件"))
        self.upload_table_btn.setText(_translate("Form", "添加IP到表格"))
        self.groupBox.setTitle(_translate("Form", "升级参数:"))
        self.label_2.setText(_translate("Form", "用户名:"))
        self.username_editline.setText(_translate("Form", "admin"))
        self.label_3.setText(_translate("Form", "密码:"))
        self.password_editline.setText(_translate("Form", "admin"))
        self.label.setText(_translate("Form", "升级次数:"))
        self.upgrade_times_editline.setText(_translate("Form", "1"))
        self.label_6.setText(_translate("Form", "选择升级文件1"))
        self.select_upgrade_file1_btn.setText(_translate("Form", "选择文件"))
        self.label_5.setText(_translate("Form", "选择升级文件2"))
        self.select_upgrade_file2_btn.setText(_translate("Form", "选择文件"))
        self.label_7.setText(_translate("Form", "文件1版本号:"))
        self.label_8.setText(_translate("Form", "文件2版本号:"))
        self.start_btn.setText(_translate("Form", "开始升级"))
        self.calcel_btn.setText(_translate("Form", "取消升级"))
        self.groupBox_3.setTitle(_translate("Form", "日志消息:"))

requirements.txt

certifi==2021.10.8
charset-normalizer==2.0.10
idna==3.3
PyQt5==5.15.7
PyQt5-Qt5==5.15.2
PyQt5-sip==12.11.0
requests==2.27.1
shiboken2==5.15.2.1
urllib3==1.26.8