日常更新

This commit is contained in:
LanShui 2024-05-20 16:23:36 +08:00
parent deb6121f8d
commit 4735cf0081
7 changed files with 22 additions and 43 deletions

Binary file not shown.

Binary file not shown.

41
apps.py
View File

@ -7,34 +7,20 @@ client_version = "v1.0.0"
login_headers = {"Content-Type": "application/json"}
login_user_key = "f0649fc2aeb411eda71f00163e095b49"
aotu_user_url = f"https://auth.mc-user.com:233/{login_user_key}/"
cra_mc_server_api = ""
cra_mc_server_api = "https://craapi.xfcloud.org/api/"
cra_mc_api_id = "IAts0Hp2MbUGw"
server_ip_list_dict = "info/servers"
reload_password_page = "https://login.mc-user.com:233/account/login"
register_web_page = "https://login.mc-user.com:233/f0649fc2aeb411eda71f00163e095b49/register"
server_list_configfile = "config_app/server_list_config.json"
login_json_file = "config_app/login_user.json"
window_size_int = (950, 560)
style_qss_stylesheet_body_file_dir = "style/style.qss"
data_server_list_dict_jsonfile = [
{
"name": "CRA-MC",
"server_test": "HELLO WORLD",
"server_file_name": "cra_mc",
"image": "https://s21.ax1x.com/2024/05/05/pkE9wUe.jpg"
},
{
"name": "CRA-MC1",
"server_test": "HELLO WORLD",
"server_file_name": "cra_mc",
"image": "https://s21.ax1x.com/2024/05/05/pkE9wUe.jpg"
}
]
@staticmethod
def readQSS(style: str):
with open(file=style, mode='r', encoding="UTF-8") as f:
@ -119,17 +105,6 @@ class Thread_appcode_login_user(QThread):
data = dict()
code = int(0)
if os.path.isfile(server_list_configfile) is False:
with open(file=server_list_configfile, mode='w', encoding="UTF-8", newline='') as f_write_server_list:
json.dump(data_server_list_dict_jsonfile, f_write_server_list)
if os.path.isfile(server_list_configfile) is True:
with open(file=server_list_configfile, mode='r', encoding="UTF-8", newline='') as f_read_all:
json_server_list_all = json.load(f_read_all)
if all(json_server_list_all) is False:
data_server_list_dict_jsonfile_all = data_server_list_dict_jsonfile
with open(file=server_list_configfile, mode='w', encoding="UTF-8", newline='') as f_write_all:
json.dump(data_server_list_dict_jsonfile_all, f_write_all)
ping_server = os.system("ping www.baidu.com -n 3")
if ping_server == 1:
data = dict()
@ -169,20 +144,20 @@ class Thread_appcode_login_user(QThread):
with open(file=login_json_file, mode='w', encoding="UTF-8", newline='') as dump_f:
json.dump(data_login_file, dump_f)
with open(file=server_list_configfile, mode='r', encoding="UTF-8", newline='') as read_server_list_f:
server_list_json_dict = json.load(read_server_list_f)
req_server_list_api = requests.get(url=cra_mc_server_api + server_ip_list_dict, headers=login_headers)
server_list_json_dict: dict = [req_server_list_api.json()[cra_mc_api_id]]
server_list_json_ = server_list_json_dict
server_list0 = list()
for i_server in server_list_json_:
server_list1 = [
i_server.get("name"), i_server.get("server_file_name"), i_server.get("server_ip")
i_server.get("servername")
]
server_list0.append(server_list1)
for i_image_content_for in server_list_json_:
req_image = requests.get(url=i_image_content_for.get("image")).content
req_image = requests.get(url=i_image_content_for.get("logourl")).content
i_image_content_for.update({"image": req_image})
data = {

View File

@ -1 +1 @@
{"accessToken": "cf9e9027138e11ef92c5e252f2c508d4", "clientToken": "ceee8954-138e-11ef-92c5-e252f2c508d4", "id": "a6143eb7a7883daab9a05dbe052879a1", "name": "GameDaBai"}
{"accessToken": "eb00b22d167411ef92c5e252f2c508d4", "clientToken": "ea55c2cc-1674-11ef-92c5-e252f2c508d4", "id": "a6143eb7a7883daab9a05dbe052879a1", "name": "GameDaBai"}

View File

@ -1 +0,0 @@
[{"name": "CRA-MC", "server_test": "HELLO WORLD", "server_file_name": "cra_mc", "image": "https://s21.ax1x.com/2024/05/05/pkE9wUe.jpg"}, {"name": "CRA-MC1", "server_test": "HELLO WORLD", "server_file_name": "cra_mc", "image": "https://s21.ax1x.com/2024/05/05/pkE9wUe.jpg"}]

19
main.py
View File

@ -251,6 +251,12 @@ class My_APP_Window(QTabWidget):
self.server_list = QListWidget()
self.server_ip_list = QListWidget()
self.server_ip_list.setFixedSize(500, 55)
self.server_ip_list.setFlow(QListView.LeftToRight)
self.server_ip_list.addItems(["name1", "name2", "name33"])
index_home_grid_box.addWidget(self.server_ip_list, 2, 0, alignment=Qt.AlignLeft | Qt.AlignBottom)
self.start_game_button = QPushButton(text="启动游戏")
self.start_game_button.clicked.connect(self.start_games_apps)
self.start_game_button.setFixedSize(200, 55)
@ -258,7 +264,7 @@ class My_APP_Window(QTabWidget):
index_home_grid_box.addWidget(self.start_game_button, 2, 0, alignment=Qt.AlignRight | Qt.AlignBottom)
for i_server_list_for in self.server_list_dict:
item = apps.customQListWidgetItem(image=i_server_list_for.get("image"), names=i_server_list_for.get("name"), tests=i_server_list_for.get("server_test"))
item = apps.customQListWidgetItem(image=i_server_list_for.get("image"), names=i_server_list_for.get("servername"), tests=i_server_list_for.get("summary"))
self.server_list.addItem(item)
self.server_list.setItemWidget(item, item.item_widget)
@ -267,13 +273,12 @@ class My_APP_Window(QTabWidget):
def start_games_apps(self):
if self.server_list.currentRow() == -1:
return apps.Message_ok(message="请先选择需要加入的服务器")
if self.server_ip_list.currentRow() == -1:
return apps.Message_ok(message="请选择一条线路")
start_game_name = self.server_id_dict_list[self.server_list.currentRow()]
self.start_window_game = QWidget()
self.start_window_game.setWindowModality(Qt.ApplicationModal)
self.start_window_game.setWindowFlags(Qt.FramelessWindowHint)
self.start_window_game.setWindowTitle(apps.window_title_apps_name)
self.start_window_game.setFixedSize(400, 230)
self.start_window_game.show()
return None
def stop_rungame_apps(self):
return None
def zxh_apps(self):

View File

@ -3,7 +3,7 @@ from PySide2.QtGui import QGuiApplication, QPixmap, QImage, QIcon
from PySide2.QtCore import QCoreApplication, Qt, QThread, QSettings, Signal
from PySide2.QtWidgets import (
QPushButton, QToolButton, QListWidget, QLineEdit, QLabel, QTableWidget, QCheckBox, QComboBox, QMessageBox, QSlider, QProgressBar,
QFileDialog, QListWidgetItem
QFileDialog, QListWidgetItem, QListView
)
import sys
import os