mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-05-28 02:39:53 +08:00
优化移除容器
This commit is contained in:
parent
c8ccc1dff5
commit
66963e6f26
QemuDownload.pyQemuRun.py
deb/opt/apps/deepin-wine-runner
mainwindow.pypackage-script.zip@ -334,6 +334,9 @@ def on_addButton_clicked():
|
||||
QT.thread.start()
|
||||
|
||||
def on_delButton_clicked():
|
||||
if os.path.exists("/tmp/deepin-wine-runner-qemu-lock"):
|
||||
if QtWidgets.QMessageBox.question(window, "提示", "检测到您的电脑已经运行了 Qemu/Chroot 容器,建议您重启电脑后再删除该容器,否则容易造成数据损失!\n是否取消操作?") == QtWidgets.QMessageBox.Yes:
|
||||
return
|
||||
if QtWidgets.QMessageBox.question(window, "提示", "你确定要删除吗?") == QtWidgets.QMessageBox.No:
|
||||
return
|
||||
if ui.localWineList.currentIndex().row() < 0:
|
||||
|
@ -33,7 +33,7 @@ if __name__ == "__main__":
|
||||
continue
|
||||
if os.path.ismount(f"{bottlePath}/dev"):
|
||||
os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash '{programPath}/UnMount.sh' '{bottlePath}' ")
|
||||
|
||||
os.system("touch /tmp/deepin-wine-runner-qemu-lock")
|
||||
# 判断是否挂载
|
||||
if not os.path.ismount(f"{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/dev"):
|
||||
print("文件暂未挂载,开始挂载")
|
||||
|
3
deb/opt/apps/deepin-wine-runner/ChangePassword.sh
Normal file
3
deb/opt/apps/deepin-wine-runner/ChangePassword.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
echo -e "123456\n123456\n\n\n\n\n\n\n\n\n" | adduser "$1"
|
||||
echo -e "123456\n123456\n" | passwd root
|
Binary file not shown.
122
deb/opt/apps/deepin-wine-runner/ProgramFen.py
Normal file
122
deb/opt/apps/deepin-wine-runner/ProgramFen.py
Normal file
@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import base64
|
||||
import traceback
|
||||
import req as requests
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
class ProgramRunStatusShow():
|
||||
msgWindow = None
|
||||
def ShowWindow():
|
||||
try:
|
||||
#fenlists = requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9iYXNoYXBwLw==").decode("utf-8") + fileName + base64.b64decode("L2FsbC5qc29u").decode("utf-8")).json()
|
||||
fenlists = []
|
||||
for i in range(6):
|
||||
fenlists.append(int(requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9GZW4=").decode("utf-8") + f"{i}/data.txt").text))
|
||||
tipsInfo = ""
|
||||
except:
|
||||
traceback.print_exc()
|
||||
fenlists = [0, 0, 0, 0, 0]
|
||||
tipsInfo = "暂时无人提交此脚本运行情况,是否立即提交?"
|
||||
|
||||
maxHead = fenlists.index(max(fenlists))
|
||||
allNumber = 0
|
||||
for i in fenlists:
|
||||
allNumber += i
|
||||
try:
|
||||
tipsInfo = ""
|
||||
for i in range(len(fenlists)):
|
||||
tipsInfo += f"有 {fenlists[i] / allNumber * 100}% 的用户选择了 {i} 分({fenlists[i]}/{allNumber})\n"
|
||||
maxNumber = max(fenlists) / allNumber * 100
|
||||
#if tipsInfo == "":
|
||||
# tipsInfo = f"有{maxNumber}%的用户选择了这个评分"
|
||||
except:
|
||||
pass
|
||||
ProgramRunStatusShow.msgWindow = QtWidgets.QMainWindow()
|
||||
msgWidget = QtWidgets.QWidget()
|
||||
msgWidgetLayout = QtWidgets.QGridLayout()
|
||||
starLayout = QtWidgets.QHBoxLayout()
|
||||
uploadButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "点此上传运行情况"))
|
||||
uploadButton.clicked.connect(ProgramRunStatusUpload.ShowWindow)
|
||||
msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "综合评价:")), 0, 0)
|
||||
msgWidgetLayout.addLayout(starLayout, 0, 1)
|
||||
msgWidgetLayout.addWidget(QtWidgets.QLabel(tipsInfo), 1, 0, 1, 2)
|
||||
msgWidgetLayout.addWidget(uploadButton, 3, 0, 1, 2)
|
||||
end = 5
|
||||
if maxHead > 5:
|
||||
for i in range(end):
|
||||
starLayout.addWidget(QtWidgets.QLabel(f"<img src='{programPath}/Icon/BadStar.svg' width=50>"))
|
||||
else:
|
||||
for i in range(maxHead):
|
||||
starLayout.addWidget(QtWidgets.QLabel(f"<img src='{programPath}/Icon/Star.svg' width=50>"))
|
||||
head = maxHead
|
||||
for i in range(head, end):
|
||||
starLayout.addWidget(QtWidgets.QLabel(f"<img src='{programPath}/Icon/UnStar.svg' width=50>"))
|
||||
msgWidget.setLayout(msgWidgetLayout)
|
||||
ProgramRunStatusShow.msgWindow.setCentralWidget(msgWidget)
|
||||
ProgramRunStatusShow.msgWindow.setWindowIcon(QtGui.QIcon(iconPath))
|
||||
ProgramRunStatusShow.msgWindow.setWindowTitle(f"程序运行情况")
|
||||
ProgramRunStatusShow.msgWindow.show()
|
||||
|
||||
class ProgramRunStatusUpload():
|
||||
msgWindow = None
|
||||
starLayout = None
|
||||
fen = None
|
||||
starList = []
|
||||
sha1Value = ""
|
||||
programName = None
|
||||
def ChangeStar():
|
||||
if ProgramRunStatusUpload.fen.currentIndex() > 5:
|
||||
for i in ProgramRunStatusUpload.starList:
|
||||
i.setText(f"<img src='{programPath}/Icon/BadStar.svg' width=25>")
|
||||
return
|
||||
for i in range(ProgramRunStatusUpload.fen.currentIndex()):
|
||||
ProgramRunStatusUpload.starList[i].setText(f"<img src='{programPath}/Icon/Star.svg' width=25>")
|
||||
head = ProgramRunStatusUpload.fen.currentIndex()
|
||||
end = len(ProgramRunStatusUpload.starList)
|
||||
for i in range(head, end):
|
||||
ProgramRunStatusUpload.starList[i].setText(f"<img src='{programPath}/Icon/UnStar.svg' width=25>")
|
||||
|
||||
def ShowWindow():
|
||||
ProgramRunStatusUpload.starList = []
|
||||
ProgramRunStatusUpload.msgWindow = QtWidgets.QMainWindow()
|
||||
msgWidget = QtWidgets.QWidget()
|
||||
msgWidgetLayout = QtWidgets.QGridLayout()
|
||||
ProgramRunStatusUpload.fen = QtWidgets.QComboBox()
|
||||
ProgramRunStatusUpload.starLayout = QtWidgets.QHBoxLayout()
|
||||
upload = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "上传"))
|
||||
upload.clicked.connect(ProgramRunStatusUpload.Upload)
|
||||
# 生成星星列表
|
||||
for i in [1, 1, 1, 1, 0]:
|
||||
ProgramRunStatusUpload.starList.append(QtWidgets.QLabel(f"<img src='{programPath}/Icon/{['Un', ''][i]}Star.svg' width=25>"))
|
||||
ProgramRunStatusUpload.starLayout.addWidget(ProgramRunStatusUpload.starList[-1])
|
||||
ProgramRunStatusUpload.starLayout.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum))
|
||||
ProgramRunStatusUpload.fen.addItems(["0分", "1分", "2分", "3分", "4分", "5分"])
|
||||
ProgramRunStatusUpload.fen.setCurrentIndex(4)
|
||||
ProgramRunStatusUpload.fen.currentIndexChanged.connect(ProgramRunStatusUpload.ChangeStar)
|
||||
msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "评分:")), 1, 0)
|
||||
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(QtCore.QCoreApplication.translate("U", "上传程序运行情况"))
|
||||
ProgramRunStatusUpload.msgWindow.setWindowIcon(QtGui.QIcon(iconPath))
|
||||
ProgramRunStatusUpload.msgWindow.show()
|
||||
|
||||
def Upload():
|
||||
try:
|
||||
QtWidgets.QMessageBox.information(None, QtCore.QCoreApplication.translate("U", "提示"), requests.get(f"http://120.25.153.144/spark-deepin-wine-runner/Install.php?Version=Fen{ProgramRunStatusUpload.fen.currentIndex()}").json()["Error"])
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(None, QtCore.QCoreApplication.translate("U", "错误"), QtCore.QCoreApplication.translate("U", "数据上传失败!"))
|
||||
|
||||
if __name__ == "__main__":
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
ProgramRunStatusShow.ShowWindow()
|
||||
app.exec_()
|
Binary file not shown.
@ -7,32 +7,21 @@ with open("/var/lib/dpkg/status", "r") as i:
|
||||
if unConnect:
|
||||
print("52专版,将会无法连接服务器")
|
||||
|
||||
badUrl = [
|
||||
"http://120.25.153.144",
|
||||
"https://304626p927.goho.co",
|
||||
"https://30x46269h2.goho.co",
|
||||
"http://gfdgdxi.msns.cn"
|
||||
]
|
||||
|
||||
class Respon:
|
||||
text = ""
|
||||
|
||||
def get(url, timeout=None): # -> requests.Response:
|
||||
if unConnect:
|
||||
# 筛选 Url,只有特定的 url 才会被拦截
|
||||
for i in badUrl:
|
||||
if i in url:
|
||||
raise Exception("52专版不支持连接作者服务器")
|
||||
# 全部 Url 都拦截
|
||||
raise Exception("52专版不支持连接服务器")
|
||||
if timeout == None:
|
||||
return requests.get(url)
|
||||
return requests.get(url, timeout=timeout)
|
||||
|
||||
def post(url, data, timeout=None):
|
||||
if unConnect:
|
||||
# 筛选 Url,只有特定的 url 才会被拦截
|
||||
for i in badUrl:
|
||||
if i in url:
|
||||
raise Exception("52专版不支持连接作者服务器")
|
||||
# 全部 Url 都拦截
|
||||
raise Exception("52专版不支持连接服务器")
|
||||
if timeout == None:
|
||||
return requests.post(url, data)
|
||||
return requests.post(url, data, timeout=timeout)
|
Binary file not shown.
Binary file not shown.
@ -14,6 +14,7 @@ import os
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
import random
|
||||
import base64
|
||||
import shutil
|
||||
import hashlib
|
||||
@ -2160,6 +2161,39 @@ def GetVersion():
|
||||
runVersion.signal.connect(AddDockerMenu)
|
||||
runVersion.start()
|
||||
|
||||
def UnPackage():
|
||||
debPath = QtWidgets.QFileDialog.getOpenFileName(window)
|
||||
if not debPath[1]:
|
||||
return
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(window)
|
||||
print(path)
|
||||
if not path[1]:
|
||||
return
|
||||
tempDebDir = f"/tmp/wine-runner-unpack-deb-{random.randint(0, 1000)}"
|
||||
if os.system(f"dpkg -b '{debPath}' '{tempDebDir}'"):
|
||||
QtWidgets.QMessageBox.critical(window, "错误", "解压失败!")
|
||||
return
|
||||
zippath = FindFile(tempDebDir, "files.7z")
|
||||
if zippath == None:
|
||||
QtWidgets.QMessageBox.critical(window, "错误", "解压失败!")
|
||||
return
|
||||
print(path)
|
||||
# 解压文件
|
||||
os.system(f"mkdir -p '{path[0]}'")
|
||||
os.system(f"7z x '{zippath}' -o'{path[0]}'")
|
||||
|
||||
def FindFile(file, name):
|
||||
for i in os.listdir(file):
|
||||
path = f"{file}/{i}"
|
||||
if os.path.isdir(path):
|
||||
returnPath = FindFile(path, name)
|
||||
if returnPath != None:
|
||||
return returnPath.replace("//", "/")
|
||||
if os.path.isfile(path):
|
||||
if i == name:
|
||||
return path
|
||||
return None
|
||||
|
||||
programVersionType = ""
|
||||
print(wine)
|
||||
###########################
|
||||
@ -2193,10 +2227,14 @@ exe路径\' 参数 \'
|
||||
updateThingsString = '''※1、支持使用 Qemu + Chroot 跨运行 Wine 以及指定程序的功能;
|
||||
※2、提供了简易打包器以用于打包简易 deb;
|
||||
※3、支持下载配置过的 Qemu + Chroot 容器;
|
||||
※4、支持解压指定 deb 的内打包好的容器;
|
||||
5、优化 Wine 列表显示;
|
||||
6、优化非基于生态适配脚本的打包器内容自动填充功能;
|
||||
7、新增程序论坛和教程入口
|
||||
'''
|
||||
for i in information["Thank"]:
|
||||
thankText += f"{i}\n"
|
||||
updateTime = "2022年12月03日"
|
||||
updateTime = "2022年12月04日"
|
||||
about = f'''<style>
|
||||
a:link, a:active {{
|
||||
text-decoration: none;
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user