赞
踩
call_cxtool.py 用来调用界面的开始界面
- # -*- coding: utf-8 -*-# Form implementation generated from reading ui file 'connect_me.ui'#
-
- # Created by: PyQt5 UI code generator 5.11.3#
- # WARNING! All changes made in this file will be lost!#导入程序运行必须模块
- # PyQt5中使用的基本控件都在PyQt5.QtWidgets模块中
- import sys
- from PyQt5.QtWidgets import QApplication, QMainWindow # #导入designer工具生成的login模块
- from cxtool import Ui_ToolMainWindow
-
-
- class MyMainForm(QMainWindow, Ui_ToolMainWindow):
- def __init__(self, parent=None):
- super(MyMainForm, self).__init__(parent)
- self.setupUi(self)
-
-
- if __name__ == "__main__":
- # 固定的,PyQt5程序都需要QApplication对象。sys.argv是命令行参数列表,确保程序可以双击运行
- app = QApplication(sys.argv)
- # 初始化
- myWin = MyMainForm()
- # 将窗口控件显示在屏幕上
- myWin.show()
- # 程序运行,sys.exit方法确保程序完整退出。
- sys.exit(app.exec_())
tool.ui是通过pt designer生成的ui界面,通过PyUIc转化为tool.py (转化方法后续放)
cxtool.py
- # -*- coding: utf-8 -*-
-
- # Form implementation generated from reading ui file 'cxtool.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.
-
- import json
- import os
- import sys
- from configparser import ConfigParser
- from shutil import copyfile
-
- import psutil
- import win32api
- import wmi
- from PyQt5 import QtCore, QtGui, QtWidgets
- from PyQt5.QtWidgets import QMessageBox
-
- import func_impl
- import function_impl
-
- cp = ConfigParser()
- cp.read('config.cfg')
- current_working_dir = os.getcwd()
- cp.set("database", "root_path", current_working_dir) # 使用set直接修改指定字段值
- with open("config.cfg", "w+") as f:
- cp.write(f)
- root_path = cp.get('database', 'root_path')
-
-
- class Ui_ToolMainWindow(object):
- def setupUi(self, ToolMainWindow):
- ToolMainWindow.setObjectName("ToolMainWindow")
- ToolMainWindow.resize(781, 619)
- self.centralwidget = QtWidgets.QWidget(ToolMainWindow)
- self.centralwidget.setObjectName("centralwidget")
- self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
- self.tabWidget.setGeometry(QtCore.QRect(0, 0, 791, 691))
- self.tabWidget.setLayoutDirection(QtCore.Qt.LeftToRight)
- self.tabWidget.setStyleSheet("*{\n"
- " font: 75 11pt \"微软雅黑\";\n"
- "font-weight: bold;\n"
- "color:yellow;\n"
- "}\n"
- "")
- self.tabWidget.setIconSize(QtCore.QSize(88, 28))
- self.tabWidget.setObjectName("tabWidget")
- self.tab_1 = QtWidgets.QWidget()
- self.tab_1.setObjectName("tab_1")
- self.checkBox_ie_set = QtWidgets.QCheckBox(self.tab_1)
- self.checkBox_ie_set.setGeometry(QtCore.QRect(110, 60, 131, 19))
- self.checkBox_ie_set.setCheckable(True)
- self.checkBox_ie_set.setObjectName("checkBox_ie_set")
- self.checkBox_host_domain_map = QtWidgets.QCheckBox(self.tab_1)
- self.checkBox_host_domain_map.setGeometry(QtCore.QRect(450, 60, 181, 19))
- self.checkBox_host_domain_map.setObjectName("checkBox_host_domain_map")
- self.checkBox_c_clear = QtWidgets.QCheckBox(self.tab_1)
- self.checkBox_c_clear.setGeometry(QtCore.QRect(300, 60, 131, 19))
- self.checkBox_c_clear.setObjectName("checkBox_c_clear")
- self.checkBox_restart_print_service = QtWidgets.QCheckBox(self.tab_1)
- self.checkBox_restart_print_service.setGeometry(QtCore.QRect(300, 100, 131, 19))
- self.checkBox_restart_print_service.setObjectName("checkBox_restart_print_service")
- self.checkBox_clear_all_tasks = QtWidgets.QCheckBox(self.tab_1)
- self.checkBox_clear_all_tasks.setGeometry(QtCore.QRect(110, 100, 171, 19))
- self.checkBox_clear_all_tasks.setObjectName("checkBox_clear_all_tasks")
- self.checkBox_fix_dns = QtWidgets.QCheckBox(self.tab_1)
- self.checkBox_fix_dns.setGeometry(QtCore.QRect(110, 140, 151, 19))
- self.checkBox_fix_dns.setObjectName("checkBox_fix_dns")
- self.checkBox_update_AD_domain_strategy = QtWidgets.QCheckBox(self.tab_1)
- self.checkBox_update_AD_domain_strategy.setGeometry(QtCore.QRect(300, 140, 151, 19))
- self.checkBox_update_AD_domain_strategy.setObjectName("checkBox_update_AD_domain_strategy")
- self.line = QtWidgets.QFrame(self.tab_1)
- self.line.setGeometry(QtCore.QRect(310, 20, 341, 31))
- self.line.setFrameShape(QtWidgets.QFrame.HLine)
- self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line.setObjectName("line")
- self.line_2 = QtWidgets.QFrame(self.tab_1)
- self.line_2.setGeometry(QtCore.QRect(70, 50, 20, 121))
- self.line_2.setFrameShape(QtWidgets.QFrame.VLine)
- self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_2.setObjectName("line_2")
- self.line_3 = QtWidgets.QFrame(self.tab_1)
- self.line_3.setGeometry(QtCore.QRect(660, 50, 20, 121))
- self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
- self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_3.setObjectName("line_3")
- self.line_4 = QtWidgets.QFrame(self.tab_1)
- self.line_4.setGeometry(QtCore.QRect(90, 160, 561, 31))
- self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
- self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_4.setObjectName("line_4")
- self.label_proxy_ip_address = QtWidgets.QLabel(self.tab_1)
- self.label_proxy_ip_address.setGeometry(QtCore.QRect(90, 210, 111, 21))
- self.label_proxy_ip_address.setObjectName("label_proxy_ip_address")
- self.lineEdit_proxy_ip_address = QtWidgets.QLineEdit(self.tab_1)
- self.lineEdit_proxy_ip_address.setGeometry(QtCore.QRect(210, 210, 151, 31))
- self.lineEdit_proxy_ip_address.setStyleSheet("*{font: 12pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;}")
- self.lineEdit_proxy_ip_address.setObjectName("lineEdit_proxy_ip_address")
- self.label_proxy_port = QtWidgets.QLabel(self.tab_1)
- self.label_proxy_port.setGeometry(QtCore.QRect(100, 260, 111, 21))
- self.label_proxy_port.setObjectName("label_proxy_port")
- self.lineEdit_proxy_port = QtWidgets.QLineEdit(self.tab_1)
- self.lineEdit_proxy_port.setGeometry(QtCore.QRect(210, 260, 111, 31))
- self.lineEdit_proxy_port.setStyleSheet("*{font: 12pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;}")
- self.lineEdit_proxy_port.setObjectName("lineEdit_proxy_port")
- self.lineEdit_dns_1 = QtWidgets.QLineEdit(self.tab_1)
- self.lineEdit_dns_1.setGeometry(QtCore.QRect(560, 310, 181, 31))
- self.lineEdit_dns_1.setStyleSheet("*{font: 12pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;}")
- self.lineEdit_dns_1.setObjectName("lineEdit_dns_1")
- self.label_dns_4 = QtWidgets.QLabel(self.tab_1)
- self.label_dns_4.setGeometry(QtCore.QRect(460, 310, 111, 21))
- self.label_dns_4.setObjectName("label_dns_4")
- self.lineEdit_default_gateway = QtWidgets.QLineEdit(self.tab_1)
- self.lineEdit_default_gateway.setGeometry(QtCore.QRect(560, 270, 181, 31))
- self.lineEdit_default_gateway.setStyleSheet("*{font: 12pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;}")
- self.lineEdit_default_gateway.setObjectName("lineEdit_default_gateway")
- self.label_default_gateway = QtWidgets.QLabel(self.tab_1)
- self.label_default_gateway.setGeometry(QtCore.QRect(460, 270, 111, 21))
- self.label_default_gateway.setObjectName("label_default_gateway")
- self.lineEdit_subnet_mask = QtWidgets.QLineEdit(self.tab_1)
- self.lineEdit_subnet_mask.setGeometry(QtCore.QRect(560, 230, 181, 31))
- self.lineEdit_subnet_mask.setStyleSheet("*{font: 12pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;}")
- self.lineEdit_subnet_mask.setObjectName("lineEdit_subnet_mask")
- self.label_subnet_mask_2 = QtWidgets.QLabel(self.tab_1)
- self.label_subnet_mask_2.setGeometry(QtCore.QRect(460, 230, 111, 21))
- self.label_subnet_mask_2.setObjectName("label_subnet_mask_2")
- self.lineEdit_ip_address = QtWidgets.QLineEdit(self.tab_1)
- self.lineEdit_ip_address.setGeometry(QtCore.QRect(560, 190, 181, 31))
- self.lineEdit_ip_address.setStyleSheet("*{font: 12pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;}")
- self.lineEdit_ip_address.setText("")
- self.lineEdit_ip_address.setObjectName("lineEdit_ip_address")
- self.label_ip_address = QtWidgets.QLabel(self.tab_1)
- self.label_ip_address.setGeometry(QtCore.QRect(480, 190, 111, 21))
- self.label_ip_address.setStyleSheet("")
- self.label_ip_address.setObjectName("label_ip_address")
- self.lineEdit_dns_2 = QtWidgets.QLineEdit(self.tab_1)
- self.lineEdit_dns_2.setGeometry(QtCore.QRect(560, 350, 181, 31))
- self.lineEdit_dns_2.setStyleSheet("*{font: 12pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;}")
- self.lineEdit_dns_2.setObjectName("lineEdit_dns_2")
- self.label_dns_3 = QtWidgets.QLabel(self.tab_1)
- self.label_dns_3.setGeometry(QtCore.QRect(460, 350, 111, 21))
- self.label_dns_3.setObjectName("label_dns_3")
- self.pushButton_software_download = QtWidgets.QPushButton(self.tab_1)
- self.pushButton_software_download.setGeometry(QtCore.QRect(120, 410, 181, 81))
- self.pushButton_software_download.setStyleSheet("*{\n"
- "font: 12pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;\n"
- "}\n"
- "")
- self.pushButton_software_download.setObjectName("pushButton_software_download")
- self.pushButton_onepush = QtWidgets.QPushButton(self.tab_1)
- self.pushButton_onepush.setGeometry(QtCore.QRect(460, 410, 181, 81))
- self.pushButton_onepush.setStyleSheet("*{\n"
- "font: 15pt \"阿里巴巴普惠体 R\";\n"
- "font-weight: bold;\n"
- "color:blue;\n"
- "}\n"
- "")
- self.pushButton_onepush.setObjectName("pushButton_onepush")
- self.label_version_1 = QtWidgets.QLabel(self.tab_1)
- self.label_version_1.setGeometry(QtCore.QRect(20, 530, 161, 16))
- self.label_version_1.setStyleSheet("*{\n"
- " font: 75 10pt \"微软雅黑\";\n"
- "font-weight: bold;\n"
- "color:white;\n"
- "}")
- self.label_version_1.setObjectName("label_version_1")
- self.line_9 = QtWidgets.QFrame(self.tab_1)
- self.line_9.setGeometry(QtCore.QRect(80, 190, 291, 16))
- self.line_9.setFrameShape(QtWidgets.QFrame.HLine)
- self.line_9.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_9.setObjectName("line_9")
- self.line_10 = QtWidgets.QFrame(self.tab_1)
- self.line_10.setGeometry(QtCore.QRect(70, 210, 16, 141))
- self.line_10.setFrameShape(QtWidgets.QFrame.VLine)
- self.line_10.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_10.setObjectName("line_10")
- self.line_11 = QtWidgets.QFrame(self.tab_1)
- self.line_11.setGeometry(QtCore.QRect(80, 360, 291, 16))
- self.line_11.setFrameShape(QtWidgets.QFrame.HLine)
- self.line_11.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_11.setObjectName("line_11")
- self.line_12 = QtWidgets.QFrame(self.tab_1)
- self.line_12.setGeometry(QtCore.QRect(370, 210, 16, 141))
- self.line_12.setFrameShape(QtWidgets.QFrame.VLine)
- self.line_12.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_12.setObjectName("line_12")
- self.groupBox = QtWidgets.QGroupBox(self.tab_1)
- self.groupBox.setGeometry(QtCore.QRect(190, 310, 141, 51))
- self.groupBox.setStyleSheet("*{\n"
- "font: 75 9pt \"微软雅黑\";\n"
- "color:white\n"
- "}")
- self.groupBox.setTitle("")
- self.groupBox.setObjectName("groupBox")
- self.radioButton_switch_off = QtWidgets.QRadioButton(self.groupBox)
- self.radioButton_switch_off.setGeometry(QtCore.QRect(80, 20, 51, 19))
- self.radioButton_switch_off.setStyleSheet("*{\n"
- " font: 75 11pt \"微软雅黑\";\n"
- "font-weight: bold;\n"
- "color:yellow;\n"
- "}")
- self.radioButton_switch_off.setChecked(True)
- self.radioButton_switch_off.setObjectName("radioButton_switch_off")
- self.radioButton_switch_on = QtWidgets.QRadioButton(self.groupBox)
- self.radioButton_switch_on.setGeometry(QtCore.QRect(20, 20, 61, 19))
- self.radioButton_switch_on.setStyleSheet("*{\n"
- " font: 75 11pt \"微软雅黑\";\n"
- "font-weight: bold;\n"
- "color:yellow;\n"
- "}")
- self.radioButton_switch_on.setChecked(False)
- self.radioButton_switch_on.setObjectName("radioButton_switch_on")
- self.groupBox_2 = QtWidgets.QGroupBox(self.tab_1)
- self.groupBox_2.setGeometry(QtCore.QRect(110, 20, 201, 31))
- self.groupBox_2.setStyleSheet("*{\n"
- "\n"
- "font: 75 9pt \"微软雅黑\";\n"
- "color:white;\n"
- "}")
- self.groupBox_2.setTitle("")
- self.groupBox_2.setObjectName("groupBox_2")
- self.radioButton_cancel_all = QtWidgets.QRadioButton(self.groupBox_2)
- self.radioButton_cancel_all.setGeometry(QtCore.QRect(90, 0, 101, 19))
- self.radioButton_cancel_all.setStyleSheet("*{\n"
- " font: 75 10pt \"微软雅黑\";\n"
- "font-weight: bold;\n"
- "color:yellow;\n"
- "}\n"
- "")
- self.radioButton_cancel_all.setObjectName("radioButton_cancel_all")
- self.radioButton_all = QtWidgets.QRadioButton(self.groupBox_2)
- self.radioButton_all.setGeometry(QtCore.QRect(20, 0, 61, 19))
- self.radioButton_all.setStyleSheet("*{\n"
- " font: 75 10pt \"微软雅黑\";\n"
- "font-weight: bold;\n"
- "color:yellow;\n"
- "}\n"
- "")
- self.radioButton_all.setObjectName("radioButton_all")
- self.listView = QtWidgets.QListView(self.tab_1)
- self.listView.setGeometry(QtCore.QRect(-60, -20, 831, 631))
- self.listView.setStyleSheet("background:url(:/picture/light.jpeg)")
- self.listView.setObjectName("listView")
- self.line_5 = QtWidgets.QFrame(self.tab_1)
- self.line_5.setGeometry(QtCore.QRect(0, 510, 771, 16))
- self.line_5.setFrameShape(QtWidgets.QFrame.HLine)
- self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_5.setObjectName("line_5")
- self.line_7 = QtWidgets.QFrame(self.tab_1)
- self.line_7.setGeometry(QtCore.QRect(90, 30, 21, 20))
- self.line_7.setFrameShape(QtWidgets.QFrame.HLine)
- self.line_7.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_7.setObjectName("line_7")
- self.label = QtWidgets.QLabel(self.tab_1)
- self.label.setGeometry(QtCore.QRect(100, 330, 91, 16))
- self.label.setObjectName("label")
- self.line_8 = QtWidgets.QFrame(self.tab_1)
- self.line_8.setGeometry(QtCore.QRect(0, 550, 771, 16))
- self.line_8.setFrameShape(QtWidgets.QFrame.HLine)
- self.line_8.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_8.setObjectName("line_8")
- self.line_16 = QtWidgets.QFrame(self.tab_1)
- self.line_16.setGeometry(QtCore.QRect(160, 520, 20, 41))
- self.line_16.setFrameShape(QtWidgets.QFrame.VLine)
- self.line_16.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_16.setObjectName("line_16")
- self.line_17 = QtWidgets.QFrame(self.tab_1)
- self.line_17.setGeometry(QtCore.QRect(0, 520, 20, 41))
- self.line_17.setFrameShape(QtWidgets.QFrame.VLine)
- self.line_17.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_17.setObjectName("line_17")
- self.listView.raise_()
- self.checkBox_ie_set.raise_()
- self.checkBox_host_domain_map.raise_()
- self.checkBox_c_clear.raise_()
- self.checkBox_restart_print_service.raise_()
- self.checkBox_clear_all_tasks.raise_()
- self.checkBox_fix_dns.raise_()
- self.checkBox_update_AD_domain_strategy.raise_()
- self.line.raise_()
- self.line_2.raise_()
- self.line_3.raise_()
- self.line_4.raise_()
- self.label_proxy_ip_address.raise_()
- self.lineEdit_proxy_ip_address.raise_()
- self.label_proxy_port.raise_()
- self.lineEdit_proxy_port.raise_()
- self.lineEdit_dns_1.raise_()
- self.label_dns_4.raise_()
- self.lineEdit_default_gateway.raise_()
- s
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。