diff --git a/LANG/deepin-wine-runner-en_US.qm b/LANG/deepin-wine-runner-en_US.qm new file mode 100644 index 0000000..64ce5e4 Binary files /dev/null and b/LANG/deepin-wine-runner-en_US.qm differ diff --git a/LANG/deepin-wine-runner-en_US.ts b/LANG/deepin-wine-runner-en_US.ts new file mode 100644 index 0000000..e561084 --- /dev/null +++ b/LANG/deepin-wine-runner-en_US.ts @@ -0,0 +1,664 @@ + + + + + U + + + ???? + Fast Run + + + + 确定 + OK + + + + 如果安装字体?只需要把字体文件复制到此字体目录 +按下“OK”按钮可以打开字体目录 + If you want to install Font, you only copy font files to this directory +Check "OK " to open fonts directory + + + + 更新(更新过程中会关闭所有Python应用,包括这个应用) + Update (it will kill all python program when you're installing) + + + + 此为最新版本,无需更新 + It's newest program now, you don't need to update program + + + + 错误 + Error + + + + 无法连接服务器! + Can't connect the Program Server! + + + + 检查更新 + Check Update + + + + ISO镜像: + ISO Image FIle: + + + + 浏览 + Browser + + + + 读取/挂载ISO镜像 + Read/Mount ISO Image File + + + + 关闭/卸载ISO镜像 + Close/Unmount ISO Image File + + + + 查找 + Find + + + + 保存到 wine 容器中 + Save DLL for wine botton + + + + 设置 wine 容器 + Setting Wine Botton + + + + 查找DLL +(为空则代表不查找, +将显示全部内容): + Find DLL +(Nothing means don't find,will show all dlls): + + + + 提示 + Tips + + + + 关闭/卸载成功! + Close/Remove Success! + + + + 暂时还没有该软件的运行情况信息 +是否自己上传该软件的运行情况? + No body update this program running status now +Do you want to update first? + + + + 点此上传运行情况 + Click here to update + + + + 综合评价: + User Thinking: + + + + 上传 + Update + + + + 如果这个程序和程序名确实是合法还是检测到敏感词,改为“NULL”即可 + You can try press "NULL" if you can't to update because program name + + + + 程序名: + Program Name: + + + + 上传程序运行情况 + Fast Run + + + + 数据上传失败! + Update Error! + + + + 选择 Wine 容器版本: + Choose Wine Version: + + + + wine DEBUG 信息输出: + Show Wine Debug Information: + + + + 默认 Wine: + Default Wine Version: + + + + 默认 Wine 容器: + Defualt Wine Botton: + + + + 使用终端打开: + Use Terminal To Open Program: + + + + 自定义 wine 参数: + More Wine Command Option: + + + + 程序主题: + Program Theme: + + + + Wine 默认 Mono 和 Gecko 安装器: + Using Wine Defult Mono And Gecko Installer: + + + + 忽略未安装的 Wine: + Unsee Not Install Wine Version: + + + + 下载缓存: + Download Cache: + + + + 开启 DEBUG 输出 + Show Wine Debug Info + + + + 保存 + Save + + + + 测试(重启后变回设置的主题) + Test(Restarting will show setting themes) + + + + 使用终端打开(deepin 终端) + Use Terminal To Open(Deepin Terminal) + + + + 屏蔽 Wine 默认 Mono 和 Gecko 安装器 + Don't Use Wine Default Mono And Gecko Installer + + + + 不显示未检测到的 Wine + Don't Show Unknown Wine Version + + + + 开启下载缓存 + Start Download Cache + + + + 选择 Wine 容器 + Choose Wine Botton + + + + 快速启动 + Fast Run + + + + 请选择容器路径: + Choose Wine Botton Path: + + + + 请选择要执行的程序: + Choose EXE Files: + + + + 请选择WINE版本: + Choose Wine Version: + + + + 高级功能 + More Function + + + + 创建快捷方式(Desktop文件): + Create Program Link(.desktop file): + + + + 创建到桌面 + Create To Desktop + + + + 创建到开始菜单 + Create To Launcher + + + + 程序管理: + Program Manager: + + + + 提取图标 + Get Program Icon + + + + 窗口透明工具 + Window Transparent Tools + + + + 卸载程序 + Remove Program + + + + 微型应用商店 + Mini App Store + + + + 获取该程序运行情况 + Get Choosed Program Running Status + + + + WINE配置: + Wine Config: + + + + 配置容器 + Config Wine + + + + 字体商店 + Fonts Store + + + + 安装自定义字体 + Install More Fonts + + + + 星火wine配置 + Spark Wine Config + + + + 在此可以看到wine安装应用时的终端输出内容 + You can see wine running return things here + + + + 运行程序 + Run Program + + + + 终止程序 + Stop Program + + + + 程序(&P) + Program(&P) + + + + 安装 wine(&I) + Install Wine(&I) + + + + 安装 wine(只限Deepin23) + Install Wine(Only For Deepin 23) + + + + 安装 WineHQ + Install WineHQ + + + + 安装更多 Wine + Install More Wine + + + + 设置程序(&S) + Setting Program(&S) + + + + 清空软件历史记录(&C) + Clean Program History Data(&C) + + + + 清空软件缓存 + Clean Program Cache + + + + 删除程序组件 + Remove Program Function + + + + 退出程序(&E) + Exit Program(&E) + + + + Wine(&W) + Wine(&W) + + + + 打开 Wine 容器目录 + Open Wine Botton Directory + + + + 安装常见字体 + Install Fonts + + + + 删除选择的 Wine 容器 + Delete Choose Wine Botton + + + + 清理 Wine 容器(基于 Wine 适配活动脚本) + Clean Wine Botton(By UOS Wine Activity Shell) + + + + 打包 wine 应用 + Build Windows Program Installer For Linux By Wine + + + + 使用官方 Wine 适配活动的脚本进行打包 + Build Windows Program Installer For Linux By Wine(By UOS Wine Activity Shell) + + + + 从镜像获取DLL(只支持Windows XP、Windows Server 2003官方安装镜像) + Get Dll For ISO Images(Only Support Windows XP And Windows Server 2003 Microsoft Installer) + + + + 从 Geek Uninstaller 官网升级程序 + Update Geek Uninstaller From Geek Websize + + + + 删除所有 Wine 程序在启动器的快捷方式 + Delete All Wine Program Links On Launcher + + + + 在指定 Wine、容器安装组件 + Install Runtime With Choose Wine Botton And Version + + + + 在指定wine、指定容器安装 .net framework + Install .Net Framework + + + + 在指定wine、指定容器安装 Visual Studio C++ + Install Visual Studio C++ Runtime + + + + 在指定wine、指定容器安装 MSXML + Install MSXML + + + + 在指定wine、指定容器安装 gecko + Install Gecko + + + + 在指定wine、指定容器安装 mono + Install Mono + + + + 在指定wine、指定容器安装其它运行库 + Install Other Runtime + + + + 在指定 Wine、容器运行基础应用 + Run Basic Program + + + + 打开指定wine、指定容器的控制面板 + Run Control + + + + 打开指定wine、指定容器的浏览器 + Run Web Browser + + + + 打开指定wine、指定容器的注册表 + Run Regedit + + + + 打开指定wine、指定容器的任务管理器 + Run Taskmgr + + + + 打开指定wine、指定容器的资源管理器 + Run File Explorer + + + + 打开指定wine、指定容器的关于 wine + Run About Wine + + + + 设置 run_v3.sh 的文管为 Deepin 默认文管 + Set Deepin File Dialog Defult On run_v3.sh + + + + 设置 run_v3.sh 的文管为 Wine 默认文管 + Set Wine File Dialog Defult On run_v3.sh + + + + 重新安装 deepin-wine-helper + Reinstall deepin-wine-helper + + + + 使用winetricks打开指定容器 + Using Winetricks + + + + 启用/禁用 opengl + Enabled/Disbled OpenGL + + + + 开启 opengl + Enabled OpenGL + + + + 禁用 opengl + Disbled OpenGL + + + + 安装/卸载 winbind + Install/Uninstall Winbind + + + + 安装 winbind + Install Winbind + + + + 卸载 winbind + Uninstall Winbind + + + + 安装/卸载 DXVK + Install/Uninstall DXVK + + + + 安装 DXVK + Install DXVK + + + + 卸载 DXVK + Uninstall DXVK + + + + 虚拟机(&V) + Virtual Machine(&V) + + + + 使用 Virtualbox 虚拟机运行 Windows 应用 + Run Windows Program By VirtualBox + + + + 云沙箱(&C) + Cloud Sandbox(&C) + + + + 360 沙箱云 + 360 Cloud Sandbox + + + + 微步云沙箱 + ThreatBook Cloud Sandbox + + + + VIRUSTOTAL + VIRUSTOTAL + + + + 帮助(&H) + Help(&H) + + + + 程序官网 + Program Websize + + + + 小提示 + Program Tips + + + + 更新内容 + Program New Things + + + + 谢明名单 + Thank List + + + + 更新这个程序 + UPdate This Program + + + + 反馈这个程序的建议和问题 + Update Advices And Problem + + + + 关于这个程序 + About This Program + + + + 关于 Qt + About Qt + + + + 更多生态适配应用 + More Deepin/UOS Program + + + + 运行 Android 应用:UEngine 运行器 + Run Android Program: UEngine Runner + + + diff --git a/LANG/installwine-en_US.qm b/LANG/installwine-en_US.qm new file mode 100644 index 0000000..8b60ace Binary files /dev/null and b/LANG/installwine-en_US.qm differ diff --git a/LANG/installwine-en_US.ts b/LANG/installwine-en_US.ts new file mode 100644 index 0000000..64fb074 --- /dev/null +++ b/LANG/installwine-en_US.ts @@ -0,0 +1,32 @@ + + + + + MainWindow + + + 下载 Wine + Download Wine + + + + << + << + + + + >> + >> + + + + 不解压Wine资源文件 + Don't Unzip Wine File + + + + 删除下载的资源包,只解压保留(两个选项都选相互抵消) + Delete Download Zip File And Only Unzip + + + diff --git a/deepin-wine-packager.py b/deepin-wine-packager.py index 81cf0a1..8a7ad6d 100755 --- a/deepin-wine-packager.py +++ b/deepin-wine-packager.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ######################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布 -# 版本:2.0.0 +# 版本:2.0.1 # 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 的 PyQt5 构建 ######################################################################### @@ -10,6 +10,7 @@ ################# import os import sys +import time import json import shutil import random @@ -77,9 +78,12 @@ class QT: thread = None savePath = "" +savePathBlock = False def SavePathGet(temp): global savePath - savePath = QtWidgets.QFileDialog.getExistingDirectory(widget, "选择模板生成位置", "~") + global savePathBlock + savePath = QtWidgets.QFileDialog.getExistingDirectory(widget, "选择模板生成位置", get_home()) + savePathBlock = True def ErrorMsg(info): QtWidgets.QMessageBox.critical(widget, "错误", info) @@ -758,14 +762,27 @@ fi self.label.emit("正在删除对构建 deb 包有影响的文件……") if self.build: global savePath + global savePathBlock + savePathBlock = False self.getSavePath.emit("") + # 必须保证信号完全执行才可以继续 + # 所以自制信号锁 + while not savePathBlock: + time.sleep(0.1) + # if savePath == "": - self.disabled_or_NORMAL_all.emit(False) + print("ggg") + self.disabled_or_NORMAL_all.emit(True) return + print("aaa") debPackagePath = savePath + print("g") else: debPackagePath = f"/tmp/{random.randint(0, 9999)}" - self.run_command(f"rm -rfv /tmp/{debPackagePath}") + #self.run_command(f"rm -rfv /tmp/{debPackagePath}") + print("f") + self.run_command(f"rm -rfv '{debPackagePath}'") + print("d") ############### # 创建目录 ############### @@ -857,7 +874,8 @@ fi # 写入文本文档 ################ self.label.emit("正在写入文件……") - write_txt(f"{debPackagePath}/DEBIAN/control", f'''Package: {e1_text.text()} + if debRecommend.text() == "": + write_txt(f"{debPackagePath}/DEBIAN/control", f'''Package: {e1_text.text()} Version: {e2_text.text()} Architecture: {debInformation[debArch.currentIndex()]["Architecture"]} Maintainer: {e4_text.text()} @@ -867,6 +885,19 @@ Priority: optional Multi-Arch: foreign Installed-Size: {size} Description: {e3_text.text()} +''') + else: + write_txt(f"{debPackagePath}/DEBIAN/control", f'''Package: {e1_text.text()} +Version: {e2_text.text()} +Architecture: {debInformation[debArch.currentIndex()]["Architecture"]} +Maintainer: {e4_text.text()} +Depends: {debInformation[debArch.currentIndex()]["Depends"]} +Recommends: {debRecommend.text()} +Section: non-free/otherosfs +Priority: optional +Multi-Arch: foreign +Installed-Size: {size} +Description: {e3_text.text()} ''') if debInformation[debArch.currentIndex()]["postinst"] != "": write_txt(f"{debPackagePath}/DEBIAN/postinst", debInformation[debArch.currentIndex()]["postinst"]) @@ -895,7 +926,7 @@ Description: {e3_text.text()} ################ self.label.emit("完成构建!") self.disabled_or_NORMAL_all.emit(True) - self.infoMsg.emit(widget, "提示", "打包完毕!") + self.infoMsg.emit("打包完毕!") except: traceback.print_exc() self.errorMsg.emit("程序出现错误,错误信息:\n{}".format(traceback.format_exc())) diff --git a/en_US.qph b/en_US.qph new file mode 100644 index 0000000..e1a8d34 --- /dev/null +++ b/en_US.qph @@ -0,0 +1,3 @@ + + + diff --git a/information.json b/information.json index 28a8993..1724093 100755 --- a/information.json +++ b/information.json @@ -1,5 +1,5 @@ { - "Version": "2.0.0-2", + "Version": "2.0.1", "Thank": [ "感谢 @a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301", "感谢 @zhangs https://bbs.deepin.org/post/227948", diff --git a/mainwindow.py b/mainwindow.py index e2152d3..5b30012 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -26,7 +26,8 @@ import urllib.parse as parse import PyQt5.QtGui as QtGui import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets - +# 方便一些,单独把 tr 抽出来 +from PyQt5.QtCore import QObject ################### # 程序所需事件 ################### @@ -194,7 +195,7 @@ def about_this_program()->"显示“关于这个程序”窗口": aboutInfo = QtWidgets.QTextBrowser(messageWidget) aboutInfo.setHtml(about) messageLayout.addWidget(aboutInfo, 0, 1, 1, 1) - ok = QtWidgets.QPushButton("确定") + ok = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "确定")) ok.clicked.connect(QT.message.close) messageLayout.addWidget(ok, 1, 1, 1, 1, QtCore.Qt.AlignBottom | QtCore.Qt.AlignRight) messageWidget.setLayout(messageLayout) @@ -372,7 +373,7 @@ def OpenWineFontPath(): wineBottonPath = setting["DefultBotton"] else: wineBottonPath = e1.currentText() - QtWidgets.QMessageBox.information(widget, "提示", "如果安装字体?只需要把字体文件复制到此字体目录\n按下“OK”按钮可以打开字体目录") + QtWidgets.QMessageBox.information(widget, "提示", QtCore.QCoreApplication.translate("U", "如果安装字体?只需要把字体文件复制到此字体目录\n按下“OK”按钮可以打开字体目录")) os.system("xdg-open \"" + wineBottonPath.replace("\'", "\\\'") + "/drive_c/windows/Fonts\"") class RunWineProgramThread(QtCore.QThread): @@ -696,28 +697,28 @@ class UpdateWindow(): updateWidgetLayout = QtWidgets.QGridLayout() versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:未知\n更新内容:") updateText = QtWidgets.QTextBrowser() - ok = QtWidgets.QPushButton("更新(更新过程中会关闭所有Python应用,包括这个应用)") + ok = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "更新(更新过程中会关闭所有Python应用,包括这个应用)")) ok.clicked.connect(UpdateWindow.Update) cancel = QtWidgets.QPushButton("取消") cancel.clicked.connect(UpdateWindow.update.close) try: - UpdateWindow.data = json.loads(requests.get("http://120.25.153.144/spark-deepin-wine-runner/update.json").text) + UpdateWindow.data = json.loads(requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci91cGRhdGUuanNvbg==").decode("utf-8")).text) versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:{UpdateWindow.data['Version']}\n更新内容:") if UpdateWindow.data["Version"] == version: - updateText.setText("此为最新版本,无需更新") + updateText.setText(QtCore.QCoreApplication.translate("U", "此为最新版本,无需更新")) ok.setDisabled(True) else: updateText.setText(UpdateWindow.data["New"].replace("\\n", "\n")) except: traceback.print_exc() - QtWidgets.QMessageBox.critical(updateWidget, "错误", "无法连接服务器!") + QtWidgets.QMessageBox.critical(updateWidget, QtCore.QCoreApplication.translate("U", "错误"), QtCore.QCoreApplication.translate("U", "无法连接服务器!")) updateWidgetLayout.addWidget(versionLabel, 0, 0, 1, 1) updateWidgetLayout.addWidget(updateText, 1, 0, 1, 3) updateWidgetLayout.addWidget(ok, 2, 2, 1, 1) updateWidgetLayout.addWidget(cancel, 2, 1, 1, 1) updateWidget.setLayout(updateWidgetLayout) UpdateWindow.update.setCentralWidget(updateWidget) - UpdateWindow.update.setWindowTitle("检查更新") + UpdateWindow.update.setWindowTitle(QtCore.QCoreApplication.translate("U", "检查更新")) UpdateWindow.update.resize(updateWidget.frameGeometry().width(), int(updateWidget.frameGeometry().height() * 1.5)) UpdateWindow.update.show() @@ -772,22 +773,22 @@ class GetDllFromWindowsISO: 以及不要拷贝/替换太多的 dll,否则可能会导致 wine 容器异常 最后,拷贝/替换 dll 后,建议点击下面“设置 wine 容器”按钮==》函数库 进行设置 当前选择的 Wine 容器:{GetDllFromWindowsISO.wineBottonPath}"""), 0, 0, 1, 5) - isoLabel = QtWidgets.QLabel("ISO镜像:") + isoLabel = QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "ISO镜像:")) GetDllFromWindowsISO.isoPath = QtWidgets.QComboBox() - GetDllFromWindowsISO.browser = QtWidgets.QPushButton("浏览") + GetDllFromWindowsISO.browser = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览")) isoControl = QtWidgets.QWidget() isoControlLayout = QtWidgets.QHBoxLayout() isoControl.setLayout(isoControlLayout) dllControl = QtWidgets.QWidget() dllControlLayout = QtWidgets.QHBoxLayout() dllControl.setLayout(dllControlLayout) - GetDllFromWindowsISO.mountButton = QtWidgets.QPushButton("读取/挂载ISO镜像") - umountButton = QtWidgets.QPushButton("关闭/卸载ISO镜像") + GetDllFromWindowsISO.mountButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "读取/挂载ISO镜像")) + umountButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "关闭/卸载ISO镜像")) GetDllFromWindowsISO.dllFound = QtWidgets.QComboBox() - GetDllFromWindowsISO.foundButton = QtWidgets.QPushButton("查找") + GetDllFromWindowsISO.foundButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "查找")) GetDllFromWindowsISO.dllList = QtWidgets.QListView() - GetDllFromWindowsISO.saveDll = QtWidgets.QPushButton("保存到 wine 容器中") - GetDllFromWindowsISO.setWineBotton = QtWidgets.QPushButton("设置 wine 容器") + GetDllFromWindowsISO.saveDll = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "保存到 wine 容器中")) + GetDllFromWindowsISO.setWineBotton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "设置 wine 容器")) isoLabel.setSizePolicy(size) GetDllFromWindowsISO.isoPath.setEditable(True) GetDllFromWindowsISO.isoPath.addItems(isoPath) @@ -809,7 +810,7 @@ class GetDllFromWindowsISO: widgetLayout.addWidget(GetDllFromWindowsISO.isoPath, 1, 1, 1, 1) widgetLayout.addWidget(GetDllFromWindowsISO.browser, 1, 2, 1, 1) widgetLayout.addWidget(isoControl, 2, 1, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("查找DLL\n(为空则代表不查找,\n将显示全部内容):"), 3, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "查找DLL\n(为空则代表不查找,\n将显示全部内容):")), 3, 0, 1, 1) widgetLayout.addWidget(GetDllFromWindowsISO.dllFound, 3, 1, 1, 1) widgetLayout.addWidget(GetDllFromWindowsISO.foundButton, 3, 2, 1, 1) widgetLayout.addWidget(GetDllFromWindowsISO.dllList, 4, 1, 1, 1) @@ -917,12 +918,12 @@ class GetDllFromWindowsISO: shutil.rmtree("/tmp/wine-runner-getdll") except: traceback.print_exc() - QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, "错误", f"关闭/卸载镜像失败,报错如下:\n{traceback.format_exc()}") + QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, QtCore.QCoreApplication.translate("U", "错误"), f"关闭/卸载镜像失败,报错如下:\n{traceback.format_exc()}") return GetDllFromWindowsISO.DisbledDown(True) GetDllFromWindowsISO.DisbledUp(False) GetDllFromWindowsISO.mount = False - QtWidgets.QMessageBox.information(GetDllFromWindowsISO.message, "提示", "关闭/卸载成功!") + QtWidgets.QMessageBox.information(GetDllFromWindowsISO.message, QtCore.QCoreApplication.translate("U", "提示"), QtCore.QCoreApplication.translate("U", "关闭/卸载成功!")) def CopyDll(): choose = GetDllFromWindowsISO.dllList.selectionModel().selectedIndexes()[0].data() @@ -944,23 +945,24 @@ class ProgramRunStatusShow(): return try: sha = ProgramRunStatusUpload.GetSHA1(e2.currentText()) - lists = json.loads(requests.get(f"http://120.25.153.144/spark-deepin-wine-runner/app/{sha}/all.json").text) - r = requests.get(f"http://120.25.153.144/spark-deepin-wine-runner/app/{sha}/title.txt") + lists = json.loads(requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9hcHAv").decode("utf-8") + sha + base64.b64decode("L2FsbC5qc29u").decode("utf-8")).text) + r = requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9hcHAv").decode("utf-8") + sha + base64.b64decode("L3RpdGxlLnR4dA==").decode("utf-8")) r.encoding = "utf-8" title = r.text except: - if QtWidgets.QMessageBox.question(widget, "提示", "暂时还没有该软件的运行情况信息\n是否自己上传该软件的运行情况?") == QtWidgets.QMessageBox.Yes: + if QtWidgets.QMessageBox.question(widget, QtCore.QCoreApplication.translate("U", "提示"), QtCore.QCoreApplication.translate("U", "暂时还没有该软件的运行情况信息\n是否自己上传该软件的运行情况?")) == QtWidgets.QMessageBox.Yes: ProgramRunStatusUpload.ShowWindow(sha) return - informationList = ["0分:无法运行并且也没有报错,自己无法解决", - "1分:无法运行但有报错,自己无法解决", - "2分:可以运行但是效果很差,几乎无法使用", - "3分:可以运行且勉强可以使用", - "4分:可以运行,体验大差不差,还是有点小问题", - "5分:可以运行且完全没有bug和问题,和在 Windows 上一样", - "含有不良内容,不宜安装", - "含有病毒、木马等对计算机有害的软件" - ] + informationList = [ + "0分:无法运行并且也没有报错,自己无法解决", + "1分:无法运行但有报错,自己无法解决", + "2分:可以运行但是效果很差,几乎无法使用", + "3分:可以运行且勉强可以使用", + "4分:可以运行,体验大差不差,还是有点小问题", + "5分:可以运行且完全没有bug和问题,和在 Windows 上一样", + "含有不良内容,不宜安装", + "含有病毒、木马等对计算机有害的软件" + ] if title.lower() == "null": title = "未知应用" maxHead = lists.index(max(lists)) @@ -968,9 +970,9 @@ class ProgramRunStatusShow(): msgWidget = QtWidgets.QWidget() msgWidgetLayout = QtWidgets.QGridLayout() starLayout = QtWidgets.QHBoxLayout() - uploadButton = QtWidgets.QPushButton("点此上传运行情况") + uploadButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "点此上传运行情况")) uploadButton.clicked.connect(lambda: ProgramRunStatusUpload.ShowWindow(sha, title)) - msgWidgetLayout.addWidget(QtWidgets.QLabel("综合评价:"), 0, 0) + msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "综合评价:")), 0, 0) msgWidgetLayout.addLayout(starLayout, 0, 1) msgWidgetLayout.addWidget(QtWidgets.QLabel(informationList[maxHead]), 1, 0, 1, 2) msgWidgetLayout.addWidget(uploadButton, 2, 0, 1, 2) @@ -1018,7 +1020,7 @@ class ProgramRunStatusUpload(): ProgramRunStatusUpload.programName = QtWidgets.QLineEdit() ProgramRunStatusUpload.fen = QtWidgets.QComboBox() ProgramRunStatusUpload.starLayout = QtWidgets.QHBoxLayout() - upload = QtWidgets.QPushButton("上传") + upload = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "上传")) upload.clicked.connect(ProgramRunStatusUpload.Upload) if title != "": ProgramRunStatusUpload.programName.setText(title) @@ -1028,7 +1030,7 @@ class ProgramRunStatusUpload(): ProgramRunStatusUpload.starList.append(QtWidgets.QLabel(f"")) ProgramRunStatusUpload.starLayout.addWidget(ProgramRunStatusUpload.starList[-1]) ProgramRunStatusUpload.starLayout.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) - ProgramRunStatusUpload.programName.setPlaceholderText("如果这个程序和程序名确实是合法还是检测到敏感词,改为“NULL”即可") + ProgramRunStatusUpload.programName.setPlaceholderText(QtCore.QCoreApplication.translate("U", "如果这个程序和程序名确实是合法还是检测到敏感词,改为“NULL”即可")) ProgramRunStatusUpload.fen.addItems(["0分:无法运行并且也没有报错,自己无法解决", "1分:无法运行但有报错,自己无法解决", "2分:可以运行但是效果很差,几乎无法使用", @@ -1039,15 +1041,15 @@ class ProgramRunStatusUpload(): "含有病毒、木马等对计算机有害的软件"]) ProgramRunStatusUpload.fen.setCurrentIndex(4) ProgramRunStatusUpload.fen.currentIndexChanged.connect(ProgramRunStatusUpload.ChangeStar) - msgWidgetLayout.addWidget(QtWidgets.QLabel("程序名:"), 0, 0) - msgWidgetLayout.addWidget(QtWidgets.QLabel("评分:"), 1, 0) + msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "程序名:")), 0, 0) + msgWidgetLayout.addWidget(QtCore.QCoreApplication.translate("U", QtWidgets.QLabel("评分:")), 1, 0) msgWidgetLayout.addWidget(ProgramRunStatusUpload.programName, 0, 1) msgWidgetLayout.addWidget(ProgramRunStatusUpload.fen, 1, 1) msgWidgetLayout.addLayout(ProgramRunStatusUpload.starLayout, 2, 1) msgWidgetLayout.addWidget(upload, 3, 1) msgWidget.setLayout(msgWidgetLayout) ProgramRunStatusUpload.msgWindow.setCentralWidget(msgWidget) - ProgramRunStatusUpload.msgWindow.setWindowTitle("上传程序运行情况") + ProgramRunStatusUpload.msgWindow.setWindowTitle(QtCore.QCoreApplication.translate("U", "上传程序运行情况")) ProgramRunStatusUpload.msgWindow.setWindowIcon(QtGui.QIcon(iconPath)) ProgramRunStatusUpload.msgWindow.show() @@ -1055,17 +1057,20 @@ class ProgramRunStatusUpload(): if not os.path.exists(e2.currentText()): QtWidgets.QMessageBox.critical(None, "错误", "exe 文件不存在!") return + if ProgramRunStatusUpload.programName.text() == "": + QtWidgets.QMessageBox.critical(None, "错误", "程序名称不能为空!") + return try: if ProgramRunStatusUpload.sha1Value == "": ProgramRunStatusUpload.sha1Value = ProgramRunStatusUpload.GetSHA1(e2.currentText()) - QtWidgets.QMessageBox.information(None, "提示", json.loads(requests.post("http://120.25.153.144:30250", { + QtWidgets.QMessageBox.information(None, QtCore.QCoreApplication.translate("U", "提示"), json.loads(requests.post(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0OjMwMjUw").decode("utf-8"), { "SHA1": ProgramRunStatusUpload.sha1Value, "Name": ProgramRunStatusUpload.programName.text(), "Fen": ProgramRunStatusUpload.fen.currentIndex(), "Wine": o1.currentText() }).text)["Error"]) except: - QtWidgets.QMessageBox.critical(None, "错误", "数据上传失败!") + QtWidgets.QMessageBox.critical(None, QtCore.QCoreApplication.translate("U", "错误"), QtCore.QCoreApplication.translate("U", "数据上传失败!")) def GetSHA1(filePath): sha1 = hashlib.sha1() @@ -1096,34 +1101,34 @@ class ProgramSetting(): ProgramSetting.message = QtWidgets.QMainWindow() widget = QtWidgets.QWidget() widgetLayout = QtWidgets.QGridLayout() - widgetLayout.addWidget(QtWidgets.QLabel("选择 Wine 容器版本:"), 0, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("wine DEBUG 信息输出:"), 1, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("默认 Wine:"), 2, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("默认 Wine 容器:"), 3, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("使用终端打开:"), 4, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("自定义 wine 参数:"), 5, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("程序主题:"), 6, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("Wine 默认 Mono 和 Gecko 安装器:"), 7, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("忽略未安装的 Wine:"), 8, 0, 1, 1) - widgetLayout.addWidget(QtWidgets.QLabel("下载缓存:"), 9, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "选择 Wine 容器版本:")), 0, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine DEBUG 信息输出:")), 1, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "默认 Wine:")), 2, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "默认 Wine 容器:")), 3, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "使用终端打开:")), 4, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "自定义 wine 参数:")), 5, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "程序主题:")), 6, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "Wine 默认 Mono 和 Gecko 安装器:")), 7, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "忽略未安装的 Wine:")), 8, 0, 1, 1) + widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "下载缓存:")), 9, 0, 1, 1) ProgramSetting.wineBottonA = QtWidgets.QComboBox() - ProgramSetting.wineDebug = QtWidgets.QCheckBox("开启 DEBUG 输出") + ProgramSetting.wineDebug = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "开启 DEBUG 输出")) ProgramSetting.defultWine = QtWidgets.QComboBox() ProgramSetting.defultBotton = QtWidgets.QLineEdit() ProgramSetting.theme = QtWidgets.QComboBox() ProgramSetting.theme.addItems(QtWidgets.QStyleFactory.keys()) ProgramSetting.theme.setCurrentText(setting["Theme"]) - save = QtWidgets.QPushButton("保存") + save = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "保存")) save.clicked.connect(ProgramSetting.Save) - defultBottonButton = QtWidgets.QPushButton("浏览") + defultBottonButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览")) defultBottonButton.clicked.connect(ProgramSetting.Browser) - themeTry = QtWidgets.QPushButton("测试(重启后变回设置的主题)") + themeTry = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "测试(重启后变回设置的主题)")) themeTry.clicked.connect(ProgramSetting.Try) - ProgramSetting.terminalOpen = QtWidgets.QCheckBox("使用终端打开(deepin 终端)") + ProgramSetting.terminalOpen = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "使用终端打开(deepin 终端)")) ProgramSetting.wineOption = QtWidgets.QLineEdit() - ProgramSetting.monogeckoInstaller = QtWidgets.QCheckBox("屏蔽 Wine 默认 Mono 和 Gecko 安装器") - ProgramSetting.autoWine = QtWidgets.QCheckBox("不显示未检测到的 Wine") - ProgramSetting.runtimeCache = QtWidgets.QCheckBox("开启下载缓存") + ProgramSetting.monogeckoInstaller = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "屏蔽 Wine 默认 Mono 和 Gecko 安装器")) + ProgramSetting.autoWine = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "不显示未检测到的 Wine")) + ProgramSetting.runtimeCache = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "开启下载缓存")) ProgramSetting.wineBottonA.addItems(["Auto", "win32", "win64"]) ProgramSetting.wineBottonA.setCurrentText(setting["Architecture"]) ProgramSetting.wineDebug.setChecked(setting["Debug"]) @@ -1155,7 +1160,7 @@ class ProgramSetting(): ProgramSetting.message.show() def Browser(): - path = QtWidgets.QFileDialog.getExistingDirectory(ProgramSetting.message, "选择 Wine 容器", json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"]) + path = QtWidgets.QFileDialog.getExistingDirectory(ProgramSetting.message, QtCore.QCoreApplication.translate("U", "选择 Wine 容器"), json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBotton.json"))["path"]) if path == "" or path == None or path == "()" or path == (): return ProgramSetting.defultBotton.setText(path) @@ -1329,11 +1334,16 @@ exe路径\' 参数 \' 千万不要中断后不删除源的情况下 apt upgrade !!!中断后只需重新打开脚本输入 repair 或者随意安装一个 Wine(会自动执行恢复操作)即可 以及此脚本安装的 Wine 无法保证 100% 能使用,以及副作用是会提示 N: 鉴于仓库 'https://community-packages.deepin.com/beige beige InRelease' 不支持 'i386' 体系结构,跳过配置文件 'main/binary-i386/Packages' 的获取。''' -updateThingsString = ''' +updateThingsString = '''※1、新增新的 Wine 安装器,并支持将安装的 Wine 打包到 Wine 程序 deb 包中 +※2、Wine 打包器打包 Windows 应用支持将 Wine 打包入 deb 内,可以不依赖 Wine(一般不推荐把 Wine 打包入内,推荐用依赖的形式),并支持设置自定义依赖和生成模板 +3、修改错别字(图形话=>图形化) +3、修复评分功能名称为空也可以上传评分的问题 +4、去除 toilet 依赖,使在 Deepin 23 Preview 上运行更佳 +5、支持删除所有由 Wine 创建的启动器快捷方式 ''' for i in information["Thank"]: thankText += f"{i}\n" -updateTime = "2022年08月17日" +updateTime = "2022年08月22日" about = f'''

关于

一个能让Linux用户更加方便运行Windows应用的程序,内置了对wine图形化的支持和各种Wine工具和自制Wine程序打包器、运行库安装工具等等

同时也内置了基于VirtualBox制作的小白Windows虚拟机安装工具,可以做到只需要用户下载系统镜像并点击安装即可,无需顾及虚拟机安装、创建、虚拟机的分区等等

@@ -1375,6 +1385,10 @@ except: # 读取主题 # Qt 窗口 app = QtWidgets.QApplication(sys.argv) +# 语言载入 +trans = QtCore.QTranslator() +trans.load(f"{programPath}/LANG/deepin-wine-runner-en_US.qm") +app.installTranslator(trans) window = QtWidgets.QMainWindow() widget = QtWidgets.QWidget() window.setCentralWidget(widget) @@ -1390,25 +1404,25 @@ leftUp = QtWidgets.QWidget() mainLayout.addWidget(leftUp, 0, 0, 1, 1) leftUpLayout = QtWidgets.QGridLayout() leftUp.setLayout(leftUpLayout) -fastLabel = QtWidgets.QLabel("快速启动") +fastLabel = QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "快速启动")) fastLabel.setStyleSheet("font: 30px;") leftUpLayout.addWidget(fastLabel, 0, 0, 1, 2) leftUpLayout.addWidget(QtWidgets.QLabel("
"), 1, 0, 1, 2) -leftUpLayout.addWidget(QtWidgets.QLabel("请选择容器路径:"), 2, 0, 1, 1) +leftUpLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "请选择容器路径:")), 2, 0, 1, 1) e1 = QtWidgets.QComboBox() e1.setEditable(True) leftUpLayout.addWidget(e1, 3, 0, 1, 1) button1 = QtWidgets.QPushButton("浏览") button1.clicked.connect(liulanbutton) leftUpLayout.addWidget(button1, 3, 1, 1, 1) -leftUpLayout.addWidget(QtWidgets.QLabel("请选择要执行的程序:"), 4, 0, 1, 1) +leftUpLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "请选择要执行的程序:")), 4, 0, 1, 1) e2 = QtWidgets.QComboBox() e2.setEditable(True) leftUpLayout.addWidget(e2, 5, 0, 1, 1) -button2 = QtWidgets.QPushButton("浏览") +button2 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览")) button2.clicked.connect(liulanexebutton) leftUpLayout.addWidget(button2, 5, 1, 1, 1) -leftUpLayout.addWidget(QtWidgets.QLabel("请选择WINE版本:"), 6, 0, 1, 1) +leftUpLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "请选择WINE版本:")), 6, 0, 1, 1) o1 = QtWidgets.QComboBox() leftUpLayout.addWidget(o1, 7, 0, 1, 1) # 设置空间权重 @@ -1420,58 +1434,58 @@ leftDown = QtWidgets.QWidget() mainLayout.addWidget(leftDown, 1, 0, 1, 1) leftDownLayout = QtWidgets.QVBoxLayout() leftDown.setLayout(leftDownLayout) -highLabel = QtWidgets.QLabel("高级功能") +highLabel = QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "高级功能")) highLabel.setStyleSheet("font: 30px;") leftDownLayout.addWidget(highLabel) leftDownLayout.addWidget(QtWidgets.QLabel("
")) -leftDownLayout.addWidget(QtWidgets.QLabel("创建快捷方式(Desktop文件):")) +leftDownLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "创建快捷方式(Desktop文件):"))) createDesktopLink = QtWidgets.QHBoxLayout() -label_r_2 = QtWidgets.QLabel("名称:") +label_r_2 = QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "名称:")) createDesktopLink.addWidget(label_r_2) combobox1 = QtWidgets.QComboBox() combobox1.setEditable(True) createDesktopLink.addWidget(combobox1) -button5 = QtWidgets.QPushButton("创建到桌面") +button5 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "创建到桌面")) button5.clicked.connect(make_desktop_on_desktop) createDesktopLink.addWidget(button5) -saveDesktopFileOnLauncher = QtWidgets.QPushButton("创建到开始菜单") +saveDesktopFileOnLauncher = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "创建到开始菜单")) saveDesktopFileOnLauncher.clicked.connect(make_desktop_on_launcher) createDesktopLink.addWidget(saveDesktopFileOnLauncher) leftDownLayout.addLayout(createDesktopLink) programManager = QtWidgets.QGridLayout() leftDownLayout.addLayout(programManager) -programManager.addWidget(QtWidgets.QLabel("程序管理:"), 0, 0, 1, 1) -getProgramIcon = QtWidgets.QPushButton("提取图标") +programManager.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "程序管理:")), 0, 0, 1, 1) +getProgramIcon = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "提取图标")) getProgramIcon.clicked.connect(lambda: RunWineProgram(f"{programPath}/BeCyIconGrabber.exe' 'z:/{e2.currentText()}")) programManager.addWidget(getProgramIcon, 1, 0, 1, 1) programManager.addWidget(QtWidgets.QLabel(" "*5), 1, 1, 1, 1) -trasButton = QtWidgets.QPushButton("窗口透明工具") +trasButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "窗口透明工具")) trasButton.clicked.connect(lambda: RunWineProgram(f"{programPath}/窗体透明度设置工具.exe")) programManager.addWidget(trasButton, 1, 2, 1, 1) -uninstallProgram = QtWidgets.QPushButton("卸载程序") +uninstallProgram = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "卸载程序")) uninstallProgram.clicked.connect(lambda: RunWineProgram(f"{programPath}/geek.exe")) programManager.addWidget(QtWidgets.QLabel(" "*5), 1, 3, 1, 1) programManager.addWidget(uninstallProgram, 1, 4, 1, 1) -miniAppStore = QtWidgets.QPushButton("微型应用商店") +miniAppStore = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "微型应用商店")) miniAppStore.clicked.connect(lambda: threading.Thread(target=MiniAppStore).start()) programManager.addWidget(QtWidgets.QLabel(" "*5), 1, 5, 1, 1) programManager.addWidget(miniAppStore, 1, 6, 1, 1) programManager.addWidget(QtWidgets.QLabel(" "*5), 1, 7, 1, 1) -getProgramStatus = QtWidgets.QPushButton("获取该程序运行情况") +getProgramStatus = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "获取该程序运行情况")) getProgramStatus.clicked.connect(ProgramRunStatusShow.ShowWindow) programManager.addWidget(getProgramStatus, 1, 8, 1, 1) programManager.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum), 1, 9, 1, 1) -programManager.addWidget(QtWidgets.QLabel("WINE配置:"), 2, 0, 1, 1) -wineConfig = QtWidgets.QPushButton("配置容器") +programManager.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "WINE配置:")), 2, 0, 1, 1) +wineConfig = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "配置容器")) wineConfig.clicked.connect(lambda: RunWineProgram("winecfg")) programManager.addWidget(wineConfig, 3, 0, 1, 1) -fontAppStore = QtWidgets.QPushButton("字体商店") +fontAppStore = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "字体商店")) fontAppStore.clicked.connect(FontAppStore) programManager.addWidget(fontAppStore, 3, 2, 1, 1) -button_r_6 = QtWidgets.QPushButton("安装自定义字体") +button_r_6 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "安装自定义字体")) button_r_6.clicked.connect(OpenWineFontPath) programManager.addWidget(button_r_6, 3, 4, 1, 1) -sparkWineSetting = QtWidgets.QPushButton("星火wine配置") +sparkWineSetting = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "星火wine配置")) sparkWineSetting.clicked.connect(lambda: threading.Thread(target=os.system, args=["/opt/durapps/spark-dwine-helper/spark-dwine-helper-settings/settings.sh"]).start()) programManager.addWidget(sparkWineSetting, 3, 6, 1, 1) # 权重 @@ -1488,7 +1502,7 @@ returnText.setStyleSheet(""" background-color: black; color: white; """) -returnText.setText("在此可以看到wine安装应用时的终端输出内容") +returnText.setText(QtCore.QCoreApplication.translate("U", "在此可以看到wine安装应用时的终端输出内容")) mainLayout.setRowStretch(0, 2) mainLayout.setRowStretch(1, 1) mainLayout.setColumnStretch(0, 2) @@ -1496,7 +1510,7 @@ mainLayout.setColumnStretch(1, 1) mainLayout.addWidget(returnText, 0, 1, 2, 1) # 版权 -copy = QtWidgets.QLabel(f"""\n程序版本:{version} +copy = QtWidgets.QLabel(f"""\n程序版本:{version},提示:Wine 无法运行所有的 Windows 程序,如果想要运行更多可执行程序,可以考虑虚拟机和双系统
©2020~{time.strftime("%Y")} gfdgd xi、为什么您不喜欢熊出没和阿布呢""") mainLayout.addWidget(copy, 2, 0, 1, 1) @@ -1505,26 +1519,26 @@ programRun = QtWidgets.QWidget() programRunLayout = QtWidgets.QHBoxLayout() programRun.setLayout(programRunLayout) programRunLayout.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) -button3 = QtWidgets.QPushButton("运行程序") +button3 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "运行程序")) button3.clicked.connect(runexebutton) programRunLayout.addWidget(button3) -killProgram = QtWidgets.QPushButton("终止程序") +killProgram = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "终止程序")) killProgram.clicked.connect(KillProgram) programRunLayout.addWidget(killProgram) mainLayout.addWidget(programRun, 2, 1, 1, 1) # 菜单栏 menu = window.menuBar() -programmenu = menu.addMenu("程序(&P)") -p1 = QtWidgets.QAction("安装 wine(&I)") -installWineOnDeepin23 = QtWidgets.QAction("安装 wine(只限Deepin23)") -installWineHQ = QtWidgets.QAction("安装 WineHQ") -installMoreWine = QtWidgets.QAction("安装更多 Wine") -p2 = QtWidgets.QAction("设置程序(&S)") -p3 = QtWidgets.QAction("清空软件历史记录(&C)") -cleanCache = QtWidgets.QAction("清空软件缓存") -cleanProgramUnuse = QtWidgets.QAction("删除程序组件") -p4 = QtWidgets.QAction("退出程序(&E)") +programmenu = menu.addMenu(QtCore.QCoreApplication.translate("U", "程序(&P)")) +p1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装 wine(&I)")) +installWineOnDeepin23 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装 wine(只限Deepin23)")) +installWineHQ = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装 WineHQ")) +installMoreWine = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装更多 Wine")) +p2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "设置程序(&S)")) +p3 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "清空软件历史记录(&C)")) +cleanCache = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "清空软件缓存")) +cleanProgramUnuse = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除程序组件")) +p4 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "退出程序(&E)")) programmenu.addAction(p1) programmenu.addAction(installWineOnDeepin23) programmenu.addAction(installWineHQ) @@ -1547,17 +1561,17 @@ cleanCache.triggered.connect(CleanProgramCache) cleanProgramUnuse.triggered.connect(CleanProgram) p4.triggered.connect(window.close) -wineOption = menu.addMenu("Wine(&W)") -w1 = QtWidgets.QAction("打开 Wine 容器目录") -w2 = QtWidgets.QAction("安装常见字体") -w3 = QtWidgets.QAction("安装自定义字体") -w4 = QtWidgets.QAction("删除选择的 Wine 容器") -cleanBottonUOS = QtWidgets.QAction("清理 Wine 容器(基于 Wine 适配活动脚本)") -w5 = QtWidgets.QAction("打包 wine 应用") -w6 = QtWidgets.QAction("使用官方 Wine 适配活动的脚本进行打包") -w7 = QtWidgets.QAction("从镜像获取DLL(只支持Windows XP、Windows Server 2003官方安装镜像)") -updateGeek = QtWidgets.QAction("从 Geek Uninstaller 官网升级程序") -deleteDesktopIcon = QtWidgets.QAction("删除所有 Wine 程序在启动器的快捷方式") +wineOption = menu.addMenu(QtCore.QCoreApplication.translate("U", "Wine(&W)")) +w1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "打开 Wine 容器目录")) +w2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装常见字体")) +w3 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装自定义字体")) +w4 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除选择的 Wine 容器")) +cleanBottonUOS = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "清理 Wine 容器(基于 Wine 适配活动脚本)")) +w5 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "打包 wine 应用")) +w6 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用官方 Wine 适配活动的脚本进行打包")) +w7 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从镜像获取DLL(只支持Windows XP、Windows Server 2003官方安装镜像)")) +updateGeek = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从 Geek Uninstaller 官网升级程序")) +deleteDesktopIcon = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "删除所有 Wine 程序在启动器的快捷方式")) wineOption.addAction(w1) wineOption.addAction(w2) wineOption.addAction(w3) @@ -1571,26 +1585,26 @@ wineOption.addAction(w7) wineOption.addSeparator() wineOption.addAction(updateGeek) wineOption.addSeparator() -wm1 = wineOption.addMenu("在指定 Wine、容器安装组件") -wm1_1 = QtWidgets.QAction("在指定wine、指定容器安装 .net framework") -wm1_2 = QtWidgets.QAction("在指定wine、指定容器安装 Visual Studio C++") -wm1_3 = QtWidgets.QAction("在指定wine、指定容器安装 MSXML") -wm1_4 = QtWidgets.QAction("在指定wine、指定容器安装 gecko") -wm1_5 = QtWidgets.QAction("在指定wine、指定容器安装 mono") -wm1_6 = QtWidgets.QAction("在指定wine、指定容器安装其它运行库") +wm1 = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "在指定 Wine、容器安装组件")) +wm1_1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "在指定wine、指定容器安装 .net framework")) +wm1_2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "在指定wine、指定容器安装 Visual Studio C++")) +wm1_3 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "在指定wine、指定容器安装 MSXML")) +wm1_4 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "在指定wine、指定容器安装 gecko")) +wm1_5 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "在指定wine、指定容器安装 mono")) +wm1_6 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "在指定wine、指定容器安装其它运行库")) wm1.addAction(wm1_1) wm1.addAction(wm1_2) wm1.addAction(wm1_3) wm1.addAction(wm1_4) wm1.addAction(wm1_5) wm1.addAction(wm1_6) -wm2 = wineOption.addMenu("在指定 Wine、容器运行基础应用") -wm2_1 = QtWidgets.QAction("打开指定wine、指定容器的控制面板") -wm2_2 = QtWidgets.QAction("打开指定wine、指定容器的浏览器") -wm2_3 = QtWidgets.QAction("打开指定wine、指定容器的注册表") -wm2_4 = QtWidgets.QAction("打开指定wine、指定容器的任务管理器") -wm2_5 = QtWidgets.QAction("打开指定wine、指定容器的资源管理器") -wm2_6 = QtWidgets.QAction("打开指定wine、指定容器的关于 wine") +wm2 = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "在指定 Wine、容器运行基础应用")) +wm2_1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "打开指定wine、指定容器的控制面板")) +wm2_2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "打开指定wine、指定容器的浏览器")) +wm2_3 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "打开指定wine、指定容器的注册表")) +wm2_4 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "打开指定wine、指定容器的任务管理器")) +wm2_5 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "打开指定wine、指定容器的资源管理器")) +wm2_6 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "打开指定wine、指定容器的关于 wine")) wm2.addAction(wm2_1) wm2.addAction(wm2_2) wm2.addAction(wm2_3) @@ -1598,29 +1612,29 @@ wm2.addAction(wm2_4) wm2.addAction(wm2_5) wm2.addAction(wm2_6) wineOption.addSeparator() -w8 = QtWidgets.QAction("设置 run_v3.sh 的文管为 Deepin 默认文管") -w9 = QtWidgets.QAction("设置 run_v3.sh 的文管为 Wine 默认文管") -w10 = QtWidgets.QAction("重新安装 deepin-wine-helper") -w11 = QtWidgets.QAction("使用winetricks打开指定容器") +w8 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "设置 run_v3.sh 的文管为 Deepin 默认文管")) +w9 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "设置 run_v3.sh 的文管为 Wine 默认文管")) +w10 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "重新安装 deepin-wine-helper")) +w11 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用winetricks打开指定容器")) wineOption.addAction(w8) wineOption.addAction(w9) wineOption.addAction(w10) wineOption.addSeparator() wineOption.addAction(w11) wineOption.addSeparator() -wm3 = wineOption.addMenu("启用/禁用 opengl") -wm3_1 = QtWidgets.QAction("开启 opengl") -wm3_2 = QtWidgets.QAction("禁用 opengl") +wm3 = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "启用/禁用 opengl")) +wm3_1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "开启 opengl")) +wm3_2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "禁用 opengl")) wm3.addAction(wm3_1) wm3.addAction(wm3_2) -wm4 = wineOption.addMenu("安装/卸载 winbind") -wm4_1 = QtWidgets.QAction("安装 winbind") -wm4_2 = QtWidgets.QAction("卸载 winbind") +wm4 = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "安装/卸载 winbind")) +wm4_1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装 winbind")) +wm4_2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "卸载 winbind")) wm4.addAction(wm4_1) wm4.addAction(wm4_2) -dxvkMenu = wineOption.addMenu("安装/卸载 DXVK") -installDxvk = QtWidgets.QAction("安装 DXVK") -uninstallDxvk = QtWidgets.QAction("卸载 DXVK") +dxvkMenu = wineOption.addMenu(QtCore.QCoreApplication.translate("U", "安装/卸载 DXVK")) +installDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "安装 DXVK")) +uninstallDxvk = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "卸载 DXVK")) dxvkMenu.addAction(installDxvk) dxvkMenu.addAction(uninstallDxvk) wineOption.addSeparator() @@ -1658,15 +1672,15 @@ installDxvk.triggered.connect(InstallDXVK) uninstallDxvk.triggered.connect(UninstallDXVK) deleteDesktopIcon.triggered.connect(DeleteDesktopIcon) -virtualMachine = menu.addMenu("虚拟机(&V)") -v1 = QtWidgets.QAction("使用 Virtualbox 虚拟机运行 Windows 应用") +virtualMachine = menu.addMenu(QtCore.QCoreApplication.translate("U", "虚拟机(&V)")) +v1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用 Virtualbox 虚拟机运行 Windows 应用")) virtualMachine.addAction(v1) v1.triggered.connect(RunVM) -safeWebsize = menu.addMenu("云沙箱(&C)") -s1 = QtWidgets.QAction("360 沙箱云") -s2 = QtWidgets.QAction("微步云沙箱") -s3 = QtWidgets.QAction("VIRUSTOTAL") +safeWebsize = menu.addMenu(QtCore.QCoreApplication.translate("U", "云沙箱(&C)")) +s1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "360 沙箱云")) +s2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "微步云沙箱")) +s3 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "VIRUSTOTAL")) safeWebsize.addAction(s1) safeWebsize.addAction(s2) safeWebsize.addAction(s3) @@ -1674,15 +1688,15 @@ s1.triggered.connect(lambda: webbrowser.open_new_tab("https://ata.360.net/")) s2.triggered.connect(lambda: webbrowser.open_new_tab("https://s.threatbook.cn/")) s3.triggered.connect(lambda: webbrowser.open_new_tab("https://www.virustotal.com/")) -help = menu.addMenu("帮助(&H)") -h1 = QtWidgets.QAction("程序官网") -h2 = QtWidgets.QAction("小提示") -h3 = QtWidgets.QAction("更新内容") -h4 = QtWidgets.QAction("谢明名单") -h5 = QtWidgets.QAction("更新这个程序") -h6 = QtWidgets.QAction("反馈这个程序的建议和问题") -h7 = QtWidgets.QAction("关于这个程序") -h8 = QtWidgets.QAction("关于 Qt") +help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助(&H)")) +h1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "程序官网")) +h2 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "小提示")) +h3 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "更新内容")) +h4 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "谢明名单")) +h5 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "更新这个程序")) +h6 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "反馈这个程序的建议和问题")) +h7 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "关于这个程序")) +h8 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "关于 Qt")) help.addAction(h1) help.addSeparator() help.addAction(h2) @@ -1694,8 +1708,8 @@ help.addAction(h6) help.addAction(h7) help.addAction(h8) help.addSeparator() -hm1 = help.addMenu("更多生态适配应用") -hm1_1 = QtWidgets.QAction("运行 Android 应用:UEngine 运行器") +hm1 = help.addMenu(QtCore.QCoreApplication.translate("U", "更多生态适配应用")) +hm1_1 = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "运行 Android 应用:UEngine 运行器")) hm1.addAction(hm1_1) h1.triggered.connect(OpenProgramURL) h2.triggered.connect(helps) diff --git a/package-script/information.json b/package-script/information.json index 8eb5182..b99f081 100755 --- a/package-script/information.json +++ b/package-script/information.json @@ -1,3 +1,3 @@ { - "Version": "2.0.0-2" + "Version": "2.0.1" } diff --git a/wine/installwine b/wine/installwine old mode 100755 new mode 100644 index d7322c1..578af4e Binary files a/wine/installwine and b/wine/installwine differ diff --git a/wine/installwine.out b/wine/installwine.out new file mode 100755 index 0000000..d7322c1 Binary files /dev/null and b/wine/installwine.out differ diff --git a/wine/installwine.py b/wine/installwine.py deleted file mode 100644 index 8342efb..0000000 --- a/wine/installwine.py +++ /dev/null @@ -1,18 +0,0 @@ -# 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写 -import sys -import PyQt5.QtWidgets as QtWidgets - -import mainwindowui - -# 继承至界面文件的主窗口类 -class MyMainWindow(mainwindowui.Ui_MainWindow): - def __init__(self, parent=None): - #pass - super(MyMainWindow, self).__init__(parent) - #self.setupUi(self) - -if __name__ == "__main__": - app = QtWidgets.QApplication(sys.argv) - window = MyMainWindow() - window.show() - app.exec_() \ No newline at end of file diff --git a/wine/mainwindowui.py b/wine/mainwindowui.py deleted file mode 100644 index 5f41903..0000000 --- a/wine/mainwindowui.py +++ /dev/null @@ -1,258 +0,0 @@ -import os -import sys -import json -import requests -from PyQt5 import QtCore, QtGui, QtWidgets - -class Ui_MainWindow(object): - def setupUi(self, MainWindow): - MainWindow.setObjectName("MainWindow") - MainWindow.resize(693, 404) - self.centralWidget = QtWidgets.QWidget(MainWindow) - self.centralWidget.setObjectName("centralWidget") - self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralWidget) - self.verticalLayout_2.setContentsMargins(11, 11, 11, 11) - self.verticalLayout_2.setSpacing(6) - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setSpacing(6) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.localWineList = QtWidgets.QListView(self.centralWidget) - self.localWineList.setObjectName("localWineList") - self.horizontalLayout_2.addWidget(self.localWineList) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setSpacing(6) - self.verticalLayout.setObjectName("verticalLayout") - spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem) - self.addButton = QtWidgets.QPushButton(self.centralWidget) - self.addButton.setObjectName("addButton") - self.verticalLayout.addWidget(self.addButton) - self.delButton = QtWidgets.QPushButton(self.centralWidget) - self.delButton.setObjectName("delButton") - self.verticalLayout.addWidget(self.delButton) - spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem1) - self.horizontalLayout_2.addLayout(self.verticalLayout) - self.internetWineList = QtWidgets.QListView(self.centralWidget) - self.internetWineList.setObjectName("internetWineList") - self.horizontalLayout_2.addWidget(self.internetWineList) - self.verticalLayout_2.addLayout(self.horizontalLayout_2) - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setSpacing(6) - self.horizontalLayout.setObjectName("horizontalLayout") - self.unzip = QtWidgets.QCheckBox(self.centralWidget) - self.unzip.setObjectName("unzip") - self.horizontalLayout.addWidget(self.unzip) - self.deleteZip = QtWidgets.QCheckBox(self.centralWidget) - self.deleteZip.setChecked(True) - self.deleteZip.setTristate(False) - self.deleteZip.setObjectName("deleteZip") - self.horizontalLayout.addWidget(self.deleteZip) - spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem2) - self.verticalLayout_2.addLayout(self.horizontalLayout) - MainWindow.setCentralWidget(self.centralWidget) - - self.retranslateUi(MainWindow) - QtCore.QMetaObject.connectSlotsByName(MainWindow) - - def retranslateUi(self, MainWindow): - _translate = QtCore.QCoreApplication.translate - MainWindow.setWindowTitle(_translate("MainWindow", "下载 Wine")) - self.addButton.setText(_translate("MainWindow", "<<")) - self.delButton.setText(_translate("MainWindow", ">>")) - self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件")) - self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)")) - -def ReadLocalInformation(): - global localJsonList - file = open(f"{programPath}/winelist.json", "r") - localJsonList = json.loads(file.read()) - nmodel = QtGui.QStandardItemModel(window) - for i in localJsonList: - item = QtGui.QStandardItem(i) - nmodel.appendRow(item) - ui.localWineList.setModel(nmodel) - file.close() - -def ReadInternetInformation(): - global internetJsonList - # C++ 版本是用 curl 的,考虑到 Python 用 requests 反而方便,于是不用 curl - internetJsonList = json.loads(requests.get(f"{internetWineSource}/information.json").text) - nmodel = QtGui.QStandardItemModel(window) - for i in internetJsonList: - item = QtGui.QStandardItem(i[0]) - nmodel.appendRow(item) - ui.internetWineList.setModel(nmodel) - -class DownloadThread(QtCore.QThread): - MessageBoxInfo = QtCore.pyqtSignal(str) - MessageBoxError = QtCore.pyqtSignal(str) - ChangeDialog = QtCore.pyqtSignal(QtWidgets.QProgressDialog, int, int, int) - Finish = QtCore.pyqtSignal() - def __init__(self, progressDialog: QtWidgets.QProgressDialog, - url: str, savePath: str, fileName: str, view: QtWidgets.QListView, deleteZip: bool, - unzip: bool, localList) -> None: - self.dialog = progressDialog - self.fileUrl = url - self.fileSavePath = savePath - self.fileSaveName = fileName - self.localView = view - self.downloadDeleteZip = deleteZip - self.downloadUnzip = unzip - self.localJsonList = localList - super().__init__() - - def ReadLocalInformation(self): - file = open(f"{programPath}/winelist.json", "r"); - nmodel = QtGui.QStandardItemModel() - localJsonList = json.loads(file.read()) - for i in localJsonList: - nmodel.appendRow(QtGui.QStandardItem(i)) - self.localView.setModel(nmodel) - file.close() - - def run(self): - # 创建文件夹 - dir = QtCore.QDir() - savePath = f"{programPath}/{self.fileSaveName}" - # 文件下载 - timeout = 0 - f = requests.get(self.fileUrl, stream=True) - allSize = int(f.headers["content-length"]) # 文件总大小 - bytesRead = 0 - with open(savePath, "wb") as filePart: - for chunk in f.iter_content(chunk_size=1024): - if chunk: - #progressbar.update(int(part / show)) - filePart.write(chunk) - bytesRead += 1024 - self.ChangeDialog.emit(self.dialog, bytesRead / allSize * 100, bytesRead / 1024 / 1024, allSize / 1024 / 1024) - # 写入配置文件 - rfile = open(f"{programPath}/winelist.json", "r") - list = json.loads(rfile.read()) - rfile.close() - # C++ 版注释:不直接用 readwrite 是因为不能覆盖写入 - file = open(f"{programPath}/winelist.json", "w") - list.append(self.fileSaveName.replace(".7z", "")) - file.write(json.dumps(list)) - file.close() - # 读取配置文件 - self.ReadLocalInformation() - self.localJsonList = list - # 解压文件 - shellCommand = "" - if self.downloadUnzip: - path = f"{programPath}/{self.fileSaveName.replace('.7z', '')}" - shellCommand += f"""mkdir -p \"{path}\" -7z x \"{savePath}\" -o\"{path}\" -""" - if self.downloadDeleteZip: - shellCommand += f"rm -rf \"{savePath}\"\n" - shellFile = open("/tmp/depein-wine-runner-wine-install.sh", "w") - shellFile.write(shellCommand) - shellFile.close() - process = QtCore.QProcess() - command = ["deepin-terminal", "-e", "bash", "/tmp/depein-wine-runner-wine-install.sh"] - process.start(f"{programPath}/../launch.sh", command) - process.waitForFinished() - self.Finish.emit() - - -def MessageBoxInfo(info): - QtWidgets.QMessageBox.information(window, "提示", info) - -def MessageBoxError(info): - QtWidgets.QMessageBox.critical(window, "错误", info) - -def ChangeDialog(dialog: QtWidgets.QProgressDialog, value, downloadBytes, totalBytes): - dialog.setValue(value) - dialog.setLabelText(f"{downloadBytes}MB/{totalBytes}MB") - -def DownloadFinish(): - ui.centralWidget.setEnabled(True) - -class QT: - thread = None - -def on_addButton_clicked(): - choose = ui.internetWineList.currentIndex().row() - if choose < 0: - QtWidgets.QMessageBox.information(window, "提示", "您未选中任何项,无法继续") - return - downloadName = internetJsonList[choose][1] - ReadLocalInformation() - for i in localJsonList: - if i == internetJsonList[choose][0]: - QtWidgets.QMessageBox.information(window, "提示", "您已经安装了这个Wine了!无需重复安装!") - return - if(ui.deleteZip.isChecked() + ui.unzip.isChecked() == 2): - ui.deleteZip.setChecked(False) - ui.unzip.setChecked(False) - downloadUrl = internetWineSource + downloadName - dialog = QtWidgets.QProgressDialog() - cancel = QtWidgets.QPushButton("取消") - cancel.setDisabled(True) - dialog.setWindowIcon(QtGui.QIcon(f"{programPath}/../deepin-wine-runner.svg")) - dialog.setCancelButton(cancel) - dialog.setWindowTitle(f"正在下载“{internetJsonList[choose][0]}”") - QT.thread = DownloadThread( - dialog, - downloadUrl, - "", - internetJsonList[choose][1], - ui.localWineList, - ui.deleteZip.isChecked(), - not ui.unzip.isChecked(), - localJsonList - ) - QT.thread.MessageBoxInfo.connect(MessageBoxInfo) - QT.thread.MessageBoxError.connect(MessageBoxError) - QT.thread.ChangeDialog.connect(ChangeDialog) - QT.thread.Finish.connect(DownloadFinish) - ui.centralWidget.setDisabled(True) - QT.thread.start() - -def on_delButton_clicked(): - if QtWidgets.QMessageBox.question(window, "提示", "你确定要删除吗?") == QtWidgets.QMessageBox.No: - return - if ui.localWineList.currentIndex().row() < 0: - QtWidgets.QMessageBox.information(window, "提示", "您未选择任何项") - return - name = f"{programPath}/{localJsonList[ui.localWineList.currentIndex().row()]}" - dir = QtCore.QDir(name) - dir.removeRecursively() - QtCore.QFile.remove(name + ".7z") - del localJsonList[ui.localWineList.currentIndex().row()] - file = open(f"{programPath}/winelist.json", "w") - file.write(json.dumps(localJsonList)) - file.close() - ReadLocalInformation() - QtWidgets.QMessageBox.information(window, "提示", "删除成功!") - -if __name__ == "__main__": - localJsonList = [] - internetJsonList = [] - internetWineSource = "https://code.gitlink.org.cn/gfdgd_xi/wine-mirrors/raw/branch/master/" - programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string - app = QtWidgets.QApplication(sys.argv) - # 窗口构建 - window = QtWidgets.QMainWindow() - ui = Ui_MainWindow() - ui.setupUi(window) - window.show() - # 连接信号 - ui.addButton.clicked.connect(on_addButton_clicked) - ui.delButton.clicked.connect(on_delButton_clicked) - ## 加载内容 - # 设置列表双击不会编辑 - ui.localWineList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) - ui.internetWineList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) - # 读取信息 - ReadLocalInformation() - ReadInternetInformation() - # 图标 - ui.centralWidget.setWindowIcon(QtGui.QIcon(f"{programPath}/../deepin-wine-runner.svg")) - - app.exec_() \ No newline at end of file