diff --git a/__pycache__/apps.cpython-310.pyc b/__pycache__/apps.cpython-310.pyc index 147230b..c116246 100644 Binary files a/__pycache__/apps.cpython-310.pyc and b/__pycache__/apps.cpython-310.pyc differ diff --git a/__pycache__/module.cpython-310.pyc b/__pycache__/module.cpython-310.pyc index de4f081..c290da0 100644 Binary files a/__pycache__/module.cpython-310.pyc and b/__pycache__/module.cpython-310.pyc differ diff --git a/apps.py b/apps.py index 1992d23..2c8c299 100644 --- a/apps.py +++ b/apps.py @@ -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 = { diff --git a/config_app/login_user.json b/config_app/login_user.json index c0771ff..81b9864 100644 --- a/config_app/login_user.json +++ b/config_app/login_user.json @@ -1 +1 @@ -{"accessToken": "cf9e9027138e11ef92c5e252f2c508d4", "clientToken": "ceee8954-138e-11ef-92c5-e252f2c508d4", "id": "a6143eb7a7883daab9a05dbe052879a1", "name": "GameDaBai"} \ No newline at end of file +{"accessToken": "eb00b22d167411ef92c5e252f2c508d4", "clientToken": "ea55c2cc-1674-11ef-92c5-e252f2c508d4", "id": "a6143eb7a7883daab9a05dbe052879a1", "name": "GameDaBai"} \ No newline at end of file diff --git a/config_app/server_list_config.json b/config_app/server_list_config.json deleted file mode 100644 index bed49d7..0000000 --- a/config_app/server_list_config.json +++ /dev/null @@ -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"}] \ No newline at end of file diff --git a/main.py b/main.py index f7ff247..fba304b 100644 --- a/main.py +++ b/main.py @@ -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): diff --git a/module.py b/module.py index 197f288..0767ab0 100644 --- a/module.py +++ b/module.py @@ -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