mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-12 17:48:27 +08:00
修复VCPP安装器无法安装第一项的问题
This commit is contained in:
parent
fb0e87f81c
commit
f2c358717e
@ -19,10 +19,10 @@ try:
|
||||
"https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/vscpp/list.json",
|
||||
"http://gfdgdxi.msns.cn/wine-runner-list/vscpp/list.json"
|
||||
]
|
||||
netList = json.loads(requests.get().text)
|
||||
netList = json.loads(requests.get(sourcesList[0]).text)
|
||||
except:
|
||||
netList = [
|
||||
["VC6 运行库", "https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/vscpp/VC6RedistSetup_deu.exe"],
|
||||
["VC6 运行库", "https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/vscpp/VC6RedistSetup_deu.exe", "VC6RedistSetup_deu.exe"],
|
||||
["2005 Service Pack 1 Redistributable Package MFC 安全更新", "https://download.microsoft.com/download/4/A/2/4A22001F-FA3B-4C13-BF4E-42EC249D51C4/vcredist_x86.EXE", "vcredist05_x86.exe"],
|
||||
["2008 (VC++ 9.0) SP1 (不再支持) X86", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe", "vcredist08_x86.exe"],
|
||||
["2008 (VC++ 9.0) SP1 (不再支持) X64", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe", "vcredist08_x86.exe"],
|
||||
|
5
Makefile
5
Makefile
@ -46,7 +46,7 @@ build:
|
||||
cp -rv DisabledOpengl.reg deb/opt/apps/deepin-wine-runner
|
||||
cp -rv EnabledOpengl.reg deb/opt/apps/deepin-wine-runner
|
||||
cp -rv geek.exe deb/opt/apps/deepin-wine-runner
|
||||
cp -rv uengineapi deb/opt/apps/deepin-wine-runner
|
||||
#cp -rv uengineapi deb/opt/apps/deepin-wine-runner
|
||||
cp -rv getxmlimg.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv ProgramFen.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv information.json deb/opt/apps/deepin-wine-runner
|
||||
@ -93,6 +93,7 @@ build:
|
||||
cp -rv API deb/opt/apps/deepin-wine-runner
|
||||
cp -rv key deb/opt/apps/deepin-wine-runner
|
||||
python3 RemovePycacheFile.py
|
||||
cp -rv deb /tmp/spark-deepin-wine-runner-builder
|
||||
ln -s /opt/apps/deepin-wine-runner/deepin-wine-packager.py /tmp/spark-deepin-wine-runner-builder/usr/bin/deepin-wine-package-builder
|
||||
ln -s /opt/apps/deepin-wine-runner/deepin-wine-easy-packager.py /tmp/spark-deepin-wine-runner-builder/usr/bin/deepin-wine-packager-easy-builder
|
||||
ln -s /opt/apps/deepin-wine-runner/deepin-wine-packager-with-script.py /tmp/spark-deepin-wine-runner-builder/usr/bin/deepin-wine-packager-with-script
|
||||
@ -112,7 +113,7 @@ build:
|
||||
ln -s /opt/apps/deepin-wine-runner/InstallNetFramework.py /tmp/spark-deepin-wine-runner-builder/usr/bin/deepin-wine-runner-wine-netframework-installer
|
||||
ln -s /opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py /tmp/spark-deepin-wine-runner-builder/usr/bin/deepin-wine-runner-wine-vscppruntime-installer
|
||||
ln -s /opt/apps/deepin-wine-runner/deepin-wine-venturi-setter.py /tmp/spark-deepin-wine-runner-builder/usr/bin/deepin-wine-venturi-setter
|
||||
cp -rv deb /tmp/spark-deepin-wine-runner-builder
|
||||
|
||||
sudo chown -R root:root /tmp/spark-deepin-wine-runner-builder
|
||||
|
||||
dpkg -b /tmp/spark-deepin-wine-runner-builder spark-deepin-wine-runner.deb
|
||||
|
@ -350,7 +350,6 @@ class ProgramRunStatusShow():
|
||||
print(f"脚本:{name}")
|
||||
print(f"评论:{info}")
|
||||
try:
|
||||
#
|
||||
res = requests.post(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0OjMwMjUwL1BpbmdMdW4=").decode("utf-8"), {"PinLun": info, "Version": name}).json()
|
||||
print(res)
|
||||
if res["ExitCode"]:
|
||||
|
@ -12,6 +12,8 @@ import sys
|
||||
import time
|
||||
import json
|
||||
import random
|
||||
# 阉割 Android 应用安装功能
|
||||
#import uengineapi
|
||||
import platform
|
||||
import traceback
|
||||
import webbrowser
|
||||
@ -129,7 +131,8 @@ class Command():
|
||||
"installother",
|
||||
"decompressionbottle",
|
||||
"programforum",
|
||||
"installmsi"
|
||||
"installmsi",
|
||||
"installapk"
|
||||
]
|
||||
|
||||
def __init__(self, commandString: str) -> None:
|
||||
@ -236,7 +239,7 @@ class Command():
|
||||
return 0
|
||||
|
||||
def StopDll(self) -> int:
|
||||
os.system(f"WINEPREFIX='{self.wineBottonPath}' '{self.wine}' reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(self.command[1])[0]} /f")
|
||||
return os.system(f"WINEPREFIX='{self.wineBottonPath}' '{self.wine}' reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(self.command[1])[0]} /f")
|
||||
|
||||
def CreateBotton(self):
|
||||
self.command = ["bat", "exit"]
|
||||
@ -349,9 +352,11 @@ class Command():
|
||||
file = open(self.command[1], "r")
|
||||
print(file.read())
|
||||
file.close()
|
||||
return 0
|
||||
except:
|
||||
print("文件读取错误")
|
||||
Debug()
|
||||
return 1
|
||||
|
||||
def Taskmgr(self):
|
||||
self.command = ["bat", "taskmgr"]
|
||||
@ -362,7 +367,7 @@ class Command():
|
||||
return self.Bat()
|
||||
|
||||
def Killall(self):
|
||||
os.system(f"killall -9 {self.command[1]}")
|
||||
return os.system(f"killall -9 {self.command[1]}")
|
||||
|
||||
def KillallWineServer(self):
|
||||
command = ["WINEPREFIX='($WINEPREFIX)'", "($WINE)", "-k"]
|
||||
@ -385,19 +390,19 @@ class Command():
|
||||
|
||||
def EnabledWineBottleCreateLink(self):
|
||||
self.command = ["bat", "reg", "delete", "HKEY_CURRENT_USER\Software\Wine\DllOverrides", "/v", "winemenubuilder.exe", "/f"]
|
||||
self.Bat()
|
||||
return self.Bat()
|
||||
|
||||
def DisbledWineBottleCreateLink(self):
|
||||
self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\DllOverrides", "/v", "winemenubuilder.exe", "/f"]
|
||||
self.Bat()
|
||||
return self.Bat()
|
||||
|
||||
def DisbledWineCrashDialog(self):
|
||||
self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\WineDbg", "/v", "ShowCrashDialog", "/t", "REG_DWORD", "/d", "00000000", "/f"]
|
||||
self.Bat()
|
||||
return self.Bat()
|
||||
|
||||
def EnabledWineCrashDialog(self):
|
||||
self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\WineDbg", "/v", "ShowCrashDialog", "/t", "REG_DWORD", "/d", "00000001", "/f"]
|
||||
self.Bat()
|
||||
return self.Bat()
|
||||
|
||||
def EnabledHttpProxy(self):
|
||||
proxyServerAddress = self.command[1]
|
||||
@ -405,7 +410,7 @@ class Command():
|
||||
self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyEnable", "/t", "REG_DWORD", "/d", "00000001", "/f"]
|
||||
self.Bat()
|
||||
self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyServer", "/d", f"{proxyServerAddress}:{port}", "/f"]
|
||||
self.Bat()
|
||||
return self.Bat()
|
||||
|
||||
def DecompressionBottle(self):
|
||||
tempDebDir = f"/tmp/wine-runner-unpack-deb-{random.randint(0, 1000)}"
|
||||
@ -423,7 +428,7 @@ class Command():
|
||||
|
||||
def DisbledHttpProxy(self):
|
||||
self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyEnable", "/t", "REG_DWORD", "/d", "00000000", "/f"]
|
||||
self.Bat()
|
||||
return self.Bat()
|
||||
|
||||
def InstallVB(self):
|
||||
import InstallVisualBasicRuntime
|
||||
@ -435,11 +440,28 @@ class Command():
|
||||
|
||||
def ProgramForum(self):
|
||||
webbrowser.open_new_tab("https://gfdgdxi.flarum.cloud/")
|
||||
return
|
||||
|
||||
def InstallMSI(self):
|
||||
self.command = ["bat", "msiexec", "/i", self.command[1]]
|
||||
return self.Bat()
|
||||
|
||||
def InstallApk(self):
|
||||
if os.system("which uengine > /dev/null"):
|
||||
print("未安装 UEngine,无法使用该命令")
|
||||
return 1
|
||||
apk = uengineapi.APK(self.command[1])
|
||||
result = apk.install()
|
||||
homePath = os.getenv("HOME")
|
||||
if not os.path.exists(f"{homePath}/.local/share/applications/uengine"):
|
||||
os.makedirs(f"{homePath}/.local/share/applications/uengine")
|
||||
if not os.path.exists(f"{homePath}/.local/share/icons/hicolor/apps"):
|
||||
os.makedirs(f"{homePath}/.local/share/icons/hicolor/apps")
|
||||
package = apk.packageName()
|
||||
apk.saveApkIcon(f"{homePath}/.local/share/icons/hicolor/apps/{package}.png")
|
||||
apk.saveDesktopFile(f"{homePath}/.local/share/applications/uengine/{package}.desktop", f"{homePath}/.local/share/icons/hicolor/apps/{package}.png")
|
||||
return result
|
||||
|
||||
# 可以运行的命令的映射关系
|
||||
# 可以被使用的命令的映射
|
||||
commandList = {
|
||||
@ -485,7 +507,8 @@ class Command():
|
||||
"installother": InstallOther,
|
||||
"decompressionbottle": DecompressionBottle,
|
||||
"programforum": ProgramForum,
|
||||
"installmsi": InstallMSI
|
||||
"installmsi": InstallMSI,
|
||||
"installapk": InstallApk
|
||||
}
|
||||
|
||||
# 参数数列表
|
||||
@ -533,7 +556,8 @@ class Command():
|
||||
"installother": [1],
|
||||
"decompressionbottle": [2],
|
||||
"programforum": [0],
|
||||
"installmsi": [1]
|
||||
"installmsi": [1],
|
||||
"installapk": [1]
|
||||
}
|
||||
windowsUnrun = [
|
||||
"createbotton",
|
||||
@ -548,7 +572,8 @@ class Command():
|
||||
"installdxvk",
|
||||
"installfont",
|
||||
"installsparkcorefont",
|
||||
"decompressionbottle"
|
||||
"decompressionbottle",
|
||||
"installapk"
|
||||
]
|
||||
# 解析
|
||||
def __init__(self, command: list, wineBottonPath: str, wine: str) -> int:
|
||||
@ -598,7 +623,11 @@ class Command():
|
||||
for b in programEnv:
|
||||
if b[0] in i[a]:
|
||||
i[a] = i[a].replace(b[0], b[1])
|
||||
commandReturn = self.commandList[i[0]](self)
|
||||
try:
|
||||
commandReturn = self.commandList[i[0]](self)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
commandReturn = 1
|
||||
if commandReturn:
|
||||
print(f"运行命令{' '.join(self.command)}出现错误,返回值:", commandReturn)
|
||||
programEnv[9][1] = str(commandReturn)
|
||||
|
@ -41,6 +41,7 @@ if [[ $2 == "root" ]]; then
|
||||
else
|
||||
mount --bind "/home/$2" "$1/home/$2"
|
||||
fi
|
||||
|
||||
# 挂载此内容以可以跨架构运行程序
|
||||
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
|
||||
# 如果参数 3 存在
|
||||
"$programPath/pardus-chroot" "--userspec=$2:$2" . env "HOME=/home/$2" ${@:3}
|
||||
|
@ -26,6 +26,7 @@ cp -r /usr/bin/qemu-*-static ./usr/bin
|
||||
#mount --bind /dev/shm ./dev/shm
|
||||
chmod 777 -R root tmp
|
||||
xhost +
|
||||
|
||||
# 挂载此内容以可以跨架构运行程序
|
||||
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
|
||||
# 如果参数 3 存在
|
||||
"$programPath/pardus-chroot" . ${@:3}
|
||||
|
@ -281,6 +281,30 @@ class Runexebutton_threading(QtCore.QThread):
|
||||
else:
|
||||
option += "WINEDEBUG=FIXME,ERR,WARN,TRACE,Message "
|
||||
wineUsingOption = ""
|
||||
exePath = e2.currentText()
|
||||
if True:
|
||||
fileName = [".exe"]
|
||||
changePath = False
|
||||
for i in fileName:
|
||||
if i in exePath:
|
||||
print(i)
|
||||
print(exePath)
|
||||
l = exePath.index(i)
|
||||
exePath = f"{exePath[:l+4]}' {exePath[l+4:]} '"
|
||||
print(l)
|
||||
print(exePath)
|
||||
changePath = True
|
||||
break
|
||||
#if not changePath and not os.path.exists(changePath):
|
||||
if not changePath and not os.path.exists(exePath):
|
||||
# 删除前后无用空格以防止出现问题
|
||||
print(exePath)
|
||||
exePath = exePath.strip()
|
||||
l = exePath.index(" ")
|
||||
exePath = f"{exePath[:l]}' {exePath[l:]} '"
|
||||
print(l)
|
||||
#print(i)
|
||||
print(exePath)
|
||||
if o1.currentText() == "基于 UOS exagear 的 deepin-wine6-stable" or o1.currentText() == "基于 UOS box86 的 deepin-wine6-stable":
|
||||
wineUsingOption = ""
|
||||
if o1.currentText() == "基于 UOS box86 的 deepin-wine6-stable" or o1.currentText() == "基于 UOS exagear 的 deepin-wine6-stable":
|
||||
@ -293,15 +317,19 @@ class Runexebutton_threading(QtCore.QThread):
|
||||
res = ""
|
||||
if e2.currentText()[-4:] == ".msi" and os.path.exists(e2.currentText()):
|
||||
OpenTerminal("env WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " msiexec /i '" + e2.currentText() + "' " + setting["WineOption"])
|
||||
elif e2.currentText()[-4:] == ".bat" and os.path.exists(e2.currentText()):
|
||||
OpenTerminal("env WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " wineconsole '" + e2.currentText() + "' " + setting["WineOption"])
|
||||
else:
|
||||
OpenTerminal("env WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"])
|
||||
OpenTerminal("env WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + exePath + "' " + setting["WineOption"])
|
||||
#res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"] + "\" --keep-open" + wineUsingOption], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
else:
|
||||
if e2.currentText()[-4:] == ".msi" and os.path.exists(e2.currentText()):
|
||||
res = subprocess.Popen(["WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " msiexec /i '" + e2.currentText() + "' " + setting["WineOption"]], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
elif e2.currentText()[-4:] == ".bat" and os.path.exists(e2.currentText()):
|
||||
res = subprocess.Popen(["WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " wineconsole '" + e2.currentText() + "' " + setting["WineOption"]], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
else:
|
||||
print(["WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"]])
|
||||
res = subprocess.Popen(["WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"]], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
print(["WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + exePath + "' " + setting["WineOption"]])
|
||||
res = subprocess.Popen(["WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + exePath + "' " + setting["WineOption"]], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
# 实时读取程序返回
|
||||
#
|
||||
if not setting["TerminalOpen"]:
|
||||
@ -2114,7 +2142,7 @@ defultProgramList = {
|
||||
"WineBottonDifferent": False,
|
||||
"CenterWindow": False,
|
||||
"Theme": "",
|
||||
"MonoGeckoInstaller": True,
|
||||
"MonoGeckoInstaller": False,
|
||||
"AutoWine": True,
|
||||
"RuntimeCache": True,
|
||||
"MustRead": False,
|
||||
@ -2214,6 +2242,10 @@ try:
|
||||
isoPathFound = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json")).values())
|
||||
setting = json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineSetting.json"))
|
||||
change = False
|
||||
if not os.path.exists(get_home() + "/.config/deepin-wine-runner/mono-lock"):
|
||||
os.mknod(f"{get_home()}/.config/deepin-wine-runner/mono-lock")
|
||||
setting["MonoGeckoInstaller"] = False
|
||||
change = True
|
||||
for i in defultProgramList.keys():
|
||||
if not i in setting:
|
||||
change = True
|
||||
@ -2561,7 +2593,7 @@ mainLayout.setColumnStretch(1, 1)
|
||||
mainLayout.addWidget(returnText, 0, 1, 2, 1)
|
||||
|
||||
# 版权
|
||||
copy = QtWidgets.QLabel(f"""\n程序版本:{version},<b>提示:Wine 无法运行所有的 Windows 程序,如果想要运行更多可执行程序,可以考虑虚拟机和双系统</b><br>
|
||||
copy = QtWidgets.QLabel(f"""\n程序版本:{version},<b>提示:Wine 无法运行保证可以运行所有的 Windows 程序,如果想要运行更多可执行程序,可以考虑虚拟机和双系统</b><br>
|
||||
©2020~{time.strftime("%Y")} gfdgd xi、为什么您不喜欢熊出没和阿布呢,RacoonGX 团队作品""")
|
||||
mainLayout.addWidget(copy, 2, 0, 1, 1)
|
||||
|
||||
@ -2590,12 +2622,12 @@ installWineOnDeepin23Alpha = QtWidgets.QAction(QtGui.QIcon(f"{programPath}/Icon/
|
||||
installWineHQ = QtWidgets.QAction(QtGui.QIcon(f"{programPath}/Icon/Function/wine.png"), transla.transe("U", "安装 WineHQ"))
|
||||
installMoreWine = QtWidgets.QAction(QtGui.QIcon(f"{programPath}/Icon/Function/more-wine.png"), transla.transe("U", "安装更多 Wine"))
|
||||
downloadChrootBottle = QtWidgets.QAction(QtGui.QIcon(f"{programPath}/Icon/Function/CHROOT.png"), transla.transe("U", "下载 Chroot 容器"))
|
||||
p2 = QtWidgets.QAction(transla.transe("U", "设置程序(&S)"))
|
||||
p2 = QtWidgets.QAction(QtGui.QIcon.fromTheme("settings"), transla.transe("U", "设置程序(&S)"))
|
||||
enabledAll = QtWidgets.QAction(transla.transe("U", "强制启用所有被禁用的组件(不推荐)"))
|
||||
p3 = QtWidgets.QAction(QtWidgets.QApplication.style().standardIcon(47), transla.transe("U", "清空软件历史记录(&C)"))
|
||||
cleanCache = QtWidgets.QAction(QtWidgets.QApplication.style().standardIcon(47), transla.transe("U", "清空软件缓存"))
|
||||
cleanProgramUnuse = QtWidgets.QAction(QtWidgets.QApplication.style().standardIcon(47), transla.transe("U", "删除程序组件"))
|
||||
p4 = QtWidgets.QAction(transla.transe("U", "退出程序(&E)"))
|
||||
p4 = QtWidgets.QAction(QtGui.QIcon.fromTheme("exit"), transla.transe("U", "退出程序(&E)"))
|
||||
programmenu.addAction(p1)
|
||||
programmenu.addAction(installWineOnDeepin23)
|
||||
programmenu.addAction(installWineOnDeepin23Alpha)
|
||||
|
118
deb/opt/apps/deepin-wine-runner/getxmlimg.py
Executable file
118
deb/opt/apps/deepin-wine-runner/getxmlimg.py
Executable file
@ -0,0 +1,118 @@
|
||||
import PIL.Image as Image
|
||||
import PIL.ImageDraw as ImageDraw
|
||||
import zipfile
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
class getsavexml():
|
||||
|
||||
def savexml(self,apkFilePath,xmlpath,iconSavePath):
|
||||
cmddumpid = "aapt dump xmltree "+ apkFilePath + " " + xmlpath
|
||||
print(cmddumpid)
|
||||
xmltree = subprocess.getoutput(cmddumpid)
|
||||
xmls = xmltree.splitlines()
|
||||
# find strs ,print next line
|
||||
def FindStrs(lines,strs):
|
||||
i=0
|
||||
while i < len(lines):
|
||||
if re.search(strs,lines[i]):
|
||||
tmpstr = lines[i+1]
|
||||
i += 1
|
||||
Resultstr = tmpstr.split(":")[-1].split("=")[-1].split("0x")[-1]
|
||||
return Resultstr
|
||||
else:
|
||||
i += 1
|
||||
#从apk的信息中获取前后景图片的ID号
|
||||
backimgid = FindStrs(xmls,"background")
|
||||
foreimgid = FindStrs(xmls,"foreground")
|
||||
print(backimgid)
|
||||
print(foreimgid)
|
||||
|
||||
# 直接从apk resource文件获取前后两层图片路径及ID字符串
|
||||
resource = subprocess.getoutput("aapt dump --values resources " + apkFilePath + "| grep -iE -A1 " + "\"" + backimgid + "|" + foreimgid + "\"")
|
||||
resourcelines = resource.splitlines()
|
||||
print(resourcelines)
|
||||
|
||||
# 从过滤出的字符串中获取所有相同ID的图片路径
|
||||
def Findpicpath(lines,imgid):
|
||||
i=0
|
||||
Resultstr = []
|
||||
while i < len(lines):
|
||||
if re.search(imgid,lines[i]) and re.search("string8",lines[i+1]) :
|
||||
print(lines[i+1])
|
||||
tmpstr = lines[i+1].replace("\"","")
|
||||
i += 1
|
||||
Resultstr.append(tmpstr.split()[-1])
|
||||
else:
|
||||
i += 1
|
||||
return Resultstr
|
||||
|
||||
#获取所有带前后图片ID的图片路径(相同背景或者前景的图片ID但分辨率不一样)
|
||||
backimgs = Findpicpath(resourcelines,backimgid)
|
||||
foreimgs = Findpicpath(resourcelines,foreimgid)
|
||||
print(backimgs)
|
||||
print(foreimgs)
|
||||
#获取分辨率最高的图片路径
|
||||
def getmaxsize(imgs):
|
||||
j = 0
|
||||
size=(0,0)
|
||||
zipapk = zipfile.ZipFile(apkFilePath)
|
||||
imgpath = ""
|
||||
while j < len(imgs):
|
||||
print(imgs[j])
|
||||
img = Image.open(zipapk.open(imgs[j]))
|
||||
print(imgs[j])
|
||||
print(img.size)
|
||||
if size < img.size:
|
||||
size = img.size
|
||||
imgpath = imgs[j]
|
||||
j += 1
|
||||
return imgpath
|
||||
|
||||
# 获取到文件列表后,进行比较分辨率,选取分辨率最高的张图片
|
||||
iconbackpath = getmaxsize(backimgs)
|
||||
iconforepath = getmaxsize(foreimgs)
|
||||
print(iconbackpath + " " + iconforepath)
|
||||
|
||||
#从APK文件获取最终图片
|
||||
zipapk = zipfile.ZipFile(apkFilePath)
|
||||
iconback = zipapk.open(iconbackpath)
|
||||
iconfore = zipapk.open(iconforepath)
|
||||
|
||||
|
||||
# 叠加图片,mask 设置前景为蒙版
|
||||
iconbackimg = Image.open(iconback).convert("RGBA")
|
||||
iconforeimg = Image.open(iconfore).convert("RGBA")
|
||||
iconbackimg.paste(iconforeimg,mask=iconforeimg)
|
||||
|
||||
|
||||
# 圆角图片函数,网上拷贝的
|
||||
def circle_corner(img, radii): #把原图片变成圆角,这个函数是从网上找的,原址 https://www.pyget.cn/p/185266
|
||||
"""
|
||||
圆角处理
|
||||
:param img: 源图象。
|
||||
:param radii: 半径,如:30。
|
||||
:return: 返回一个圆角处理后的图象。
|
||||
"""
|
||||
# 画圆(用于分离4个角)
|
||||
circle = Image.new('L', (radii * 2, radii * 2), 0) # 创建一个黑色背景的画布
|
||||
draw = ImageDraw.Draw(circle)
|
||||
draw.ellipse((0, 0, radii * 2, radii * 2), fill=255) # 画白色圆形
|
||||
# 原图
|
||||
img = img.convert("RGBA")
|
||||
w, h = img.size
|
||||
# 画4个角(将整圆分离为4个部分)
|
||||
alpha = Image.new('L', img.size, 255)
|
||||
alpha.paste(circle.crop((0, 0, radii, radii)), (0, 0)) # 左上角
|
||||
alpha.paste(circle.crop((radii, 0, radii * 2, radii)), (w - radii, 0)) # 右上角
|
||||
alpha.paste(circle.crop((radii, radii, radii * 2, radii * 2)), (w - radii, h - radii)) # 右下角
|
||||
alpha.paste(circle.crop((0, radii, radii, radii * 2)), (0, h - radii)) # 左下角
|
||||
# alpha.show()
|
||||
img.putalpha(alpha) # 白色区域透明可见,黑色区域不可见
|
||||
return img
|
||||
|
||||
# 圆角半径1/8边长,保存icon图片
|
||||
w,h = iconbackimg.size
|
||||
iconimg = circle_corner(iconbackimg,int(w/8))
|
||||
iconimg.save(iconSavePath)
|
||||
|
@ -1,8 +1,9 @@
|
||||
{
|
||||
"Version": "3.1.0",
|
||||
"Thank": [
|
||||
"感谢 @Amber 编写的《使用wine运行器打包无安装包的软件》:https://bbs.deepin.org/post/247720",
|
||||
"感谢 @豪 提供程序图标",
|
||||
"感谢 @鹤舞白沙 对程序文案进行优化以及编写《Wine运行器和Wine打包器傻瓜式使用教程(小白专用) 》",
|
||||
"感谢 @鹤舞白沙 对程序文案进行优化以及编写《Wine运行器和Wine打包器傻瓜式使用教程(小白专用) 》:https://bbs.deepin.org/post/246837",
|
||||
"感谢 @璀璨星空 提供的彩蛋图标",
|
||||
"感谢 @Bail 反馈的更新策略问题",
|
||||
"感谢 @白水 反馈的安装 exagear 后无法识别和调用 box86 的问题",
|
||||
|
Binary file not shown.
@ -227,7 +227,7 @@ class DownloadThread(QtCore.QThread):
|
||||
#progressbar.update(int(part / show))
|
||||
filePart.write(chunk)
|
||||
bytesRead += 1024
|
||||
self.ChangeDialog.emit(self.dialog, bytesRead / allSize * 100, bytesRead / 1024 / 1024, allSize / 1024 / 1024)
|
||||
self.ChangeDialog.emit(self.dialog, int(bytesRead / allSize * 100), int(bytesRead / 1024 / 1024), int(allSize / 1024 / 1024))
|
||||
# 写入配置文件
|
||||
rfile = open(f"{programPath}/winelist.json", "r")
|
||||
list = json.loads(rfile.read())
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user