diff --git a/config.ini b/config.ini index c477692..6462b36 100644 --- a/config.ini +++ b/config.ini @@ -52,7 +52,7 @@ gm_url = http://${domain_name}:${web_port}/gm gm_code = 123456 gm_user = test gm_pass = test -game_back = http://${domain_name}:${web_port}/gameback +game_url = http://${domain_name}:${web_port}/gameback game_code = 123456 game_user = test game_pass = test @@ -79,11 +79,11 @@ android_name_file = ${android_path}game\ tmp_android_name = ${android_path}game_tmp.apk new_android_name = ${android_path}game_signed.apk -[pc] +[PC] pc_path = ${GAME:client_path}pc\ pc_name = ${pc_path}pc\bin.exe -[ios] +[IOS] ios_path = ${GAME:client_path}ios\ ios_name = ${android_path}game.ipa @@ -92,6 +92,8 @@ apktool_path = ${GAME:tool_path}apktool\ heidisql_path = ${GAME:tool_path}HeidiSQL\heidisql.exe notepad3_path = ${GAME:tool_path}Notepad3\Notepad3.exe composer_path = ${GAME:tool_path}Composer\ +java_path = ${GAME:tool_path}jdk-8\ +msvbcrt_path = ${GAME:tool_path}Other\MSVBCRT.exe [OTHER] about = shileiye diff --git a/dist/main.exe b/dist/main.exe index d9fb3cd..78a7aa5 100644 Binary files a/dist/main.exe and b/dist/main.exe differ diff --git a/main.py b/main.py index 2bdb743..7d1425d 100644 --- a/main.py +++ b/main.py @@ -4,13 +4,14 @@ import configparser import pathlib import re import subprocess - +import os import psutil import time -from subprocess import Popen import sys - import pymysql +import requests +# import winreg +from subprocess import Popen from PyQt5.QtCore import pyqtSignal, QThread from PyQt5.QtGui import QTextCursor from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox @@ -18,8 +19,6 @@ from configparser import ExtendedInterpolation # 界面文件为 mainui.py from mainui import * -import requests -import os configFile = 'config.ini' # 创建配置文件对象 @@ -56,6 +55,16 @@ class MainWindow(QMainWindow, Ui_MainWindow): else: self.mysqlButton.setText("启动MySql") + # 初始化JAVA配置 + if not os.getenv('JAVA_HOME'): + java_path = config['TOOL_PATH']['java_path'] + os.environ['JAVA_HOME'] = java_path + os.environ['path'] = os.getenv('path') + java_path + 'bin;' + java_path + 'jre\\bin;' + os.environ['CLASSPATH'] = java_path + 'bin;' + java_path + 'lib\\dt.jar;' + java_path + 'lib\\tools.jar;' + # print(os.getenv('JAVA_HOME')) + # print(os.getenv('CLASSPATH')) + # print(os.getenv('path')) + def saveSet(self, event): print('保存设置,按钮被单击') # print(config['GAME_FILE_PATH']['game']) @@ -296,7 +305,46 @@ class MainWindow(QMainWindow, Ui_MainWindow): # encoding='utf-8' ) print('gmurl,按钮被单击') - #TODO 增加自动登录GM后台功能 + # TODO 增加自动登录GM后台功能 + + def yyurl(self, event): + cmd = 'start ' + config['WEB']['game_url'] + Popen(cmd, + shell=True, + # cwd=config['MYSQL']['mysql_path'] + 'bin', + # encoding='utf-8' + ) + print('yyurl,按钮被单击') + # TODO 增加自动登录后台功能 + + # VC运行库 + def msvbcrt(self, event): + cmd = 'start "" ' + config['TOOL_PATH']['msvbcrt_path'] + Popen(cmd, + shell=True, + # cwd=config['MYSQL']['mysql_path'] + 'bin', + # encoding='utf-8' + ) + print('VC运行库,按钮被单击') + + # 程序升级 + def up(self, event): + if self.upButton.text() == '检查新版' or self.upButton.text() == '无新版本': + newVersion = getNewVersion() # 获取新版本号 + # if os.path.isfile("upgrade.bat"): # 判断是否有upgrade.bat这个文件,有就删除 + # os.remove("upgrade.bat") + if version < newVersion: # 判断当前程序是否是最新版本 + self.upButton.setText("新版本:" + str(newVersion)) + else: + self.upButton.setText("无新版本") + print('当前版本:', version, '\t最新版本:', newVersion) + else: + cmd = 'start ' + 'https://shileiye.com/' + Popen(cmd, + shell=True, + ) + print('检查新版,按钮被单击') + # TODO 增加自动下载更新功能 # 利用新线程进行脚本执行回显 def add_cmd_msg(self, cmd, cwd="", title="", obj="", path="", code="utf8"): @@ -395,7 +443,15 @@ def startfile(filename): subprocess.Popen(f'explorer /select, "{pathlib.Path(filename)}') +# 获取最新程序版本号 +def getNewVersion(): + url = r'http://127.0.0.1:82/Version.txt' + value = requests.get(url, timeout=10).content.decode() + return float(value) + + if __name__ == '__main__': + version = 1.0 app = QApplication(sys.argv) myWin = MainWindow() myWin.show() diff --git a/mainui.py b/mainui.py index ce07234..f19d78c 100644 --- a/mainui.py +++ b/mainui.py @@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(560, 530) + MainWindow.resize(561, 551) MainWindow.setMouseTracking(False) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icon/src/icon/dengdai.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) @@ -61,7 +61,7 @@ class Ui_MainWindow(object): self.label_5.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_5.setObjectName("label_5") self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget) - self.groupBox_2.setGeometry(QtCore.QRect(20, 130, 520, 80)) + self.groupBox_2.setGeometry(QtCore.QRect(20, 130, 281, 80)) self.groupBox_2.setObjectName("groupBox_2") self.nginxButton = QtWidgets.QPushButton(self.groupBox_2) self.nginxButton.setGeometry(QtCore.QRect(10, 20, 80, 45)) @@ -87,18 +87,32 @@ class Ui_MainWindow(object): self.heidisqlButton = QtWidgets.QPushButton(self.groupBox_3) self.heidisqlButton.setGeometry(QtCore.QRect(280, 20, 80, 45)) self.heidisqlButton.setObjectName("heidisqlButton") - self.gmurlButton = QtWidgets.QPushButton(self.groupBox_3) - self.gmurlButton.setGeometry(QtCore.QRect(370, 20, 80, 45)) - self.gmurlButton.setObjectName("gmurlButton") + self.msvbcrtButton = QtWidgets.QPushButton(self.groupBox_3) + self.msvbcrtButton.setGeometry(QtCore.QRect(370, 20, 80, 45)) + self.msvbcrtButton.setObjectName("msvbcrtButton") self.CMDtextEdit = QtWidgets.QTextEdit(self.centralwidget) self.CMDtextEdit.setGeometry(QtCore.QRect(20, 320, 521, 180)) self.CMDtextEdit.setStyleSheet("background-color: rgb(0, 0, 0);\n" "color: rgb(40, 255, 16);") self.CMDtextEdit.setObjectName("CMDtextEdit") + self.groupBox_4 = QtWidgets.QGroupBox(self.centralwidget) + self.groupBox_4.setGeometry(QtCore.QRect(310, 130, 231, 80)) + self.groupBox_4.setObjectName("groupBox_4") + self.gmurlButton = QtWidgets.QPushButton(self.groupBox_4) + self.gmurlButton.setGeometry(QtCore.QRect(10, 20, 80, 45)) + self.gmurlButton.setObjectName("gmurlButton") + self.yyurlButton = QtWidgets.QPushButton(self.groupBox_4) + self.yyurlButton.setGeometry(QtCore.QRect(100, 20, 80, 45)) + self.yyurlButton.setObjectName("yyurlButton") + self.copyLabel = QtWidgets.QLabel(self.centralwidget) + self.copyLabel.setGeometry(QtCore.QRect(250, 520, 211, 21)) + self.copyLabel.setStyleSheet("color: rgb(150, 150, 150);") + self.copyLabel.setObjectName("copyLabel") + self.upButton = QtWidgets.QPushButton(self.centralwidget) + self.upButton.setGeometry(QtCore.QRect(470, 520, 75, 23)) + self.upButton.setStyleSheet("color: rgb(150, 150, 150);") + self.upButton.setObjectName("upButton") MainWindow.setCentralWidget(self.centralwidget) - self.statusbar = QtWidgets.QStatusBar(MainWindow) - self.statusbar.setObjectName("statusbar") - MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.saveSetButton.clicked.connect(MainWindow.saveSet) @@ -112,11 +126,28 @@ class Ui_MainWindow(object): self.newIpInput.returnPressed.connect(self.saveSetButton.click) self.newGameInput.returnPressed.connect(self.saveSetButton.click) self.gmurlButton.clicked.connect(MainWindow.gmurl) + self.yyurlButton.clicked.connect(MainWindow.yyurl) + self.msvbcrtButton.clicked.connect(MainWindow.msvbcrt) + self.upButton.clicked.connect(MainWindow.up) QtCore.QMetaObject.connectSlotsByName(MainWindow) + MainWindow.setTabOrder(self.newGameInput, self.newIpInput) + MainWindow.setTabOrder(self.newIpInput, self.saveSetButton) + MainWindow.setTabOrder(self.saveSetButton, self.nginxButton) + MainWindow.setTabOrder(self.nginxButton, self.mysqlButton) + MainWindow.setTabOrder(self.mysqlButton, self.gameButton) + MainWindow.setTabOrder(self.gameButton, self.gmurlButton) + MainWindow.setTabOrder(self.gmurlButton, self.yyurlButton) + MainWindow.setTabOrder(self.yyurlButton, self.fanbianyiButton) + MainWindow.setTabOrder(self.fanbianyiButton, self.shengchengButton) + MainWindow.setTabOrder(self.shengchengButton, self.qianmingButton) + MainWindow.setTabOrder(self.qianmingButton, self.heidisqlButton) + MainWindow.setTabOrder(self.heidisqlButton, self.msvbcrtButton) + MainWindow.setTabOrder(self.msvbcrtButton, self.CMDtextEdit) + MainWindow.setTabOrder(self.CMDtextEdit, self.upButton) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate - MainWindow.setWindowTitle(_translate("MainWindow", "牛叉游戏部署工具 v1.0 By:shileiye")) + MainWindow.setWindowTitle(_translate("MainWindow", "牛叉游戏部署工具 v1.0")) self.groupBox.setTitle(_translate("MainWindow", "基本设置")) self.saveSetButton.setText(_translate("MainWindow", "保存")) self.newGameInput.setPlaceholderText(_translate("MainWindow", "输入新名称")) @@ -128,18 +159,33 @@ class Ui_MainWindow(object): self.nowGameLabel.setText(_translate("MainWindow", "XX游戏")) self.label_5.setText(_translate("MainWindow", "游戏IP:")) self.groupBox_2.setTitle(_translate("MainWindow", "基础服务")) + self.nginxButton.setToolTip(_translate("MainWindow", "如正常启动Nginx和MySQL后网页报错或运行不正常可尝试安装VC运行库后再试")) self.nginxButton.setText(_translate("MainWindow", "启动Nginx")) + self.mysqlButton.setToolTip(_translate("MainWindow", "如正常启动Nginx和MySQL后网页报错或运行不正常可尝试安装VC运行库后再试")) self.mysqlButton.setText(_translate("MainWindow", "启动MySql")) + self.gameButton.setToolTip(_translate("MainWindow", "启动游戏网关需一定时间,请耐心等待")) self.gameButton.setText(_translate("MainWindow", "启动游戏")) self.groupBox_3.setTitle(_translate("MainWindow", "辅助工具")) + self.fanbianyiButton.setToolTip(_translate("MainWindow", "反编译的APK路径:d")) self.fanbianyiButton.setText(_translate("MainWindow", "反编译APK")) + self.shengchengButton.setToolTip(_translate("MainWindow", "生成的APK路径:d")) self.shengchengButton.setText(_translate("MainWindow", "生成APK")) + self.qianmingButton.setToolTip(_translate("MainWindow", "签名后的APK路径:d")) self.qianmingButton.setText(_translate("MainWindow", "APK签名")) + self.heidisqlButton.setToolTip(_translate("MainWindow", "一款免费开源的MySQL客户端")) self.heidisqlButton.setText(_translate("MainWindow", "HeidiSQL")) - self.gmurlButton.setText(_translate("MainWindow", "GM后台")) + self.msvbcrtButton.setToolTip(_translate("MainWindow", "如正常启动Nginx和MySQL后网页报错或运行不正常可尝试安装VC运行库后再试")) + self.msvbcrtButton.setText(_translate("MainWindow", "VC运行库")) self.CMDtextEdit.setHtml(_translate("MainWindow", "\n" "
\n" "准备就绪,请在上方进行操作,部分操作进程和结果会在此处显示。
")) + self.groupBox_4.setTitle(_translate("MainWindow", "游戏相关")) + self.gmurlButton.setToolTip(_translate("MainWindow", "网址:http://127.0.0.1:81/gm
帐号:admin
密码:123456
校验码:123456
网址:http://127.0.0.1:81/gm
帐号:admin
密码:123456
校验码:123456
牛叉游戏部署工具 v1.0 By:shileiye
")) + self.upButton.setText(_translate("MainWindow", "检查新版")) import icon_rc diff --git a/mainui.ui b/mainui.ui index 52ee054..7861bce 100644 --- a/mainui.ui +++ b/mainui.ui @@ -6,15 +6,15 @@