commit 3c202b5ef1fbe3a3c7463f72b7fb2c0eb93c6711
Author: Hatanezumi <13630961608@163.com>
Date: Wed Mar 22 22:39:37 2023 +0800
first commit
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c08c767
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# RA3附属mod下载管理器
+## 介绍
+本程序能快速配置skudef文件或是下载附属mod
\ No newline at end of file
diff --git a/run.py b/run.py
new file mode 100644
index 0000000..5690dfa
--- /dev/null
+++ b/run.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+'''
+@Author : Hatanezumi
+@Contact : Hatanezumi@chunshengserver.cn
+'''
+from src import main
+
+if __name__ == '__main__':
+ main.init()
\ No newline at end of file
diff --git a/src/AutoProcess.py b/src/AutoProcess.py
new file mode 100644
index 0000000..37a359f
--- /dev/null
+++ b/src/AutoProcess.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+'''
+@Author : Hatanezumi
+@Contact : Hatanezumi@chunshengserver.cn
+'''
+import os
+import json
+import requests
+
+def get_mods(base_path:str) -> tuple[bool,str|list[str]]:
+ if os.path.exists(base_path) is False:
+ return (False,'未找到{}'.format(base_path))
+ mod_dirs = [os.path.join(base_path,i) for i in os.listdir(base_path) if os.path.isdir(os.path.join(base_path,i))]
+ mods = [os.path.join(base_path,i) for i in os.listdir(base_path) if os.path.splitext(i)[-1].lower() == '.skudef']
+ if len(mod_dirs) == 0 and len(mods) == 0:
+ return (False,'mod文件夹下无mod')
+ for mod_dir in mod_dirs:
+ mod = [os.path.join(mod_dir,i) for i in os.listdir(mod_dir) if os.path.splitext(i)[-1].lower() == '.skudef']
+ mods += mod
+ if len(mods) == 0:
+ return (False,'mod文件夹下无mod')
+ else:
+ return (True,mods)
+def save_skudef(skufile_path:str,mods:list) -> tuple[bool,str|None]:
+ try:
+ with open(skufile_path,'r',encoding='utf-8') as file:
+ texts = file.readlines()
+ texts = [text for text in texts if not text.startswith('add-big')]
+ mods = ['add-big {}\n'.format(mod) for mod in mods]
+ first_text = texts.pop(0)
+ texts = mods + texts
+ texts.insert(0,first_text)
+ texts[-1] = texts[-1].removesuffix('\n')
+ with open(skufile_path,'w',encoding='utf-8') as file:
+ file.writelines(texts)
+ return (True,None)
+ except Exception as err:
+ return (False,err)
+def get_cloud(path:str, target, arg):
+ try:
+ req = requests.get(path)
+ if req.status_code != 200:
+ target(arg,False,"返回值为:{}".format(req.status_code))
+ return
+ res = json.loads(req.content)
+ target(arg,True,res)
+ except Exception as err:
+ target(arg,False,err)
\ No newline at end of file
diff --git a/src/__pycache__/AutoProcess.cpython-310.pyc b/src/__pycache__/AutoProcess.cpython-310.pyc
new file mode 100644
index 0000000..118e38a
Binary files /dev/null and b/src/__pycache__/AutoProcess.cpython-310.pyc differ
diff --git a/src/__pycache__/main.cpython-310.pyc b/src/__pycache__/main.cpython-310.pyc
new file mode 100644
index 0000000..27105ba
Binary files /dev/null and b/src/__pycache__/main.cpython-310.pyc differ
diff --git a/src/main.py b/src/main.py
new file mode 100644
index 0000000..4d4a95d
--- /dev/null
+++ b/src/main.py
@@ -0,0 +1,341 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+'''
+@Author : Hatanezumi
+@Contact : Hatanezumi@chunshengserver.cn
+'''
+import os
+import sys
+import py7zr
+import requests
+import webbrowser
+from PySide2.QtWidgets import QApplication, QMessageBox, QFileDialog, QInputDialog, QMainWindow, QComboBox
+from PySide2.QtCore import Qt, QStringListModel, Signal, QObject
+from PySide2.QtGui import QColor,QIcon, QTextCursor
+from ui.MainWindow import Ui_MainWindow
+from threading import Thread
+from src import AutoProcess
+
+#常量
+INIT = 100
+REFRESH = 101
+GETMODS = 200
+GETMODINFO = 201
+GETNEWVERSION = 202
+GETOTHER = 210
+INFO = 300
+WARNING = 301
+CRITICAL = 302
+
+class CustomizeSingals(QObject):
+ message_box = Signal(tuple)
+ set_network_page = Signal(dict)
+ set_listView_Network = Signal(dict)
+ set_Status_Tip = Signal(str)
+ set_progressBar_Download = Signal(int)
+ download_finished = Signal(str)
+ download_err = Signal(Exception)
+ set_new_version = Signal(str)
+ get_new_version_err = Signal(str)
+class Process():
+ @staticmethod
+ def set_comboBox(comboBox:QComboBox, texts:list):
+ comboBox.clear()
+ comboBox.addItems(texts)
+ @staticmethod
+ def get_cloud_data(arg, state:bool, res):
+ '''
+ arg:(窗口,模式,获取的内容)
+ '''
+ try:
+ window, mode, source = arg
+ singals = CustomizeSingals()
+ singals.message_box.connect(window.message_box)
+ singals.set_listView_Network.connect(window.set_listView_Network)
+ singals.set_network_page.connect(window.set_network_page)
+ singals.set_Status_Tip.connect(window.set_Status_Tip)
+ singals.set_new_version.connect(window.set_new_version)
+ singals.get_new_version_err.connect(window.get_new_version_err)
+ if not state:
+ if mode == INIT:
+ if source == GETMODS:
+ singals.set_Status_Tip.emit('获取云AR信息失败:{}'.format(res))
+ elif source == GETNEWVERSION:
+ singals.get_new_version_err.emit(res)
+ return
+ elif mode == REFRESH:
+ if source == GETMODS:
+ singals.message_box.emit(WARNING,'出现错误',"获取云AR信息失败:{}".format(res),QMessageBox.Ok,QMessageBox.Ok)
+ elif source == GETMODINFO:
+ singals.message_box.emit(WARNING,'出现错误',"获取mod信息失败:{}".format(res),QMessageBox.Ok,QMessageBox.Ok)
+ if source == GETMODS:
+ singals.set_listView_Network.emit(res)
+ elif source == GETMODINFO:
+ singals.set_network_page.emit(res)
+ elif source == GETNEWVERSION:
+ singals.set_new_version.emit(res['version'])
+ except Exception as err:
+ singals.message_box.emit((WARNING,'出现错误',"获取信息失败:{}".format(err),QMessageBox.Ok,QMessageBox.Ok))
+ @staticmethod
+ def download(window:QMainWindow,url:str,path:str):
+ signals = CustomizeSingals()
+ signals.set_progressBar_Download.connect(window.set_progressBar_Download)
+ signals.download_finished.connect(window.download_finished)
+ signals.download_err.connect(window.download_err)
+ if not os.path.exists(os.path.split(path)[0]):
+ signals.download_err.emit('目录不存在:{}'.format(os.path.split(path)[0]))
+ return
+ res = requests.get(url, stream=True,headers={"Accept-Encoding":"identity"})
+ size = 0#初始化已下载大小
+ chunk_size = 1024#单次下载量
+ content_size = int(res.headers['content-length'])#总大小
+ try:
+ if res.status_code == 200:
+ with open(path,'wb') as file:
+ for data in res.iter_content(chunk_size=chunk_size):
+ file.write(data)
+ size += len(data)
+ signals.set_progressBar_Download.emit(int(size / content_size * 100))
+ signals.download_finished.emit(path)
+ except Exception as err:
+ signals.download_err.emit(err)
+class MainWindow(QMainWindow, Ui_MainWindow):
+ def __init__(self, parent=None) -> None:
+ #基础设置
+ super().__init__(parent)
+ self.setupUi(self)
+ self.version = '1.0.0'
+ #--------------------------
+ #连接信号
+ self.comboBox_mods.currentIndexChanged.connect(self.__comboBox_mods_changed)#下拉框内容改变
+ self.pushButton_R.clicked.connect(self.__on_pushButton_R_clicked)#右移按钮被按下
+ self.pushButton_L.clicked.connect(self.__on_pushButton_L_clicked)#左移按钮被按下
+ self.pushButton_up.clicked.connect(self.__on_pushButton_up_clicked)#上移按钮被按下
+ self.pushButton_down.clicked.connect(self.__on_pushButton_down_clicked)#下移按钮被按下
+ self.pushButton_save.clicked.connect(self.__on_pushButton_save_clicked)#保存按钮被按下
+ self.pushButton_nowpath.clicked.connect(self.__on_pushButton_nowpath_clicked)#选择当前目录按钮被按下
+ self.pushButton_add.clicked.connect(self.__on_pushButton_add_clicked)#添加文件按钮被按下
+ self.pushButton_savedir.clicked.connect(self.__on_pushButton_savedir_clicked)#保存到按钮被按下
+ self.listView_Network.clicked.connect(self.__on_listView_Network_clicked)#网络列表被按下
+ self.pushButton_refresh.clicked.connect(self.__on_pushButton_refresh_clicked)#刷新按钮被按下
+ self.pushButton_Download.clicked.connect(self.__on_pushButton_Download_clicked)#下载按钮被按下
+ self.pushButton_release.clicked.connect(self.__on_pushButton_release_clicked)#发布页按钮被按下
+ #--------------------------
+ #变量注册(全局变量)
+ self.select_mod = ''
+ self.listView_loaded_qsl = QStringListModel()
+ self.listView_local_qsl = QStringListModel()
+ self.listView_Network_qsl = QStringListModel()
+ self.fileDialog = QFileDialog(self)
+ self.base_mod_path = os.path.join(os.path.splitdrive(os.environ['systemroot'])[0],os.environ['homepath'],'Documents','Red Alert 3','Mods')
+ self.cloud_mods = {}
+ self.cloud_mod_source = (None,{})
+ self.isdownloading = False
+ #--------------------------
+ #初始化内容
+ self.mods = AutoProcess.get_mods(self.base_mod_path)
+ if self.mods[0] is False:
+ QMessageBox.warning(self,'获取mod列表失败',self.mods[1],QMessageBox.Ok,QMessageBox.Ok)
+ else:
+ Process.set_comboBox(self.comboBox_mods,[os.path.splitext(os.path.split(mod_name)[1])[0] for mod_name in self.mods[1]])
+ self.label_about_verison.setText('当前版本:{}'.format(self.version))
+ #绑定模型
+ self.listView_loacl.setModel(self.listView_local_qsl)
+ self.listView_loaded.setModel(self.listView_loaded_qsl)
+ self.listView_Network.setModel(self.listView_Network_qsl)
+ #显示当前目录
+ self.lineEdit_nowpath.setText(self.base_mod_path)
+ #获取云信息
+ t = Thread(target=AutoProcess.get_cloud,args=('https://cloud.armorrush.com/Hatanezumi/RA3_affiliated_mods/raw/branch/master/mods.json',Process.get_cloud_data,(self,INIT,GETMODS)),daemon=True)
+ t.start()
+ #获取更新信息
+ t = Thread(target=AutoProcess.get_cloud,args=('https://www.chunshengserver.cn/files/RA3mods/RA3_affiliated_mod_downloader.json',Process.get_cloud_data,(self,INIT,GETNEWVERSION)),daemon=True)
+ t.start()
+ def __comboBox_mods_changed(self):
+ if self.mods[0] is False:
+ return
+ # currentText = self.comboBox_mods.currentText()#为了保证数据安全采用字符串匹配的方式
+ # find = False
+ # for mod_path in self.mods[1]:
+ # if os.path.split(mod_path)[1].removesuffix('.skudef') == currentText:
+ # self.select_mod = mod_path
+ # find = True
+ # break
+ # if find is False:
+ # return
+ #显示本地列表内容
+ currentIndex = self.comboBox_mods.currentIndex()#因为有重复的名称,所以采用索引匹配
+ mod_path = self.mods[1][currentIndex]
+ files = os.listdir(os.path.split(mod_path)[0])
+ files_big = [file for file in files if os.path.splitext(file)[1] == '.big' or os.path.splitext(file)[1] == '.lyi']
+ self.listView_local_qsl.setStringList(files_big)
+ #显示skudef文件内容
+ with open(mod_path,'r',encoding='utf-8') as file:
+ file_text = file.readlines()
+ file_loads = []
+ for text in file_text:
+ if text.startswith('add-big'):
+ file_loads.append(text.split(' ',1)[1].removesuffix('\n'))
+ self.listView_loaded_qsl.setStringList(file_loads)
+ #显示当前文件夹
+ self.label_nowdir.setText('当前文件夹:{}'.format(os.path.split(os.path.split(mod_path)[0])[1]))
+ #显示保存到文件夹
+ self.lineEdit_savedir.setText(os.path.split(mod_path)[0])
+ def __on_pushButton_R_clicked(self):
+ currentIndex = self.listView_loacl.currentIndex().row()
+ if currentIndex == -1:
+ return
+ select_mod_name = self.listView_local_qsl.stringList()[currentIndex]
+ if select_mod_name in self.listView_loaded_qsl.stringList():
+ return
+ new_listView_loaded_qsl = self.listView_loaded_qsl.stringList()
+ new_listView_loaded_qsl.insert(0,select_mod_name)
+ self.listView_loaded_qsl.setStringList(new_listView_loaded_qsl)
+ def __on_pushButton_L_clicked(self):
+ currentIndex = self.listView_loaded.currentIndex().row()
+ if currentIndex == -1:
+ return
+ new_listView_loaded_qsl = self.listView_loaded_qsl.stringList()
+ new_listView_loaded_qsl.pop(currentIndex)
+ self.listView_loaded_qsl.setStringList(new_listView_loaded_qsl)
+ def __on_pushButton_up_clicked(self):
+ currentIndex = self.listView_loaded.currentIndex().row()
+ if currentIndex == -1 or currentIndex == 0:
+ return
+ new_listView_loaded_qsl = self.listView_loaded_qsl.stringList()
+ mod_name = new_listView_loaded_qsl.pop(currentIndex)
+ new_listView_loaded_qsl.insert(currentIndex - 1,mod_name)
+ self.listView_loaded_qsl.setStringList(new_listView_loaded_qsl)
+ def __on_pushButton_down_clicked(self):
+ currentIndex = self.listView_loaded.currentIndex().row()
+ if currentIndex == -1 or currentIndex == len(self.listView_loaded_qsl.stringList()) - 1:
+ return
+ new_listView_loaded_qsl = self.listView_loaded_qsl.stringList()
+ mod_name = new_listView_loaded_qsl.pop(currentIndex)
+ new_listView_loaded_qsl.insert(currentIndex + 1,mod_name)
+ self.listView_loaded_qsl.setStringList(new_listView_loaded_qsl)
+ def __on_pushButton_save_clicked(self):
+ mods = self.listView_loaded_qsl.stringList()
+ currentIndex = self.comboBox_mods.currentIndex()
+ skudef_path = self.mods[1][currentIndex]
+ res = AutoProcess.save_skudef(skudef_path,mods)
+ if res[0]:
+ QMessageBox.information(self,'保存成功','保存成功',QMessageBox.Ok,QMessageBox.Ok)
+ else:
+ select = QMessageBox.critical(self,'保存失败','保存失败:{}'.format(res[1]),QMessageBox.Ok|QMessageBox.Retry,QMessageBox.Ok)
+ if select == QMessageBox.Retry:
+ self.__on_pushButton_save_clicked()
+ def __on_pushButton_nowpath_clicked(self):
+ currentIndex = self.comboBox_mods.currentIndex()
+ mod_path = self.mods[1][currentIndex]
+ select_path = self.fileDialog.getExistingDirectory(self,dir=os.path.split(os.path.split(mod_path)[0])[0])
+ if select_path == '':
+ return
+ mods = AutoProcess.get_mods(select_path)
+ if mods[0] is False:
+ QMessageBox.warning(self,'获取mod列表失败',mods[1],QMessageBox.Ok,QMessageBox.Ok)
+ else:
+ self.base_mod_path = select_path
+ self.mods = mods
+ Process.set_comboBox(self.comboBox_mods,[os.path.splitext(os.path.split(mod_name)[1])[0] for mod_name in mods[1]])
+ #显示当前目录
+ self.lineEdit_nowpath.setText(select_path)
+ def __on_pushButton_add_clicked(self):
+ add_file_name, select = QInputDialog.getText(self,'请输入要添加的big文件名','请输入要添加的big文件名,要带".big"后缀\n如果不了解请勿随意添加')
+ if not select:
+ return
+ if add_file_name == '':
+ QMessageBox.warning(self,'错误的输入','输入内容不能为空!',QMessageBox.Ok,QMessageBox.Ok)
+ return
+ self.listView_loaded_qsl.setStringList([add_file_name]+self.listView_loaded_qsl.stringList())
+ def __on_pushButton_savedir_clicked(self):
+ now_path = self.lineEdit_savedir.text()
+ if not os.path.exists(now_path):
+ now_path = self.base_mod_path
+ select_path = self.fileDialog.getExistingDirectory(self,dir=now_path)
+ if select_path == '':
+ return
+ self.lineEdit_savedir.setText(select_path)
+ def __on_listView_Network_clicked(self):
+ currentIndex = self.listView_Network.currentIndex().row()
+ select_mod_name = self.listView_Network_qsl.stringList()[currentIndex]
+ if select_mod_name not in self.cloud_mods.keys():
+ return
+ t = Thread(target=AutoProcess.get_cloud,args=(self.cloud_mods[select_mod_name],Process.get_cloud_data,(self,REFRESH,GETMODINFO)),daemon=True)
+ t.start()
+ def message_box(self,arg):
+ mode, title, text, Button, defaultButton = arg
+ self.__message_box(mode,title,text,Button,defaultButton)
+ def __message_box(self,mode:int,title:str,text:str,Button:QMessageBox.StandardButton,defaultButton:QMessageBox.StandardButton):
+ if mode == INFO:
+ QMessageBox.information(self,title,text,Button,defaultButton)
+ elif mode == WARNING:
+ QMessageBox.warning(self,title,text,Button,defaultButton)
+ elif mode == CRITICAL:
+ QMessageBox.Critical(self,title,text,Button,defaultButton)
+ def set_network_page(self,res:dict):
+ self.label_name.setText('名称:'+res['name'])
+ self.label_author.setText('作者:'+res['author'])
+ self.label_version.setText('版本:'+res['version'])
+ self.plainTextEdit_introduce.setPlainText(res['introduce'])
+ self.cloud_mod_source = (res['name'],res['source'])
+ Process.set_comboBox(self.comboBox_download,[i['name'] for i in res['source']])
+ def set_listView_Network(self,res:dict):
+ self.listView_Network_qsl.setStringList(res.keys())
+ self.cloud_mods = res
+ def set_Status_Tip(self,text:str):
+ self.setStatusTip(text)
+ def __on_pushButton_refresh_clicked(self):
+ t = Thread(target=AutoProcess.get_cloud,args=('https://cloud.armorrush.com/Hatanezumi/RA3_affiliated_mods/raw/branch/master/mods.json',Process.get_cloud_data,(self,REFRESH,GETMODS)),daemon=True)
+ t.start()
+ def __on_pushButton_Download_clicked(self):
+ if self.isdownloading:
+ QMessageBox.information(self,'无法下载','当前有下载任务在进行',QMessageBox.Ok,QMessageBox.Ok)
+ return
+ currentText = self.comboBox_download.currentText()
+ if self.cloud_mod_source[0] != self.listView_Network_qsl.stringList()[self.listView_Network.currentIndex().row()]:
+ return
+ link = ''
+ for source in self.cloud_mod_source[1]:
+ if source['name'] == currentText:
+ link = source['link']
+ if link == '':
+ return
+ file_name = link.split('/')[-1]
+ save_path = self.lineEdit_savedir.text()
+ self.isdownloading = True
+ t = Thread(target=Process.download,args=(self,link,os.path.join(save_path,file_name)),daemon=True)
+ t.start()
+ def set_progressBar_Download(self,value:int):
+ self.progressBar_Download.setValue(value)
+ def download_finished(self,path:str):
+ self.isdownloading = False
+ self.progressBar_Download.value(0)
+ select = QMessageBox.information(self,'下载成功','下载成功,是否自动解压?',QMessageBox.Ok|QMessageBox.Cancel,QMessageBox.Cancel)
+ if select == QMessageBox.Ok:
+ try:
+ with py7zr.SevenZipFile(file=path,mode='r') as file:
+ file.extractall(path=os.path.split(path)[0])
+ except Exception as err:
+ QMessageBox.warning(self,'解压失败','解压失败,原因:{}'.format(err),QMessageBox.Ok,QMessageBox.Ok)
+ return
+ else:
+ QMessageBox.warning(self,'解压成功','解压成功',QMessageBox.Ok,QMessageBox.Ok)
+ def download_err(self,err:Exception):
+ self.isdownloading = False
+ QMessageBox.warning(self,'下载失败','下载失败,原因:{}'.format(err),QMessageBox.Ok,QMessageBox.Ok)
+ def set_new_version(self,version:str):
+ self.label_about_newverison.setText("最新版本:"+version)
+ version_int = int(version.replace('.',''))
+ self_version = int(self.version.replace('.',''))
+ if version_int > self_version:
+ self.label_about_newverison.setText("最新版本:"+version+"(有更新!请点击发布页下载)")
+ def get_new_version_err(self,err:str):
+ self.label_about_newverison.setText("最新版本:连接到纯世蜉生失败,原因:{}".format(err))
+ def __on_pushButton_release_clicked(self):
+ webbrowser.open('https://cloud.armorrush.com/Hatanezumi')
+def init():
+ app = QApplication(sys.argv)
+ main_window = MainWindow()
+ main_window.show()
+ sys.exit(app.exec_())
\ No newline at end of file
diff --git a/ui/MainWindow.py b/ui/MainWindow.py
new file mode 100644
index 0000000..2dc9b76
--- /dev/null
+++ b/ui/MainWindow.py
@@ -0,0 +1,375 @@
+# -*- coding: utf-8 -*-
+
+################################################################################
+## Form generated from reading UI file 'MainWindow.ui'
+##
+## Created by: Qt User Interface Compiler version 5.15.2
+##
+## WARNING! All changes made in this file will be lost when recompiling UI file!
+################################################################################
+
+from PySide2.QtCore import *
+from PySide2.QtGui import *
+from PySide2.QtWidgets import *
+
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ if not MainWindow.objectName():
+ MainWindow.setObjectName(u"MainWindow")
+ MainWindow.resize(819, 576)
+ self.centralwidget = QWidget(MainWindow)
+ self.centralwidget.setObjectName(u"centralwidget")
+ self.verticalLayout = QVBoxLayout(self.centralwidget)
+ self.verticalLayout.setObjectName(u"verticalLayout")
+ self.tabWidget_Main = QTabWidget(self.centralwidget)
+ self.tabWidget_Main.setObjectName(u"tabWidget_Main")
+ self.tab_local = QWidget()
+ self.tab_local.setObjectName(u"tab_local")
+ self.horizontalLayout = QHBoxLayout(self.tab_local)
+ self.horizontalLayout.setObjectName(u"horizontalLayout")
+ self.verticalLayout_3 = QVBoxLayout()
+ self.verticalLayout_3.setObjectName(u"verticalLayout_3")
+ self.label_local = QLabel(self.tab_local)
+ self.label_local.setObjectName(u"label_local")
+
+ self.verticalLayout_3.addWidget(self.label_local)
+
+ self.listView_loacl = QListView(self.tab_local)
+ self.listView_loacl.setObjectName(u"listView_loacl")
+ self.listView_loacl.setEditTriggers(QAbstractItemView.NoEditTriggers)
+
+ self.verticalLayout_3.addWidget(self.listView_loacl)
+
+
+ self.horizontalLayout.addLayout(self.verticalLayout_3)
+
+ self.verticalLayout_2 = QVBoxLayout()
+ self.verticalLayout_2.setObjectName(u"verticalLayout_2")
+ self.pushButton_R = QPushButton(self.tab_local)
+ self.pushButton_R.setObjectName(u"pushButton_R")
+
+ self.verticalLayout_2.addWidget(self.pushButton_R)
+
+
+ self.horizontalLayout.addLayout(self.verticalLayout_2)
+
+ self.verticalLayout_11 = QVBoxLayout()
+ self.verticalLayout_11.setObjectName(u"verticalLayout_11")
+ self.label_loaded = QLabel(self.tab_local)
+ self.label_loaded.setObjectName(u"label_loaded")
+
+ self.verticalLayout_11.addWidget(self.label_loaded)
+
+ self.listView_loaded = QListView(self.tab_local)
+ self.listView_loaded.setObjectName(u"listView_loaded")
+ self.listView_loaded.setEditTriggers(QAbstractItemView.NoEditTriggers)
+
+ self.verticalLayout_11.addWidget(self.listView_loaded)
+
+
+ self.horizontalLayout.addLayout(self.verticalLayout_11)
+
+ self.verticalLayout_12 = QVBoxLayout()
+ self.verticalLayout_12.setObjectName(u"verticalLayout_12")
+ self.pushButton_up = QPushButton(self.tab_local)
+ self.pushButton_up.setObjectName(u"pushButton_up")
+
+ self.verticalLayout_12.addWidget(self.pushButton_up)
+
+ self.pushButton_down = QPushButton(self.tab_local)
+ self.pushButton_down.setObjectName(u"pushButton_down")
+
+ self.verticalLayout_12.addWidget(self.pushButton_down)
+
+ self.pushButton_add = QPushButton(self.tab_local)
+ self.pushButton_add.setObjectName(u"pushButton_add")
+
+ self.verticalLayout_12.addWidget(self.pushButton_add)
+
+ self.pushButton_L = QPushButton(self.tab_local)
+ self.pushButton_L.setObjectName(u"pushButton_L")
+
+ self.verticalLayout_12.addWidget(self.pushButton_L)
+
+
+ self.horizontalLayout.addLayout(self.verticalLayout_12)
+
+ self.verticalLayout_4 = QVBoxLayout()
+ self.verticalLayout_4.setObjectName(u"verticalLayout_4")
+ self.horizontalLayout_6 = QHBoxLayout()
+ self.horizontalLayout_6.setObjectName(u"horizontalLayout_6")
+ self.label_nowpath = QLabel(self.tab_local)
+ self.label_nowpath.setObjectName(u"label_nowpath")
+
+ self.horizontalLayout_6.addWidget(self.label_nowpath)
+
+ self.lineEdit_nowpath = QLineEdit(self.tab_local)
+ self.lineEdit_nowpath.setObjectName(u"lineEdit_nowpath")
+ self.lineEdit_nowpath.setReadOnly(True)
+
+ self.horizontalLayout_6.addWidget(self.lineEdit_nowpath)
+
+ self.pushButton_nowpath = QPushButton(self.tab_local)
+ self.pushButton_nowpath.setObjectName(u"pushButton_nowpath")
+
+ self.horizontalLayout_6.addWidget(self.pushButton_nowpath)
+
+
+ self.verticalLayout_4.addLayout(self.horizontalLayout_6)
+
+ self.comboBox_mods = QComboBox(self.tab_local)
+ self.comboBox_mods.setObjectName(u"comboBox_mods")
+
+ self.verticalLayout_4.addWidget(self.comboBox_mods)
+
+ self.label_nowdir = QLabel(self.tab_local)
+ self.label_nowdir.setObjectName(u"label_nowdir")
+
+ self.verticalLayout_4.addWidget(self.label_nowdir)
+
+ self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+
+ self.verticalLayout_4.addItem(self.verticalSpacer)
+
+ self.pushButton_save = QPushButton(self.tab_local)
+ self.pushButton_save.setObjectName(u"pushButton_save")
+
+ self.verticalLayout_4.addWidget(self.pushButton_save)
+
+
+ self.horizontalLayout.addLayout(self.verticalLayout_4)
+
+ self.tabWidget_Main.addTab(self.tab_local, "")
+ self.tab_Network = QWidget()
+ self.tab_Network.setObjectName(u"tab_Network")
+ self.horizontalLayout_2 = QHBoxLayout(self.tab_Network)
+ self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
+ self.listView_Network = QListView(self.tab_Network)
+ self.listView_Network.setObjectName(u"listView_Network")
+ self.listView_Network.setEditTriggers(QAbstractItemView.NoEditTriggers)
+
+ self.horizontalLayout_2.addWidget(self.listView_Network)
+
+ self.verticalLayout_7 = QVBoxLayout()
+ self.verticalLayout_7.setObjectName(u"verticalLayout_7")
+ self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+
+ self.verticalLayout_7.addItem(self.verticalSpacer_2)
+
+ self.pushButton_refresh = QPushButton(self.tab_Network)
+ self.pushButton_refresh.setObjectName(u"pushButton_refresh")
+
+ self.verticalLayout_7.addWidget(self.pushButton_refresh)
+
+
+ self.horizontalLayout_2.addLayout(self.verticalLayout_7)
+
+ self.verticalLayout_6 = QVBoxLayout()
+ self.verticalLayout_6.setObjectName(u"verticalLayout_6")
+ self.label_name = QLabel(self.tab_Network)
+ self.label_name.setObjectName(u"label_name")
+
+ self.verticalLayout_6.addWidget(self.label_name)
+
+ self.label_author = QLabel(self.tab_Network)
+ self.label_author.setObjectName(u"label_author")
+
+ self.verticalLayout_6.addWidget(self.label_author)
+
+ self.label_version = QLabel(self.tab_Network)
+ self.label_version.setObjectName(u"label_version")
+
+ self.verticalLayout_6.addWidget(self.label_version)
+
+ self.horizontalLayout_3 = QHBoxLayout()
+ self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
+ self.label_introduce = QLabel(self.tab_Network)
+ self.label_introduce.setObjectName(u"label_introduce")
+
+ self.horizontalLayout_3.addWidget(self.label_introduce)
+
+ self.plainTextEdit_introduce = QPlainTextEdit(self.tab_Network)
+ self.plainTextEdit_introduce.setObjectName(u"plainTextEdit_introduce")
+ self.plainTextEdit_introduce.setLineWrapMode(QPlainTextEdit.NoWrap)
+
+ self.horizontalLayout_3.addWidget(self.plainTextEdit_introduce)
+
+
+ self.verticalLayout_6.addLayout(self.horizontalLayout_3)
+
+
+ self.horizontalLayout_2.addLayout(self.verticalLayout_6)
+
+ self.line = QFrame(self.tab_Network)
+ self.line.setObjectName(u"line")
+ self.line.setFrameShape(QFrame.VLine)
+ self.line.setFrameShadow(QFrame.Sunken)
+
+ self.horizontalLayout_2.addWidget(self.line)
+
+ self.verticalLayout_8 = QVBoxLayout()
+ self.verticalLayout_8.setObjectName(u"verticalLayout_8")
+ self.horizontalLayout_4 = QHBoxLayout()
+ self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
+ self.label_savedir = QLabel(self.tab_Network)
+ self.label_savedir.setObjectName(u"label_savedir")
+
+ self.horizontalLayout_4.addWidget(self.label_savedir)
+
+ self.lineEdit_savedir = QLineEdit(self.tab_Network)
+ self.lineEdit_savedir.setObjectName(u"lineEdit_savedir")
+ self.lineEdit_savedir.setReadOnly(False)
+
+ self.horizontalLayout_4.addWidget(self.lineEdit_savedir)
+
+ self.pushButton_savedir = QPushButton(self.tab_Network)
+ self.pushButton_savedir.setObjectName(u"pushButton_savedir")
+
+ self.horizontalLayout_4.addWidget(self.pushButton_savedir)
+
+
+ self.verticalLayout_8.addLayout(self.horizontalLayout_4)
+
+ self.horizontalLayout_7 = QHBoxLayout()
+ self.horizontalLayout_7.setObjectName(u"horizontalLayout_7")
+ self.label_source = QLabel(self.tab_Network)
+ self.label_source.setObjectName(u"label_source")
+
+ self.horizontalLayout_7.addWidget(self.label_source)
+
+ self.comboBox_download = QComboBox(self.tab_Network)
+ self.comboBox_download.setObjectName(u"comboBox_download")
+
+ self.horizontalLayout_7.addWidget(self.comboBox_download)
+
+ self.horizontalLayout_7.setStretch(1, 10)
+
+ self.verticalLayout_8.addLayout(self.horizontalLayout_7)
+
+ self.verticalSpacer_3 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+
+ self.verticalLayout_8.addItem(self.verticalSpacer_3)
+
+ self.progressBar_Download = QProgressBar(self.tab_Network)
+ self.progressBar_Download.setObjectName(u"progressBar_Download")
+ self.progressBar_Download.setValue(0)
+
+ self.verticalLayout_8.addWidget(self.progressBar_Download)
+
+ self.pushButton_Download = QPushButton(self.tab_Network)
+ self.pushButton_Download.setObjectName(u"pushButton_Download")
+
+ self.verticalLayout_8.addWidget(self.pushButton_Download)
+
+
+ self.horizontalLayout_2.addLayout(self.verticalLayout_8)
+
+ self.tabWidget_Main.addTab(self.tab_Network, "")
+ self.tab_about = QWidget()
+ self.tab_about.setObjectName(u"tab_about")
+ self.horizontalLayout_5 = QHBoxLayout(self.tab_about)
+ self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
+ self.verticalLayout_9 = QVBoxLayout()
+ self.verticalLayout_9.setObjectName(u"verticalLayout_9")
+ self.label_about_author = QLabel(self.tab_about)
+ self.label_about_author.setObjectName(u"label_about_author")
+
+ self.verticalLayout_9.addWidget(self.label_about_author)
+
+ self.label_about_contact = QLabel(self.tab_about)
+ self.label_about_contact.setObjectName(u"label_about_contact")
+
+ self.verticalLayout_9.addWidget(self.label_about_contact)
+
+
+ self.horizontalLayout_5.addLayout(self.verticalLayout_9)
+
+ self.line_2 = QFrame(self.tab_about)
+ self.line_2.setObjectName(u"line_2")
+ self.line_2.setFrameShape(QFrame.VLine)
+ self.line_2.setFrameShadow(QFrame.Sunken)
+
+ self.horizontalLayout_5.addWidget(self.line_2)
+
+ self.verticalLayout_10 = QVBoxLayout()
+ self.verticalLayout_10.setObjectName(u"verticalLayout_10")
+ self.label_about_verison = QLabel(self.tab_about)
+ self.label_about_verison.setObjectName(u"label_about_verison")
+
+ self.verticalLayout_10.addWidget(self.label_about_verison)
+
+ self.label_about_newverison = QLabel(self.tab_about)
+ self.label_about_newverison.setObjectName(u"label_about_newverison")
+
+ self.verticalLayout_10.addWidget(self.label_about_newverison)
+
+ self.pushButton_release = QPushButton(self.tab_about)
+ self.pushButton_release.setObjectName(u"pushButton_release")
+
+ self.verticalLayout_10.addWidget(self.pushButton_release)
+
+
+ self.horizontalLayout_5.addLayout(self.verticalLayout_10)
+
+ self.tabWidget_Main.addTab(self.tab_about, "")
+
+ self.verticalLayout.addWidget(self.tabWidget_Main)
+
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.statusBar = QStatusBar(MainWindow)
+ self.statusBar.setObjectName(u"statusBar")
+ MainWindow.setStatusBar(self.statusBar)
+
+ self.retranslateUi(MainWindow)
+
+ self.tabWidget_Main.setCurrentIndex(0)
+
+
+ QMetaObject.connectSlotsByName(MainWindow)
+ # setupUi
+
+ def retranslateUi(self, MainWindow):
+ MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"RA3\u9644\u5c5emod\u4e0b\u8f7d\u5668", None))
+#if QT_CONFIG(statustip)
+ MainWindow.setStatusTip("")
+#endif // QT_CONFIG(statustip)
+ self.label_local.setText(QCoreApplication.translate("MainWindow", u"\u5f53\u524d\u6587\u4ef6\u5939\u4e0b\u7684big\u6587\u4ef6", None))
+ self.pushButton_R.setText(QCoreApplication.translate("MainWindow", u"\u2192", None))
+ self.label_loaded.setText(QCoreApplication.translate("MainWindow", u"\u5f53\u524d\u52a0\u8f7d\u7684\u6587\u4ef6", None))
+ self.pushButton_up.setText(QCoreApplication.translate("MainWindow", u"\u2191", None))
+ self.pushButton_down.setText(QCoreApplication.translate("MainWindow", u"\u2193", None))
+ self.pushButton_add.setText(QCoreApplication.translate("MainWindow", u"+", None))
+ self.pushButton_L.setText(QCoreApplication.translate("MainWindow", u"-", None))
+ self.label_nowpath.setText(QCoreApplication.translate("MainWindow", u"\u5f53\u524d\u76ee\u5f55:", None))
+ self.pushButton_nowpath.setText(QCoreApplication.translate("MainWindow", u"...", None))
+ self.label_nowdir.setText(QCoreApplication.translate("MainWindow", u"\u5f53\u524d\u6587\u4ef6\u5939:", None))
+ self.pushButton_save.setText(QCoreApplication.translate("MainWindow", u"\u4fdd\u5b58", None))
+ self.tabWidget_Main.setTabText(self.tabWidget_Main.indexOf(self.tab_local), QCoreApplication.translate("MainWindow", u"\u672c\u5730", None))
+ self.pushButton_refresh.setText(QCoreApplication.translate("MainWindow", u"\u5237\u65b0", None))
+ self.label_name.setText(QCoreApplication.translate("MainWindow", u"\u540d\u79f0:", None))
+ self.label_author.setText(QCoreApplication.translate("MainWindow", u"\u4f5c\u8005:", None))
+ self.label_version.setText(QCoreApplication.translate("MainWindow", u"\u7248\u672c:", None))
+ self.label_introduce.setText(QCoreApplication.translate("MainWindow", u"\u4ecb\u7ecd:", None))
+ self.label_savedir.setText(QCoreApplication.translate("MainWindow", u"\u4fdd\u5b58\u5230:", None))
+ self.pushButton_savedir.setText(QCoreApplication.translate("MainWindow", u"...", None))
+ self.label_source.setText(QCoreApplication.translate("MainWindow", u"\u4e0b\u8f7d\u6e90:", None))
+ self.pushButton_Download.setText(QCoreApplication.translate("MainWindow", u"\u4e0b\u8f7d", None))
+ self.tabWidget_Main.setTabText(self.tabWidget_Main.indexOf(self.tab_Network), QCoreApplication.translate("MainWindow", u"\u7f51\u7edc", None))
+ self.label_about_author.setText(QCoreApplication.translate("MainWindow", u"\u4f5c\u8005:\u7530\u9f20-Hatanezumi", None))
+ self.label_about_contact.setText(QCoreApplication.translate("MainWindow", u"\u8054\u7cfb:Hatanezumi@chunshengserver.cn", None))
+ self.label_about_verison.setText(QCoreApplication.translate("MainWindow", u"\u5f53\u524d\u7248\u672c:", None))
+ self.label_about_newverison.setText(QCoreApplication.translate("MainWindow", u"\u6700\u65b0\u7248\u672c:", None))
+ self.pushButton_release.setText(QCoreApplication.translate("MainWindow", u"\u53d1\u5e03\u9875", None))
+ self.tabWidget_Main.setTabText(self.tabWidget_Main.indexOf(self.tab_about), QCoreApplication.translate("MainWindow", u"\u5173\u4e8e", None))
+#if QT_CONFIG(statustip)
+ self.statusBar.setStatusTip("")
+#endif // QT_CONFIG(statustip)
+#if QT_CONFIG(accessibility)
+ self.statusBar.setAccessibleName("")
+#endif // QT_CONFIG(accessibility)
+#if QT_CONFIG(accessibility)
+ self.statusBar.setAccessibleDescription("")
+#endif // QT_CONFIG(accessibility)
+ # retranslateUi
+
diff --git a/ui/MainWindow.ui b/ui/MainWindow.ui
new file mode 100644
index 0000000..4074d97
--- /dev/null
+++ b/ui/MainWindow.ui
@@ -0,0 +1,404 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 819
+ 576
+
+
+
+ RA3附属mod下载器
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
+
+ 本地
+
+
+
-
+
+
-
+
+
+ 当前文件夹下的big文件
+
+
+
+ -
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+
+
+
+ -
+
+
-
+
+
+ →
+
+
+
+
+
+ -
+
+
-
+
+
+ 当前加载的文件
+
+
+
+ -
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+
+
+
+ -
+
+
-
+
+
+ ↑
+
+
+
+ -
+
+
+ ↓
+
+
+
+ -
+
+
+ +
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ 当前目录:
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
+
+
+ -
+
+
+ 当前文件夹:
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ 保存
+
+
+
+
+
+
+
+
+
+ 网络
+
+
+ -
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+
+ -
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ 刷新
+
+
+
+
+
+ -
+
+
-
+
+
+ 名称:
+
+
+
+ -
+
+
+ 作者:
+
+
+
+ -
+
+
+ 版本:
+
+
+
+ -
+
+
-
+
+
+ 介绍:
+
+
+
+ -
+
+
+ QPlainTextEdit::NoWrap
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ -
+
+
-
+
+
-
+
+
+ 保存到:
+
+
+
+ -
+
+
+ false
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
+
+
-
+
+
+ 下载源:
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ 0
+
+
+
+ -
+
+
+ 下载
+
+
+
+
+
+
+
+
+
+ 关于
+
+
+ -
+
+
-
+
+
+ 作者:田鼠-Hatanezumi
+
+
+
+ -
+
+
+ 联系:Hatanezumi@chunshengserver.cn
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ -
+
+
-
+
+
+ 当前版本:
+
+
+
+ -
+
+
+ 最新版本:
+
+
+
+ -
+
+
+ 发布页
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ui/__pycache__/MainWindow.cpython-310.pyc b/ui/__pycache__/MainWindow.cpython-310.pyc
new file mode 100644
index 0000000..bc3ae7f
Binary files /dev/null and b/ui/__pycache__/MainWindow.cpython-310.pyc differ
diff --git a/ui/自动格式转换.py b/ui/自动格式转换.py
new file mode 100644
index 0000000..b4b8450
--- /dev/null
+++ b/ui/自动格式转换.py
@@ -0,0 +1,5 @@
+import os
+
+files = [file for file in os.listdir() if os.path.splitext(file)[1] == '.ui']
+for file in files:
+ os.system('pyside2-uic {} > {}'.format(file,os.path.splitext(file)[0] + '.py'))
\ No newline at end of file