增加容错处理

增加按钮提示文字
This commit is contained in:
shileiye 2022-01-05 17:34:01 +08:00
parent 3ece9fa803
commit 350b7194de
3 changed files with 53 additions and 35 deletions

BIN
dist/main.exe vendored

Binary file not shown.

32
main.py
View File

@ -1,21 +1,21 @@
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
import ast
import configparser import configparser
import os
import pathlib import pathlib
import re import re
import subprocess import subprocess
import os
import psutil
import time
import sys import sys
import pymysql import time
import requests from configparser import ExtendedInterpolation
# import winreg # import winreg
from subprocess import Popen from subprocess import Popen
import psutil
import pymysql
import requests
from PyQt5.QtCore import pyqtSignal, QThread from PyQt5.QtCore import pyqtSignal, QThread
from PyQt5.QtGui import QTextCursor from PyQt5.QtGui import QTextCursor
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox
from configparser import ExtendedInterpolation
# 界面文件为 mainui.py # 界面文件为 mainui.py
from mainui import * from mainui import *
@ -45,16 +45,33 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.newGameInput.setText(config['GAME']['game_name']) self.newGameInput.setText(config['GAME']['game_name'])
# 设置按钮状态 # 设置按钮状态
if not config.has_section('NGINX'):
self.nginxButton.setDisabled(True)
else:
if isinstance(checkprocess("nginx.exe"), int): if isinstance(checkprocess("nginx.exe"), int):
self.nginxButton.setText("关闭Nginx") self.nginxButton.setText("关闭Nginx")
else: else:
self.nginxButton.setText("启动Nginx") self.nginxButton.setText("启动Nginx")
if not config.has_section('MYSQL'):
self.mysqlButton.setDisabled(True)
else:
if isinstance(checkprocess("mysqld.exe"), int): if isinstance(checkprocess("mysqld.exe"), int):
self.mysqlButton.setText("关闭MySql") self.mysqlButton.setText("关闭MySql")
else: else:
self.mysqlButton.setText("启动MySql") 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配置 # 初始化JAVA配置
if not os.getenv('JAVA_HOME'): if not os.getenv('JAVA_HOME'):
java_path = config['TOOL_PATH']['java_path'] java_path = config['TOOL_PATH']['java_path']
@ -92,6 +109,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
return return
# 处理SQL语句 # 处理SQL语句
if config.has_section('GAME_DATA_SQL'):
sql_game_ip = config['GAME_DATA_SQL']['game_ip'].replace(now_ip, new_ip) 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) sql_game_name = config['GAME_DATA_SQL']['game_name'].replace(now_game + '_new', new_game)
sqls = [sql_game_ip, sql_game_name] sqls = [sql_game_ip, sql_game_name]

View File

@ -166,11 +166,11 @@ class Ui_MainWindow(object):
self.gameButton.setToolTip(_translate("MainWindow", "启动游戏网关需一定时间,请耐心等待")) self.gameButton.setToolTip(_translate("MainWindow", "启动游戏网关需一定时间,请耐心等待"))
self.gameButton.setText(_translate("MainWindow", "启动游戏")) self.gameButton.setText(_translate("MainWindow", "启动游戏"))
self.groupBox_3.setTitle(_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.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.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.qianmingButton.setText(_translate("MainWindow", "APK签名"))
self.heidisqlButton.setToolTip(_translate("MainWindow", "一款免费开源的MySQL客户端")) self.heidisqlButton.setToolTip(_translate("MainWindow", "一款免费开源的MySQL客户端"))
self.heidisqlButton.setText(_translate("MainWindow", "HeidiSQL")) self.heidisqlButton.setText(_translate("MainWindow", "HeidiSQL"))