增加JAVA环境配置
增加VC运行库安装
增加检测升级功能
This commit is contained in:
shileiye 2022-01-05 02:31:10 +08:00
parent d8b3aebe39
commit f3ce17779b
5 changed files with 297 additions and 28 deletions

View File

@ -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

BIN
dist/main.exe vendored

Binary file not shown.

68
main.py
View File

@ -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()

View File

@ -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", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">准备就绪,请在上方进行操作,部分操作进程和结果会在此处显示。</p></body></html>"))
self.groupBox_4.setTitle(_translate("MainWindow", "游戏相关"))
self.gmurlButton.setToolTip(_translate("MainWindow", "<html><head/><body><p>网址http://127.0.0.1:81/gm<br/>帐号admin<br/>密码123456<br/>校验码123456</p></body></html>"))
self.gmurlButton.setText(_translate("MainWindow", "GM后台"))
self.yyurlButton.setToolTip(_translate("MainWindow", "<html><head/><body><p>网址http://127.0.0.1:81/gm<br/>帐号admin<br/>密码123456<br/>校验码123456</p></body></html>"))
self.yyurlButton.setText(_translate("MainWindow", "运营后台"))
self.copyLabel.setText(_translate("MainWindow", "<html><head/><body><p>牛叉游戏部署工具 v1.0 By<a href=\"https://shileiye.com\"><span style=\" text-decoration: none; color:#0000ff;\">shileiye</span></a></p></body></html>"))
self.upButton.setText(_translate("MainWindow", "检查新版"))
import icon_rc

183
mainui.ui
View File

@ -6,15 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>530</height>
<width>561</width>
<height>551</height>
</rect>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="windowTitle">
<string>牛叉游戏部署工具 v1.0 By:shileiye</string>
<string>牛叉游戏部署工具 v1.0</string>
</property>
<property name="windowIcon">
<iconset resource="icon.qrc">
@ -183,7 +183,7 @@
<rect>
<x>20</x>
<y>130</y>
<width>520</width>
<width>281</width>
<height>80</height>
</rect>
</property>
@ -199,6 +199,9 @@
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>如正常启动Nginx和MySQL后网页报错或运行不正常可尝试安装VC运行库后再试</string>
</property>
<property name="text">
<string>启动Nginx</string>
</property>
@ -212,6 +215,9 @@
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>如正常启动Nginx和MySQL后网页报错或运行不正常可尝试安装VC运行库后再试</string>
</property>
<property name="text">
<string>启动MySql</string>
</property>
@ -225,6 +231,9 @@
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>启动游戏网关需一定时间,请耐心等待</string>
</property>
<property name="text">
<string>启动游戏</string>
</property>
@ -251,6 +260,9 @@
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>反编译的APK路径d</string>
</property>
<property name="text">
<string>反编译APK</string>
</property>
@ -264,6 +276,9 @@
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>生成的APK路径d</string>
</property>
<property name="text">
<string>生成APK</string>
</property>
@ -277,6 +292,9 @@
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>签名后的APK路径d</string>
</property>
<property name="text">
<string>APK签名</string>
</property>
@ -290,11 +308,14 @@
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>一款免费开源的MySQL客户端</string>
</property>
<property name="text">
<string>HeidiSQL</string>
</property>
</widget>
<widget class="QPushButton" name="gmurlButton">
<widget class="QPushButton" name="msvbcrtButton">
<property name="geometry">
<rect>
<x>370</x>
@ -303,8 +324,11 @@
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>如正常启动Nginx和MySQL后网页报错或运行不正常可尝试安装VC运行库后再试</string>
</property>
<property name="text">
<string>GM后台</string>
<string>VC运行库</string>
</property>
</widget>
</widget>
@ -329,9 +353,102 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;准备就绪,请在上方进行操作,部分操作进程和结果会在此处显示。&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_4">
<property name="geometry">
<rect>
<x>310</x>
<y>130</y>
<width>231</width>
<height>80</height>
</rect>
</property>
<property name="title">
<string>游戏相关</string>
</property>
<widget class="QPushButton" name="gmurlButton">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>80</width>
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;网址http://127.0.0.1:81/gm&lt;br/&gt;帐号admin&lt;br/&gt;密码123456&lt;br/&gt;校验码123456&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>GM后台</string>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QPushButton" name="yyurlButton">
<property name="geometry">
<rect>
<x>100</x>
<y>20</y>
<width>80</width>
<height>45</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;网址http://127.0.0.1:81/gm&lt;br/&gt;帐号admin&lt;br/&gt;密码123456&lt;br/&gt;校验码123456&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>运营后台</string>
</property>
</widget>
</widget>
<widget class="QLabel" name="copyLabel">
<property name="geometry">
<rect>
<x>250</x>
<y>520</y>
<width>211</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(150, 150, 150);</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;牛叉游戏部署工具 v1.0 By&lt;a href=&quot;https://shileiye.com&quot;&gt;&lt;span style=&quot; text-decoration: none; color:#0000ff;&quot;&gt;shileiye&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QPushButton" name="upButton">
<property name="geometry">
<rect>
<x>470</x>
<y>520</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(150, 150, 150);</string>
</property>
<property name="text">
<string>检查新版</string>
</property>
</widget>
</widget>
</widget>
<tabstops>
<tabstop>newGameInput</tabstop>
<tabstop>newIpInput</tabstop>
<tabstop>saveSetButton</tabstop>
<tabstop>nginxButton</tabstop>
<tabstop>mysqlButton</tabstop>
<tabstop>gameButton</tabstop>
<tabstop>gmurlButton</tabstop>
<tabstop>yyurlButton</tabstop>
<tabstop>fanbianyiButton</tabstop>
<tabstop>shengchengButton</tabstop>
<tabstop>qianmingButton</tabstop>
<tabstop>heidisqlButton</tabstop>
<tabstop>msvbcrtButton</tabstop>
<tabstop>CMDtextEdit</tabstop>
<tabstop>upButton</tabstop>
</tabstops>
<resources>
<include location="icon.qrc"/>
</resources>
@ -503,8 +620,8 @@ p, li { white-space: pre-wrap; }
<slot>lower()</slot>
<hints>
<hint type="sourcelabel">
<x>429</x>
<y>262</y>
<x>359</x>
<y>172</y>
</hint>
<hint type="destinationlabel">
<x>279</x>
@ -512,5 +629,53 @@ p, li { white-space: pre-wrap; }
</hint>
</hints>
</connection>
<connection>
<sender>yyurlButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>lower()</slot>
<hints>
<hint type="sourcelabel">
<x>449</x>
<y>172</y>
</hint>
<hint type="destinationlabel">
<x>280</x>
<y>264</y>
</hint>
</hints>
</connection>
<connection>
<sender>msvbcrtButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>lower()</slot>
<hints>
<hint type="sourcelabel">
<x>429</x>
<y>262</y>
</hint>
<hint type="destinationlabel">
<x>280</x>
<y>264</y>
</hint>
</hints>
</connection>
<connection>
<sender>upButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>lower()</slot>
<hints>
<hint type="sourcelabel">
<x>507</x>
<y>531</y>
</hint>
<hint type="destinationlabel">
<x>280</x>
<y>275</y>
</hint>
</hints>
</connection>
</connections>
</ui>