增加容错处理
增加按钮提示文字
This commit is contained in:
parent
3ece9fa803
commit
350b7194de
BIN
dist/main.exe
vendored
BIN
dist/main.exe
vendored
Binary file not shown.
82
main.py
82
main.py
@ -1,21 +1,21 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
import ast
|
||||
import configparser
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import subprocess
|
||||
import os
|
||||
import psutil
|
||||
import time
|
||||
import sys
|
||||
import pymysql
|
||||
import requests
|
||||
import time
|
||||
from configparser import ExtendedInterpolation
|
||||
# import winreg
|
||||
from subprocess import Popen
|
||||
|
||||
import psutil
|
||||
import pymysql
|
||||
import requests
|
||||
from PyQt5.QtCore import pyqtSignal, QThread
|
||||
from PyQt5.QtGui import QTextCursor
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox
|
||||
from configparser import ExtendedInterpolation
|
||||
|
||||
# 界面文件为 mainui.py
|
||||
from mainui import *
|
||||
@ -45,16 +45,33 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.newGameInput.setText(config['GAME']['game_name'])
|
||||
|
||||
# 设置按钮状态
|
||||
if isinstance(checkprocess("nginx.exe"), int):
|
||||
self.nginxButton.setText("关闭Nginx")
|
||||
if not config.has_section('NGINX'):
|
||||
self.nginxButton.setDisabled(True)
|
||||
else:
|
||||
self.nginxButton.setText("启动Nginx")
|
||||
if isinstance(checkprocess("nginx.exe"), int):
|
||||
self.nginxButton.setText("关闭Nginx")
|
||||
else:
|
||||
self.nginxButton.setText("启动Nginx")
|
||||
|
||||
if isinstance(checkprocess("mysqld.exe"), int):
|
||||
self.mysqlButton.setText("关闭MySql")
|
||||
if not config.has_section('MYSQL'):
|
||||
self.mysqlButton.setDisabled(True)
|
||||
else:
|
||||
self.mysqlButton.setText("启动MySql")
|
||||
if isinstance(checkprocess("mysqld.exe"), int):
|
||||
self.mysqlButton.setText("关闭MySql")
|
||||
else:
|
||||
self.mysqlButton.setText("启动MySql")
|
||||
|
||||
if not config.has_section('WEB'):
|
||||
self.gmurlButton.setDisabled(True)
|
||||
self.yyurlButton.setDisabled(True)
|
||||
else:
|
||||
self.gmurlButton.setToolTip("<html><head/><body><p>网址:" + config['WEB']['gm_url'] + "<br/>帐号:" + config['WEB']['gm_user'] + "<br/>密码:" + config['WEB']['gm_pass'] + "<br/>校验码:" + config['WEB']['gm_code'] + "</p></body></html>")
|
||||
self.yyurlButton.setToolTip("<html><head/><body><p>网址:" + config['WEB']['game_url'] + "<br/>帐号:" + config['WEB']['game_user'] + "<br/>密码:" + config['WEB']['game_pass'] + "<br/>校验码:" + config['WEB']['game_code'] + "</p></body></html>")
|
||||
|
||||
if config.has_section('ANDROID'):
|
||||
self.fanbianyiButton.setToolTip("反编译的APK路径:<br>" + config['ANDROID']['android_name'] + "<br>反编译后的文件路径:<br>" + config['ANDROID']['android_name_file'])
|
||||
self.shengchengButton.setToolTip("生成的APK路径:<br>" + config['ANDROID']['tmp_android_name'])
|
||||
self.qianmingButton.setToolTip("签名后的APK路径:<br>" + config['ANDROID']['new_android_name'] + "<br>密钥路径:<br>" + config['TOOL_PATH']['apktool_path'] + "key.keystore")
|
||||
# 初始化JAVA配置
|
||||
if not os.getenv('JAVA_HOME'):
|
||||
java_path = config['TOOL_PATH']['java_path']
|
||||
@ -92,28 +109,29 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
return
|
||||
|
||||
# 处理SQL语句
|
||||
sql_game_ip = config['GAME_DATA_SQL']['game_ip'].replace(now_ip, new_ip)
|
||||
sql_game_name = config['GAME_DATA_SQL']['game_name'].replace(now_game + '_new', new_game)
|
||||
sqls = [sql_game_ip, sql_game_name]
|
||||
if config.has_section('GAME_DATA_SQL'):
|
||||
sql_game_ip = config['GAME_DATA_SQL']['game_ip'].replace(now_ip, new_ip)
|
||||
sql_game_name = config['GAME_DATA_SQL']['game_name'].replace(now_game + '_new', new_game)
|
||||
sqls = [sql_game_ip, sql_game_name]
|
||||
|
||||
# 判断MYSQL是否启动
|
||||
if isinstance(checkprocess("mysqld.exe"), int):
|
||||
mysql_run(sqls)
|
||||
else:
|
||||
message = QMessageBox.information(self, "提示信息", "MYSQL尚未启动,数据库相关脚本无法执行,是否现在启动MYSQL?", QMessageBox.Ok | QMessageBox.No, QMessageBox.Ok)
|
||||
if message == QMessageBox.Ok:
|
||||
self.mysql(self.mysqlButton) # 触发MYSQL启动按钮
|
||||
sum = 0
|
||||
# 以0.5秒的频次检测MYSQL是否启动,超过20次则超时
|
||||
while not isinstance(checkprocess("mysqld.exe"), int):
|
||||
if sum > 20:
|
||||
QMessageBox.information(self, "提示信息", "MYSQL启动失败,请重新尝试!")
|
||||
return
|
||||
time.sleep(0.5)
|
||||
sum = sum + 1
|
||||
# 判断MYSQL是否启动
|
||||
if isinstance(checkprocess("mysqld.exe"), int):
|
||||
mysql_run(sqls)
|
||||
else:
|
||||
return
|
||||
message = QMessageBox.information(self, "提示信息", "MYSQL尚未启动,数据库相关脚本无法执行,是否现在启动MYSQL?", QMessageBox.Ok | QMessageBox.No, QMessageBox.Ok)
|
||||
if message == QMessageBox.Ok:
|
||||
self.mysql(self.mysqlButton) # 触发MYSQL启动按钮
|
||||
sum = 0
|
||||
# 以0.5秒的频次检测MYSQL是否启动,超过20次则超时
|
||||
while not isinstance(checkprocess("mysqld.exe"), int):
|
||||
if sum > 20:
|
||||
QMessageBox.information(self, "提示信息", "MYSQL启动失败,请重新尝试!")
|
||||
return
|
||||
time.sleep(0.5)
|
||||
sum = sum + 1
|
||||
mysql_run(sqls)
|
||||
else:
|
||||
return
|
||||
|
||||
# 配置文件处理
|
||||
sum = 0
|
||||
|
@ -166,11 +166,11 @@ class Ui_MainWindow(object):
|
||||
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.setToolTip(_translate("MainWindow", "反编译的APK路径:-"))
|
||||
self.fanbianyiButton.setText(_translate("MainWindow", "反编译APK"))
|
||||
self.shengchengButton.setToolTip(_translate("MainWindow", "生成的APK路径:d"))
|
||||
self.shengchengButton.setToolTip(_translate("MainWindow", "生成的APK路径:-"))
|
||||
self.shengchengButton.setText(_translate("MainWindow", "生成APK"))
|
||||
self.qianmingButton.setToolTip(_translate("MainWindow", "签名后的APK路径:d"))
|
||||
self.qianmingButton.setToolTip(_translate("MainWindow", "签名后的APK路径:-"))
|
||||
self.qianmingButton.setText(_translate("MainWindow", "APK签名"))
|
||||
self.heidisqlButton.setToolTip(_translate("MainWindow", "一款免费开源的MySQL客户端"))
|
||||
self.heidisqlButton.setText(_translate("MainWindow", "HeidiSQL"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user