Compare commits
59 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e1d3fb352 | |||
| e13076d841 | |||
|
|
da6c531c31 | ||
| 29e670a1b1 | |||
| f520dc81a2 | |||
| 3d0cd07016 | |||
| c73b06cc32 | |||
| 0f10e5aace | |||
| 683a1a876e | |||
| 9fb280271b | |||
| 12d8fb69e8 | |||
| 1cbb6d59be | |||
| 2170aa7959 | |||
| a7cf18bd28 | |||
| 38544a72f0 | |||
| efa2c65886 | |||
| 1e1f451d6c | |||
| ddbf0089b4 | |||
| 368bea581e | |||
|
|
cf60f70ba5 | ||
|
|
a1fe72e4b9 | ||
|
|
da347935b7 | ||
| 163923de8d | |||
| e90708e03d | |||
| ca939881e3 | |||
| fc8989db9f | |||
| b60f2cd0eb | |||
| 27eb980190 | |||
| 8a7010529d | |||
| 640c9f77a0 | |||
| ed39b338c9 | |||
| 51635cf2c0 | |||
| b2e15d12ac | |||
| dc998a4fa0 | |||
| 66963e6f26 | |||
| c8ccc1dff5 | |||
| 08dbe1cb80 | |||
| 01a3307626 | |||
| f6698e2f39 | |||
| 9c0e2d11b3 | |||
| bcebe543cc | |||
| 9fdc3a998c | |||
| fb0ff07ad6 | |||
| a5352c6942 | |||
| e724d19663 | |||
| e78fb2b4a4 | |||
| d330c83691 | |||
| de0a9b13f1 | |||
| 9cc549527d | |||
| 43e473ad39 | |||
| d78916f4b0 | |||
| bf370e9a91 | |||
| 84f71c2043 | |||
| e5231d7846 | |||
| b653bcbb80 | |||
| ad9deaed81 | |||
| 1b9e106d2a | |||
| c51cf18f4c | |||
| 4217f58c2c |
@@ -1,3 +0,0 @@
|
||||
import WineRunner
|
||||
WineRunner.Bash("a").runList([["thank"], ["version"]])
|
||||
#WineRunner.Bash("a").runCommand("thank")
|
||||
3
ChangePassword.sh
Executable 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
|
||||
0
ConfigLanguareRunner-help.json
Executable file → Normal file
0
DisabledOpengl.reg
Executable file → Normal file
5
Download.py
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import base64
|
||||
import requests
|
||||
print(requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9JbnN0YWxsLnBocD9WZXJzaW9uPQ==").decode("utf-8") + sys.argv[1]).text)
|
||||
0
EnabledOpengl.reg
Executable file → Normal file
BIN
GetEXEVersion.exe
Executable file
BIN
Icon/Function/CHROOT.png
Executable file
|
After Width: | Height: | Size: 22 KiB |
BIN
Icon/Function/more-wine.png
Executable file
|
After Width: | Height: | Size: 62 KiB |
BIN
Icon/Function/wine.png
Executable file
|
After Width: | Height: | Size: 67 KiB |
BIN
Icon/Function/wine23A.png
Executable file
|
After Width: | Height: | Size: 75 KiB |
BIN
Icon/Function/wine23P.png
Executable file
|
After Width: | Height: | Size: 75 KiB |
BIN
Icon/Program/Windows虚拟机.png
Executable file
|
After Width: | Height: | Size: 63 KiB |
BIN
Icon/Program/webp2.png
Executable file
|
After Width: | Height: | Size: 84 KiB |
BIN
Icon/Program/webp3.png
Executable file
|
After Width: | Height: | Size: 85 KiB |
BIN
Icon/Program/wine打包器.png
Executable file
|
After Width: | Height: | Size: 67 KiB |
BIN
Icon/Program/wine运行器.png
Executable file
|
After Width: | Height: | Size: 68 KiB |
BIN
Icon/Screen/202211121646232464_image.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
29
IconList.json
Normal file
@@ -0,0 +1,29 @@
|
||||
[
|
||||
[
|
||||
["QQ", "wineBottonPath/drive_c/Program Files/Tencent/QQ/Bin/QQ.exe"],
|
||||
["QQ", "wineBottonPath/drive_c/Program Files (x86)/Tencent/QQ/Bin/QQ.exe"],
|
||||
["TIM", "wineBottonPath/drive_c/Program Files/Tencent/TIM/Bin/TIM.exe"],
|
||||
["TIM", "wineBottonPath/drive_c/Program Files (x86)/Tencent/TIM/Bin/TIM.exe"]
|
||||
],
|
||||
[
|
||||
["cmd", "cmd"],
|
||||
["cmd", "cmd.exe"],
|
||||
["cmd", "wineBottonPath/drive_c/windows/system32/cmd.exe"],
|
||||
["Internet Explorer", "iexplore"],
|
||||
["Internet Explorer", "iexplore.exe"],
|
||||
["Internet Explorer", "wineBottonPath/drive_c/Program Files/Internet Explorer/iexplore.exe"],
|
||||
["Internet Explorer", "wineBottonPath/drive_c/Program Files (x86)/Internet Explorer/iexplore.exe"],
|
||||
["微信", "wineBottonPath/drive_c/Program Files/Tencent/WeChat/WeChat.exe"],
|
||||
["微信", "wineBottonPath/drive_c/Program Files (x86)/Tencent/WeChat/WeChat.exe"],
|
||||
["UltraISO", "wineBottonPath/drive_c/Program Files/UltraISO/UltraISO.exe"],
|
||||
["UltraISO", "wineBottonPath/drive_c/Program Files (x86)/UltraISO/UltraISO.exe"],
|
||||
["迅雷", "wineBottonPath/drive_c/Program Files/Thunder Network/MiniThunder/Bin/ThunderMini.exe"],
|
||||
["迅雷", "wineBottonPath/drive_c/Program Files (x86)/Thunder Network/MiniThunder/Bin/ThunderMini.exe"],
|
||||
["Microsoft Office Word", "wineBottonPath/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE"],
|
||||
["Microsoft Office Word", "wineBottonPath/drive_c/Program Files (x86)/Microsoft Office/Office12/WINWORD.EXE"],
|
||||
["腾讯会议", "wineBottonPath/drive_c/Program Files/Tencent/WeMeet/wemeetapp.exe"],
|
||||
["腾讯会议", "wineBottonPath/drive_c/Program Files (x86)/Tencent/WeMeet/wemeetapp.exe"],
|
||||
["腾讯课堂", "wineBottonPath/drive_c/Program Files/Tencent/EDU/bin/TXEDU.exe"],
|
||||
["腾讯课堂", "wineBottonPath/drive_c/Program Files (x86)/Tencent/EDU/bin/TXEDU.exe"]
|
||||
]
|
||||
]
|
||||
166
Makefile
@@ -3,79 +3,99 @@ build:
|
||||
#cd VM-source && make
|
||||
#cd wine && make
|
||||
cp -rv helperset deb/opt/apps/deepin-wine-runner/
|
||||
cp -rv VM-source/VirtualMachine VM
|
||||
cp -rv VM-source/deepin-wine-runner.svg VM
|
||||
cp -rv VM-source/api VM
|
||||
cp -rv VM-source/Windows7X64Auto.iso VM
|
||||
cp -rv VM-source/Windows7X86Auto.iso VM
|
||||
cp -rv VM-source/run.py VM
|
||||
cp -rv wine/ deb/opt/apps/deepin-wine-runner/
|
||||
cp -rv Test/ deb/opt/apps/deepin-wine-runner/
|
||||
cp -rv VM-source/VirtualMachine VM
|
||||
cp -rv VM-source/deepin-wine-runner.svg VM
|
||||
cp -rv VM-source/api VM
|
||||
cp -rv VM-source/Windows7X64Auto.iso VM
|
||||
cp -rv VM-source/Windows7X86Auto.iso VM
|
||||
cp -rv VM-source/run.py VM
|
||||
cp -rv wine/ deb/opt/apps/deepin-wine-runner/
|
||||
cp -rv Test/ deb/opt/apps/deepin-wine-runner/
|
||||
zip -v -q -r package-script.zip package-script
|
||||
cp -rv VM deb/opt/apps/deepin-wine-runner
|
||||
cp -rv AllInstall.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv kill.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallWineOnDeepin23Alpha.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv VM deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Download.py deb/opt/apps/deepin-wine-runner/
|
||||
cp -rv AllInstall.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv ShellList deb/opt/apps/deepin-wine-runner
|
||||
cp -rv QemuDownload.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv QemuRun.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv kill.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallWineOnDeepin23Alpha.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv wrestool deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Mount.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv UnMount.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv vkd3d-proton.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-easy-packager.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv IconList.json deb/opt/apps/deepin-wine-runner
|
||||
cp -rv GetEXEVersion.exe deb/opt/apps/deepin-wine-runner
|
||||
cp -rv MountWithoutHome.sh deb/opt/apps/deepin-wine-runner
|
||||
echo "[]" > deb/opt/apps/deepin-wine-runner/wine/winelist.json
|
||||
rm -rfv deb/opt/apps/deepin-wine-runner/wine/winelist.json
|
||||
cp -rv req deb/opt/apps/deepin-wine-runner
|
||||
cp -rv BuildDesktop.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv RegShot deb/opt/apps/deepin-wine-runner
|
||||
cp -rv BeCyIconGrabber.exe deb/opt/apps/deepin-wine-runner
|
||||
cp -rv AutoShell deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-packager-with-script.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-packager.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-runner-update-bug deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-runner.svg deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-venturi-setter.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallVisualBasicRuntime.py deb/opt/apps/deepin-wine-runner
|
||||
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 information.json deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallMono.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallMsxml.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallNetFramework.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallOther.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallVisualCPlusPlus.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv launch.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv LICENSE deb/opt/apps/deepin-wine-runner
|
||||
cp -rv mainwindow.py deb/opt/apps/deepin-wine-runner/deepin-wine-runner
|
||||
cp -rv package-script.zip deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Run.bat deb/opt/apps/deepin-wine-runner
|
||||
cp -rv RunVM.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv "wine install" deb/opt/apps/deepin-wine-runner
|
||||
cp -rv 窗体透明度设置工具.exe deb/opt/apps/deepin-wine-runner
|
||||
cp -rv UpdateGeek.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv AppStore.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallWineOnDeepin23.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv dxvk.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallFont.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv CheckDLL deb/opt/apps/deepin-wine-runner
|
||||
#cp -rv exagear.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv dlls-arm.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin.list deb/opt/apps/deepin-wine-runner
|
||||
cp -rv sparkstore.list deb/opt/apps/deepin-wine-runner
|
||||
cp -rv arm-package.7z deb/opt/apps/deepin-wine-runner
|
||||
#cp -rv exa.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv clean-unuse-program.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallNewWineHQ.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv cleanbottle.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv StartVM.sh deb/opt/apps/deepin-wine-runner
|
||||
#cp -rv deepin-wine-runner-create-botton.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Icon deb/opt/apps/deepin-wine-runner
|
||||
cp -rv ConfigLanguareRunner-help.json deb/opt/apps/deepin-wine-runner
|
||||
cp -rv gtkGetFileNameDlg deb/opt/apps/deepin-wine-runner
|
||||
cp -rv LANG/*.qm deb/opt/apps/deepin-wine-runner/LANG
|
||||
cp -rv InstallDll.py deb/opt/apps/deepin-wine-runner/LANG
|
||||
cp -rv ConfigLanguareRunner.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv AutoConfig.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv UI deb/opt/apps/deepin-wine-runner/
|
||||
cp -rv InstallDll.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Model deb/opt/apps/deepin-wine-runner
|
||||
cp -rv API deb/opt/apps/deepin-wine-runner
|
||||
cp -rv key deb/opt/apps/deepin-wine-runner
|
||||
dpkg -b deb spark-deepin-wine-runner.deb
|
||||
cp -rv req deb/opt/apps/deepin-wine-runner
|
||||
cp -rv BuildDesktop.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv ChangePassword.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv trans deb/opt/apps/deepin-wine-runner
|
||||
cp -rv RegShot deb/opt/apps/deepin-wine-runner
|
||||
cp -rv BeCyIconGrabber.exe deb/opt/apps/deepin-wine-runner
|
||||
cp -rv AutoShell deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-packager-with-script.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-packager.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-runner-update-bug deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-runner.svg deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin-wine-venturi-setter.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallVisualBasicRuntime.py deb/opt/apps/deepin-wine-runner
|
||||
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 ProgramFen.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv information.json deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallMono.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallMsxml.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallNetFramework.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallOther.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallVisualCPlusPlus.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv launch.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv LICENSE deb/opt/apps/deepin-wine-runner
|
||||
cp -rv mainwindow.py deb/opt/apps/deepin-wine-runner/deepin-wine-runner
|
||||
cp -rv package-script.zip deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Run.bat deb/opt/apps/deepin-wine-runner
|
||||
cp -rv RunVM.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv "wine install" deb/opt/apps/deepin-wine-runner
|
||||
cp -rv 窗体透明度设置工具.exe deb/opt/apps/deepin-wine-runner
|
||||
cp -rv UpdateGeek.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv AppStore.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallWineOnDeepin23.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv dxvk.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallFont.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv CheckDLL deb/opt/apps/deepin-wine-runner
|
||||
#cp -rv exagear.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv dlls-arm.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv deepin.list deb/opt/apps/deepin-wine-runner
|
||||
cp -rv sparkstore.list deb/opt/apps/deepin-wine-runner
|
||||
cp -rv arm-package.7z deb/opt/apps/deepin-wine-runner
|
||||
#cp -rv exa.7z deb/opt/apps/deepin-wine-runner
|
||||
cp -rv clean-unuse-program.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallNewWineHQ.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv cleanbottle.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv StartVM.sh deb/opt/apps/deepin-wine-runner
|
||||
#cp -rv deepin-wine-runner-create-botton.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Icon deb/opt/apps/deepin-wine-runner
|
||||
cp -rv ConfigLanguareRunner-help.json deb/opt/apps/deepin-wine-runner
|
||||
cp -rv gtkGetFileNameDlg deb/opt/apps/deepin-wine-runner
|
||||
cp -rv LANG/*.qm deb/opt/apps/deepin-wine-runner/LANG
|
||||
cp -rv InstallDll.py deb/opt/apps/deepin-wine-runner/LANG
|
||||
cp -rv ConfigLanguareRunner.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv AutoConfig.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv UI deb/opt/apps/deepin-wine-runner/
|
||||
cp -rv InstallDll.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Model deb/opt/apps/deepin-wine-runner
|
||||
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
|
||||
sudo chown -R root:root /tmp/spark-deepin-wine-runner-builder
|
||||
|
||||
dpkg -b /tmp/spark-deepin-wine-runner-builder spark-deepin-wine-runner.deb
|
||||
sudo rm -rfv /tmp/spark-deepin-wine-runner-builder
|
||||
|
||||
|
||||
install:
|
||||
@@ -87,11 +107,5 @@ install:
|
||||
remove:
|
||||
sudo apt purge spark-deepin-wine-runner
|
||||
|
||||
depend:
|
||||
sudo apt update
|
||||
sudo apt install python3 python3-pil python3-pil.imagetk\
|
||||
python3-pyquery deepin-terminal aria2 curl unrar unzip\
|
||||
python3-requests fakeroot bash python3-pyqt5
|
||||
|
||||
run:
|
||||
python3 mainwindow.py
|
||||
|
||||
BIN
Model/__pycache__/__init__.cpython-310.pyc
Executable file → Normal file
BIN
Model/__pycache__/__init__.cpython-36.pyc
Normal file
44
Mount.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
if [ ` whoami ` != "root" ]; then
|
||||
echo "Only root can run me"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "路径不存在!"
|
||||
exit 1
|
||||
fi
|
||||
echo $0
|
||||
echo $1
|
||||
echo $2
|
||||
echo $3
|
||||
# 挂载必备目录
|
||||
cd "$1"
|
||||
# 拷贝 Qemu Static
|
||||
cp -r /usr/bin/qemu-*-static ./usr/bin
|
||||
# 挂载目录
|
||||
mount --bind /dev ./dev
|
||||
#mount --bind /dev/pts ./dev/pts
|
||||
mount -t proc /proc ./proc
|
||||
mount --bind /etc/resolv.conf ./etc/resolv.conf
|
||||
mount -t sysfs /sys ./sys
|
||||
#mount --bind /dev/shm ./dev/shm
|
||||
chmod 777 -R root
|
||||
xhost +
|
||||
# 挂载 Wine 运行器目录
|
||||
mount -o bind `dirname $0` ./opt/apps/deepin-wine-runner/
|
||||
# 挂载字体
|
||||
mount -o bind /usr/share/fonts ./usr/share/fonts
|
||||
# 配置用户
|
||||
if [ ! -d "home/$2" ]; then
|
||||
# 新建用户,且密码为 123456,以便读写
|
||||
chroot . bash /opt/apps/deepin-wine-runner/ChangePassword.sh "$2"
|
||||
fi
|
||||
# 挂载用户目录到 /root(默认 $HOME 路径)
|
||||
if [[ $2 == "root" ]]; then
|
||||
mount --bind root "$1/root/"
|
||||
else
|
||||
mount --bind "/home/$2" "$1/home/$2"
|
||||
fi
|
||||
|
||||
# 如果参数 3 存在
|
||||
chroot "--userspec=$2:$2" . env "HOME=/home/$2" ${@:3}
|
||||
29
MountWithoutHome.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
if [ ` whoami ` != "root" ]; then
|
||||
echo "Only root can run me"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "路径不存在!"
|
||||
exit 1
|
||||
fi
|
||||
echo $0
|
||||
echo $1
|
||||
echo $2
|
||||
echo $3
|
||||
# 挂载必备目录
|
||||
cd "$1"
|
||||
# 拷贝 Qemu Static
|
||||
cp -r /usr/bin/qemu-*-static ./usr/bin
|
||||
# 挂载目录
|
||||
mount --bind /dev ./dev
|
||||
#mount --bind /dev/pts ./dev/pts
|
||||
mount -t proc /proc ./proc
|
||||
mount --bind /etc/resolv.conf ./etc/resolv.conf
|
||||
mount -t sysfs /sys ./sys
|
||||
#mount --bind /dev/shm ./dev/shm
|
||||
chmod 777 -R root
|
||||
xhost +
|
||||
|
||||
# 如果参数 3 存在
|
||||
chroot . ${@:3}
|
||||
122
ProgramFen.py
Executable 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(ProgramRunStatusShow.msgWindow)
|
||||
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, 1]:
|
||||
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(5)
|
||||
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(ProgramRunStatusUpload.msgWindow, 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(ProgramRunStatusUpload.msgWindow, 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_()
|
||||
438
QemuDownload.py
Executable file
@@ -0,0 +1,438 @@
|
||||
#!/usr/bin/env python3
|
||||
# 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写
|
||||
#########################################################################
|
||||
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布
|
||||
# 版本:2.4.0
|
||||
# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序
|
||||
# 基于 Python3 的 PyQt5 构建
|
||||
#########################################################################
|
||||
#################
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import shutil
|
||||
import random
|
||||
import sys
|
||||
import json
|
||||
import traceback
|
||||
import requests
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
sys.path.append(f"{programPath}/../")
|
||||
from Model import *
|
||||
from trans import *
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
# UI 布局(自动生成)
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(693, 404)
|
||||
if not get_now_lang() == "zh_CN.UTF-8":
|
||||
transla = Trans("en_US", f"{programPath}/trans/deepin-wine-runner-qemu-download.json")
|
||||
else:
|
||||
transla = Trans("zh_CN")
|
||||
_translate = transla.transe
|
||||
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")
|
||||
self.verticalLayout_2.addWidget(QtWidgets.QLabel(_translate("U", """使用前须知:
|
||||
1、Qemu 跨架构效率较低,如果有条件建议优先使用 box86、exagear 等效率较高的转换层;
|
||||
2、使用此方案需要使用到 Root 权限(需开启管理员模式)并安装 qemu-user-static;
|
||||
3、chroot 时候可能会出现问题导致程序闪退或异常,出现该问题重启电脑即可;
|
||||
4、在此环境使用 Wine 时,只能读取到您用户目录或本程序文件夹下的文件,其它路径无法读取;
|
||||
5、移除容器时请保证在这次打开电脑时没有调用过需要删除容器,如果有调用过建议重启电脑后再移除;
|
||||
6、暂时属于测试功能;""")))
|
||||
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)
|
||||
#self.addOtherWine = QtWidgets.QPushButton(self.centralWidget)
|
||||
#self.horizontalLayout.addWidget(self.addOtherWine)
|
||||
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)
|
||||
# 菜单栏
|
||||
#_translate = QtCore.QCoreApplication.translate
|
||||
|
||||
self.menu = MainWindow.menuBar()
|
||||
self.changeSources = self.menu.addMenu(_translate("MainWindow", "更换源"))
|
||||
self.gitlinkAction = QtWidgets.QAction(_translate("MainWindow", "Gitlink 源(推荐)"))
|
||||
self.ipv6Action = QtWidgets.QAction(_translate("MainWindow", "备用源(只支持 IPv6 用户)"))
|
||||
self.localAction = QtWidgets.QAction(_translate("MainWindow", "本地测试源(127.0.0.1)"))
|
||||
self.changeSources.addAction(self.gitlinkAction)
|
||||
self.changeSources.addAction(self.ipv6Action)
|
||||
self.changeSources.addAction(self.localAction)
|
||||
for i in [self.gitlinkAction, self.ipv6Action, self.localAction]:
|
||||
i.setCheckable(True)
|
||||
self.gitlinkAction.setChecked(True)
|
||||
self.changeSourcesGroup = QtWidgets.QActionGroup(MainWindow)
|
||||
self.changeSourcesGroup.addAction(self.gitlinkAction)
|
||||
self.changeSourcesGroup.addAction(self.ipv6Action)
|
||||
self.changeSourcesGroup.addAction(self.localAction)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "下载 Qemu 镜像"))
|
||||
self.addButton.setText(_translate("MainWindow", "<<"))
|
||||
self.delButton.setText(_translate("MainWindow", ">>"))
|
||||
#self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件"))
|
||||
#self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)"))
|
||||
#self.addOtherWine.setText(_translate("MainWindow", "导入自己的Wine"))
|
||||
|
||||
def ReadLocalInformation():
|
||||
try:
|
||||
global localJsonList
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.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()
|
||||
except:
|
||||
print("新建空列表")
|
||||
try:
|
||||
with open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "w") as file:
|
||||
file.write("[]")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
|
||||
|
||||
def InstallOtherWine():
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(window, "选择 Wine", os.getenv("~"), "wine(wine);;wine64(wine64);;全部文件(*.*)")
|
||||
if path[0] == "" or not path[1]:
|
||||
return
|
||||
try:
|
||||
# 写入配置文件
|
||||
rfile = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/winelist.json", "r")
|
||||
list = json.loads(rfile.read())
|
||||
rfile.close()
|
||||
# 创建映射
|
||||
name = os.path.basename(os.path.dirname(os.path.dirname(path[0])))
|
||||
if name == "" or name == None:
|
||||
name = f"useradd-wine-{random.randint(0, 99999)}"
|
||||
#binPath = os.path.dirname(os.path.dirname(path[0]))
|
||||
os.makedirs(f"{programPath}/{name}/bin")
|
||||
if os.system(f"ln -s '{path[0]}' '{programPath}/{name}/bin/wine'") != 0:
|
||||
QtWidgets.QMessageBox.critical(window, "新建wine映射失败")
|
||||
# C++ 版注释:不直接用 readwrite 是因为不能覆盖写入
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "w")
|
||||
list.append(name)
|
||||
file.write(json.dumps(list))
|
||||
file.close()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
|
||||
ReadLocalInformation()
|
||||
|
||||
def ChangeSources():
|
||||
global urlSources
|
||||
global internetWineSource
|
||||
sources = [ui.gitlinkAction, ui.ipv6Action, ui.localAction]
|
||||
for i in range(0, len(sources)):
|
||||
if sources[i].isChecked():
|
||||
urlSources = internetWineSourceList[i]
|
||||
internetWineSource = internetWineSourceList[i]
|
||||
# 读取信息
|
||||
ReadLocalInformation()
|
||||
ReadInternetInformation()
|
||||
break
|
||||
print(urlSources)
|
||||
|
||||
# 下面内容均翻译自 C++ 版本
|
||||
def ReadInternetInformation():
|
||||
global internetJsonList
|
||||
# C++ 版本是用 curl 的,考虑到 Python 用 requests 反而方便,于是不用 curl
|
||||
try:
|
||||
internetJsonList = json.loads(requests.get(f"{internetWineSource}/lists.json").text)
|
||||
internetJsonListNew = []
|
||||
for k in internetJsonList:
|
||||
archList = json.loads(requests.get(f"{internetWineSource}/{k}/lists.json").text)
|
||||
for e in archList:
|
||||
internetJsonListNew.append([e[0], e[1], k])
|
||||
internetJsonList = internetJsonListNew
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", "无法连接服务器!")
|
||||
return
|
||||
print(internetJsonList)
|
||||
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):
|
||||
global localJsonList
|
||||
try:
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.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()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
# 创建文件夹
|
||||
dir = QtCore.QDir()
|
||||
#savePath = f"{programPath}/{self.fileSaveName}"
|
||||
choose = ui.internetWineList.currentIndex().row()
|
||||
arch = internetJsonList[choose][2]
|
||||
savePath = f"{homePath}/.deepin-wine-runner-ubuntu-images/{arch}/{self.fileSaveName}"
|
||||
if not os.path.exists(os.path.dirname(savePath)):
|
||||
os.makedirs(os.path.dirname(savePath))
|
||||
# 文件下载
|
||||
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)
|
||||
self.ChangeDialog.emit(self.dialog, 100, 100, 100)
|
||||
# 写入配置文件
|
||||
rfile = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "r")
|
||||
list = json.loads(rfile.read())
|
||||
rfile.close()
|
||||
# C++ 版注释:不直接用 readwrite 是因为不能覆盖写入
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "w")
|
||||
list.append(self.fileSaveName.replace(".tar.gz", ""))
|
||||
file.write(json.dumps(list))
|
||||
file.close()
|
||||
# 读取配置文件
|
||||
self.ReadLocalInformation()
|
||||
self.localJsonList = list
|
||||
# 解压文件
|
||||
shellCommand = ""
|
||||
path = f"{homePath}/.deepin-wine-runner-ubuntu-images/{arch}/{self.fileSaveName.replace('.tar.gz', '')}/"
|
||||
#path = f"{programPath}/{self.fileSaveName.replace('.7z', '')}"
|
||||
shellCommand += f"""#!/bin/bash
|
||||
mkdir -p \"{path}\"
|
||||
tar -xvf \"{savePath}\" -C \"{path}\"
|
||||
rm \"{savePath}\"
|
||||
"""
|
||||
#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()
|
||||
OpenTerminal("bash /tmp/depein-wine-runner-wine-install.sh")
|
||||
self.Finish.emit()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
self.MessageBoxError.emit(traceback.format_exc())
|
||||
|
||||
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.replace(".tar.gz", "") == internetJsonList[choose][0]:
|
||||
QtWidgets.QMessageBox.information(window, "提示", "您已经安装了这个镜像了!无需重复安装!")
|
||||
return
|
||||
#if(ui.deleteZip.isChecked() + ui.unzip.isChecked() == 2):
|
||||
# ui.deleteZip.setChecked(False)
|
||||
# ui.unzip.setChecked(False)
|
||||
arch = internetJsonList[choose][2]
|
||||
downloadUrl = f"{internetWineSource}/{arch}/{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,
|
||||
False,
|
||||
not True,
|
||||
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 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:
|
||||
QtWidgets.QMessageBox.information(window, "提示", "您未选择任何项")
|
||||
return
|
||||
try:
|
||||
# {localJsonList[ui.localWineList.currentIndex().row()]}
|
||||
path = f"{homePath}/.deepin-wine-runner-ubuntu-images/"
|
||||
changed = False
|
||||
for i in os.listdir(path):
|
||||
if os.path.exists(f"{path}/{i}/{localJsonList[ui.localWineList.currentIndex().row()]}"):
|
||||
changed = True
|
||||
name = f"{path}/{i}/{localJsonList[ui.localWineList.currentIndex().row()]}".replace(".tar.gz", "")
|
||||
if not changed:
|
||||
name = f"{path}/i386/{localJsonList[ui.localWineList.currentIndex().row()]}".replace(".tar.gz", "")
|
||||
print(name)
|
||||
# 必须取消挂载目录才行
|
||||
os.system(f"bash '{programPath}/UnMount.sh' '{name}'")
|
||||
#name = f"{homePath}/.deepin-wine-runner-ubuntu-images/{localJsonList[ui.localWineList.currentIndex().row()]}"
|
||||
dir = QtCore.QDir(name)
|
||||
dir.removeRecursively()
|
||||
QtCore.QFile.remove(name + ".tar.gz")
|
||||
del localJsonList[ui.localWineList.currentIndex().row()]
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "w")
|
||||
file.write(json.dumps(localJsonList))
|
||||
file.close()
|
||||
ReadLocalInformation()
|
||||
QtWidgets.QMessageBox.information(window, "提示", "删除成功!")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
|
||||
|
||||
# 获取当前语言
|
||||
def get_now_lang()->"获取当前语言":
|
||||
return os.getenv('LANG')
|
||||
|
||||
if __name__ == "__main__":
|
||||
homePath = os.getenv("HOME")
|
||||
localJsonList = []
|
||||
internetJsonList = []
|
||||
internetWineSourceList = [
|
||||
"https://code.gitlink.org.cn/gfdgd_xi/deepin-wine-runner-ubuntu-image/raw/branch/master/Sandbox",
|
||||
"http://gfdgdxi.msns.cn/deepin-wine-runner-ubuntu-image/Sandbox", # 备用源,纯 IPv6 源
|
||||
"http://127.0.0.1/deepin-wine-runner-ubuntu-image/Sandbox/" # 本地测试源
|
||||
]
|
||||
internetWineSource = internetWineSourceList[0]
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
if os.system("which qemu-i386-static"):
|
||||
if QtWidgets.QMessageBox.question(None, "提示", "检测到您未安装 qemu-user-static,是否安装?") == QtWidgets.QMessageBox.Yes:
|
||||
OpenTerminal(f"pkexec bash '{programPath}/ShellList/InstallQemuUserStatic.sh'")
|
||||
exit()
|
||||
try:
|
||||
if not os.path.exists(f"{homePath}/.deepin-wine-runner-ubuntu-images/"):
|
||||
os.makedirs(f"{homePath}/.deepin-wine-runner-ubuntu-images/")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(None, "错误", traceback.format_exc())
|
||||
exit()
|
||||
# 读取翻译
|
||||
if not get_now_lang() == "zh_CN.UTF-8":
|
||||
trans = QtCore.QTranslator()
|
||||
trans.load(f"{programPath}/../LANG/installwine-en_US.qm")
|
||||
app.installTranslator(trans)
|
||||
# 窗口构建
|
||||
window = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
window.setWindowIcon(QtGui.QIcon(f"{programPath}/deepin-wine-runner.svg"))
|
||||
ui.setupUi(window)
|
||||
window.show()
|
||||
# 连接信号
|
||||
ui.addButton.clicked.connect(on_addButton_clicked)
|
||||
ui.delButton.clicked.connect(on_delButton_clicked)
|
||||
#ui.addOtherWine.clicked.connect(InstallOtherWine)
|
||||
ui.changeSourcesGroup.triggered.connect(ChangeSources)
|
||||
## 加载内容
|
||||
# 设置列表双击不会编辑
|
||||
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_()
|
||||
44
QemuRun.py
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import getpass
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
if __name__ == "__main__":
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
homePath = os.getenv("HOME")
|
||||
if len(sys.argv) <= 1:
|
||||
print("参数不足")
|
||||
sys.exit(1)
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
# 判断是否已下载镜像
|
||||
if not os.path.exists(f"{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}"):
|
||||
QtWidgets.QMessageBox.information(None, "提示", "此镜像未下载解压,无法继续")
|
||||
exit()
|
||||
commandList = ""
|
||||
userName = getpass.getuser()
|
||||
for i in sys.argv[3:]:
|
||||
commandList += f"'{i}' "
|
||||
if commandList.replace(" ", "") == "":
|
||||
commandList = "bash"
|
||||
# 需要先取消挂载其它目录以防止冲突
|
||||
path = f"{homePath}/.deepin-wine-runner-ubuntu-images"
|
||||
for i in os.listdir(path):
|
||||
archPath = f"{path}/{i}"
|
||||
if os.path.isdir(archPath):
|
||||
for k in os.listdir(archPath):
|
||||
bottlePath = f"{archPath}/{k}"
|
||||
if os.path.isdir(bottlePath):
|
||||
if f"{i}/{k}" == sys.argv[1]:
|
||||
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("文件暂未挂载,开始挂载")
|
||||
if int(sys.argv[2]):
|
||||
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash '{programPath}/MountWithoutHome.sh' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}' '{userName}' {commandList}"))
|
||||
else:
|
||||
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash '{programPath}/Mount.sh' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}' '{userName}' {commandList}"))
|
||||
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY chroot '--userspec={userName}:{userName}' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/' env 'HOME=/home/{userName}' {commandList}"))
|
||||
40
README.md
@@ -1,5 +1,5 @@
|
||||
<p width=100px align="center"><img src="https://storage.deepin.org/thread/202208031419283599_deepin-wine-runner.png"></p>
|
||||
<h1 align="center">Wine 运行器 2.5.0</h1>
|
||||
<h1 align="center">Wine 运行器 3.0.0</h1>
|
||||
<hr>
|
||||
|
||||
## 介绍
|
||||
@@ -11,8 +11,7 @@ env WINEPREFIX=容器路径 wine(wine的路径) 可执行文件路径
|
||||
```
|
||||
让你可以简易方便的使用 wine
|
||||
是使用 Python3 的 PyQt5 构建的
|
||||
(自己美术功底太差,图标只能在网络上找了)
|
||||
(测试平台:deepin 20.7.1;UOS 家庭版 21.3.1;Ubuntu 22.04;Ubuntu 20.04;UOS 专业版 1050;openkylin)
|
||||
(测试平台:deepin 20.8;UOS 家庭版 21.3.1;Ubuntu 22.04;Ubuntu 20.04;UOS 专业版 1050;openkylin)
|
||||

|
||||
而打包器可以方便的把您的 wine 容器打包成 deb 包供他人使用,程序创建的 deb 构建临时文件夹目录树如下:
|
||||
```bash
|
||||
@@ -38,17 +37,16 @@ env WINEPREFIX=容器路径 wine(wine的路径) 可执行文件路径
|
||||
|
||||
11 directories, 6 files
|
||||
```
|
||||
[](https://gitee.com/gfdgd-xi/deep-wine-runner/stargazers)
|
||||
最后感谢 [@鹤舞白沙](https://bbs.deepin.org/user/227203) 编写的《Wine运行器和Wine打包器傻瓜式使用教程(小白专用)》,链接:https://bbs.deepin.org/post/246837
|
||||
|
||||
## 软件架构
|
||||
i386、amd64 和 arm64,deepin-wine、deepin-wine5、wine、wine64、deepin-wine5-stable、deepin-wine6-stable、spark-wine7-devel、ukylin-wine 运行在哪就运行在哪
|
||||
理论上支持全架构,如果 Python 能运行的话
|
||||
非 X86 架构会利用到 `box86`、`exagear`等技术
|
||||
非 X86 架构会利用到 `box86`、`exagear`、`qemu` 等技术
|
||||
|
||||
## 分支介绍
|
||||
### main 分支
|
||||
主分支,稳定分支
|
||||
### Alpha 分支
|
||||
开发版分支,一般不稳定,有许多 bug
|
||||
|
||||
## 版本区分
|
||||
### 无特殊标识
|
||||
@@ -104,6 +102,32 @@ desktop文件中StartupWMClass字段。用于让桌面组件将窗口类名与de
|
||||

|
||||
|
||||
## 更新日志
|
||||
### 3.0.0(2022年12月10日)
|
||||
**※1、支持使用 Qemu + Chroot 跨运行 Wine 以及指定程序的功能;**
|
||||
**※2、提供了简易打包器以用于打包简易 deb;**
|
||||
**※3、支持下载配置过的 Qemu + Chroot 容器;**
|
||||
**※4、支持在隔离的 Chroot 容器内运行 Wine;**
|
||||
**※5、支持解压指定 deb 的内打包好的容器;**
|
||||
**※6、优化 Wine 列表显示;**
|
||||
**※7、新增程序论坛和教程入口;**
|
||||
**※8、程序公告功能;**
|
||||
**※9、新增程序评分功能;**
|
||||
**※10、新增解包 deb 内 Wine 容器功能;**
|
||||
**※11、新增 Vkd3d Proton 安装功能,更新 dxvk 版本至 2.0.0;**
|
||||
**※12、新增程序菜单栏部分栏目图标;**
|
||||
**※13、打包器支持按下 Shift + F1 查看指定选项提示;**
|
||||
14、优化非基于生态适配脚本的打包器内容自动填充功能;
|
||||
15、优化程序文案;
|
||||
16、新增日志翻译功能;
|
||||
17、程序进一步完善英语翻译(机翻);
|
||||
18、优化程序更新策略;
|
||||
19、优化日志分析功能;
|
||||
20、优化程序 UI。
|
||||

|
||||
|
||||
### 2.5.0.1(2022年11月25日)
|
||||
**※1、修复已知问题**
|
||||
|
||||
### 2.5.0(2022年11月25日)
|
||||
**※1、容器自动配置脚本 GUI 查看介绍使用 QWebEngineWidget,支持图片(非强制依赖,只做推荐);**
|
||||
**※2、不基于生态适配活动脚本打包器跟进 arm 架构 2022年11月11日的 Wine 微信打包方式;**
|
||||
@@ -469,6 +493,6 @@ Gitlink:https://www.gitlink.org.cn/gfdgd_xi/deep-wine-runner
|
||||
|
||||
## Star 一下吧
|
||||
开发不易,原创艰难,给一个 Star 吧,你的 Star 是我继续开发的动力
|
||||
[](https://gitee.com/gfdgd-xi/deep-wine-runner/stargazers)
|
||||

|
||||
|
||||
# ©2020-Now
|
||||
13
RemovePycacheFile.py
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
def Remove(path):
|
||||
for i in os.listdir(path):
|
||||
nowPath = f"{path}/{i}"
|
||||
if os.path.isdir(nowPath):
|
||||
if i == "__pycache__":
|
||||
os.system(f"rm -rfv '{nowPath}'")
|
||||
else:
|
||||
Remove(nowPath)
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
debPath = f"{programPath}/deb"
|
||||
Remove(debPath)
|
||||
4
RunVM.sh
@@ -8,10 +8,10 @@
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
cd `dirname $0`
|
||||
which VBoxManage1
|
||||
which VBoxManage
|
||||
if test $? == 0 ; then
|
||||
VM/VirtualMachine
|
||||
exit
|
||||
fi
|
||||
zenity --info --no-wrap --text="未安装 VirtualBox,请自行安装 VirtualBox 并重新运行"
|
||||
#./launch.sh deepin-terminal -C "pkexec apt install virtualbox-6.1 -y && zenity --info --text=\"安装完毕,关闭此对话框和安装终端重新运行程序即可\" --no-wrap" --keep-open
|
||||
#./launch.sh deepin-terminal -C "pkexec apt install virtualbox-6.1 -y && zenity --info --text=\"安装完毕,关闭此对话框和安装终端重新运行程序即可\" --no-wrap" --keep-open
|
||||
|
||||
3
ShellList/InstallQemuUserStatic.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
echo 开始安装 qemu-user-static
|
||||
pkexec apt update
|
||||
pkexec apt install qemu-user-static -y
|
||||
BIN
UI/__pycache__/KeyAddGui.cpython-37.pyc
Executable file → Normal file
37
UnMount.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
if [ ` whoami ` != "root" ]; then
|
||||
echo "Only root can run me"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "路径不存在!"
|
||||
exit 1
|
||||
fi
|
||||
echo $0
|
||||
echo $1
|
||||
echo $2
|
||||
#echo $3
|
||||
# 挂载必备目录
|
||||
cd "$1"
|
||||
umount ./dev
|
||||
umount ./dev/pts
|
||||
umount ./proc
|
||||
umount ./etc/resolv.conf
|
||||
umount ./sys
|
||||
umount ./dev/shm
|
||||
# 挂载 Wine 运行器目录
|
||||
umount ./opt
|
||||
umount ./opt/apps/deepin-wine-runner
|
||||
# 挂载字体
|
||||
umount ./usr/share/fonts
|
||||
# 挂载用户目录到 /root(默认 $HOME 路径)
|
||||
umount ./root
|
||||
for username in $(ls ./home)
|
||||
do
|
||||
echo ./home/$username
|
||||
umount ./home/$username
|
||||
# if [ -d ./home/$username/.deepinwine/$CONTAINER_NAME ]
|
||||
# then
|
||||
# rm -rf ./home/$username/.deepinwine/$CONTAINER_NAME
|
||||
# fi
|
||||
done
|
||||
BIN
Wine运行器和Wine打包器傻瓜式使用教程(小白专用)20221126-V2.pdf
Executable file
0
arm-package.7z
Normal file → Executable file
@@ -1,29 +1,40 @@
|
||||
Package: spark-deepin-wine-runner
|
||||
Version: 2.5.0
|
||||
Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿布呢
|
||||
Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner, https://github.com/gfdgd-xi/deep-wine-runner, https://gitlink.org.cn/gfdgd_xi/deep-wine-runner
|
||||
Version: 3.0.0.2
|
||||
Maintainer: gfdgd xi <3025613752@qq.com>
|
||||
Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner
|
||||
Architecture: all
|
||||
Severity: serious
|
||||
Certainty: possible
|
||||
Check: binaries
|
||||
Type: binary, udeb
|
||||
Priority: optional
|
||||
Depends: python3, python3-pil, python3-pil.imagetk, python3-pyquery, aria2, curl, unrar, unzip, python3-requests, fakeroot, bash, python3-pyqt5, python3-psutil, deepin-terminal | mate-terminal | gnome-terminal | xfce4-terminal, python3-dbus, python3-pip
|
||||
Recommends: winbind, wimtools
|
||||
Depends: python3, python3-pil, libc6, python3-pil.imagetk, python3-pyquery, aria2, curl, unrar, unzip, python3-requests, python3-pyqt5, python3-psutil, deepin-terminal | mate-terminal | gnome-terminal | xfce4-terminal, python3-dbus, python3-pip, p7zip-full, sudo
|
||||
Recommends: winbind, wimtools, python3-pyqt5.qtwebengine
|
||||
Section: utils
|
||||
Conflicts: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer
|
||||
Replaces: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer
|
||||
Installed-Size: 21844
|
||||
Conflicts: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer, spark-deepin-wine-runner-52
|
||||
Replaces: spark.deepin-venturi-setter, spark-deepin-wine5-application-packer, spark-deepin-wine-runner-52
|
||||
Installed-Size: 25856
|
||||
Description: gfdgd xi、为什么您不喜欢熊出没和阿布呢 制作的 wine 运行器
|
||||
2.5.0 更新内容:
|
||||
※1、容器自动配置脚本 GUI 查看介绍使用 QWebEngineWidget,支持图片(非强制依赖,只做推荐);
|
||||
※2、不基于生态适配活动脚本打包器跟进 arm 架构 2022年11月11日的 Wine 微信打包方式;
|
||||
※3、支持多图标的程序打包;
|
||||
※4、修复了安装更多 Wine 换源换了个寂寞的问题;
|
||||
※5、修复安装更多 Wine 重新安装后列表丢失的问题;
|
||||
※6、新增了对 Deepin 23 Alpha 优化的 Wine 安装器;
|
||||
※7、新增 Dll 名称查询功能,可以查询对应 Dll 的作用;
|
||||
※8、支持静态获取可执行文件可以调用的 Dll 并提供解决方案;
|
||||
※9、支持移除指定的 .desktop 快捷方式;
|
||||
※10、新增日志分析功能以及导出、上传日志功能;
|
||||
11、修复了不基于生态适配活动脚本打包器在选择 arm 打包架构下容器自动删除脚本取消勾选无用的问题;
|
||||
12、优化文案、新增友链;
|
||||
13、提供了部分组件的测试功能。
|
||||
更新时间:2022年11月25日
|
||||
3.0.0 更新内容:
|
||||
※1、支持使用 Qemu + Chroot 跨运行 Wine 以及指定程序的功能;
|
||||
※2、提供了简易打包器以用于打包简易 deb;
|
||||
※3、支持下载配置过的 Qemu + Chroot 容器;
|
||||
※4、支持在隔离的 Chroot 容器内运行 Wine;
|
||||
※5、支持解压指定 deb 的内打包好的容器;
|
||||
※6、优化 Wine 列表显示;
|
||||
※7、新增程序论坛和教程入口;
|
||||
※8、程序公告功能;
|
||||
※9、新增程序评分功能;
|
||||
※10、新增解包 deb 内 Wine 容器功能;
|
||||
※11、新增 Vkd3d Proton 安装功能,更新 dxvk 版本至 2.0.0;
|
||||
※12、新增程序菜单栏部分栏目图标;
|
||||
※13、打包器支持按下 Shift + F1 查看指定选项提示;
|
||||
14、优化非基于生态适配脚本的打包器内容自动填充功能;
|
||||
15、优化程序文案;
|
||||
16、新增日志翻译功能;
|
||||
17、程序进一步完善英语翻译(机翻);
|
||||
18、优化程序更新策略;
|
||||
19、优化日志分析功能;
|
||||
20、优化程序 UI。
|
||||
更新时间:2022年12月09日
|
||||
作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# 使用系统默认的 sh 运行
|
||||
#################################################################################################################
|
||||
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢
|
||||
# 版本:2.3.0
|
||||
# 版本:2.6.0
|
||||
# 更新时间:2022年10月02日
|
||||
# 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序
|
||||
# 基于 sh
|
||||
@@ -10,6 +10,7 @@
|
||||
# 非强制性的必应组件,所以成功不成功都行
|
||||
echo 安装组件
|
||||
python3 -m pip install --upgrade pynput --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple > /dev/null 2>&1 | true
|
||||
python3 -m pip install --upgrade xpinyin --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple > /dev/null 2>&1 | true
|
||||
echo 执行完成
|
||||
echo 移除旧组件
|
||||
if [ -d /opt/apps/deepin-wine-runner/arm-package ]; then
|
||||
@@ -48,9 +49,19 @@ if [ `arch` != "x86_64" ]; then
|
||||
rm -rf /opt/apps/deepin-wine-runner/InstallNewWineHQ.sh
|
||||
fi
|
||||
# 到时候切换 gpg 源会方便很多
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FD6EEA1F20CD4B27 > /dev/null 2>&1 | true
|
||||
apt update > /dev/null 2>&1 | true
|
||||
if [ -r /etc/apt/sources.list.d/better-dde.list ]; then
|
||||
if [ -d /usr/share/deepin-installer ]; then
|
||||
# 用于修复 Deepin Community Live CD Install 版签名过期的问题
|
||||
wget -P /tmp/gfdgd-xi-sources https://code.gitlink.org.cn/gfdgd_xi/gfdgd-xi-apt-mirrors/raw/branch/master/gpg.asc
|
||||
rm -rfv /etc/apt/trusted.gpg.d/gfdgdxi-list.gpg | true
|
||||
cp -v /tmp/gfdgd-xi-sources/gpg.asc.gpg /etc/apt/trusted.gpg.d/gfdgdxi-list.gpg
|
||||
# 用于修复 2022.11.25 Better DDE 导致的 Deepin Community Live CD Install 版问题
|
||||
# 移除 Better DDE 源
|
||||
rm -rfv /etc/apt/sources.list.d/better-dde.list
|
||||
apt update > /dev/null 2>&1 | true
|
||||
fi
|
||||
fi
|
||||
# 设置目录权限,让用户可读可写,方便后续删除组件
|
||||
chmod 777 -R /opt/apps/deepin-wine-runner
|
||||
# 向服务器返回安装数加1(不显示内容且忽略错误)
|
||||
curl https://304626p927.goho.co/spark-deepin-wine-runner/Install.php?Version=2.5.0 -s > /dev/null 2>&1 | true
|
||||
python3 /opt/apps/deepin-wine-runner/Download.py 3.0.0 > /dev/null 2>&1 | true
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import WineRunner
|
||||
WineRunner.Bash("a").runList([["thank"], ["version"]])
|
||||
#WineRunner.Bash("a").runCommand("thank")
|
||||
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
|
||||
5
deb/opt/apps/deepin-wine-runner/Download.py
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import base64
|
||||
import requests
|
||||
print(requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9JbnN0YWxsLnBocD9WZXJzaW9uPQ==").decode("utf-8") + sys.argv[1]).text)
|
||||
BIN
deb/opt/apps/deepin-wine-runner/GetEXEVersion.exe
Executable file
BIN
deb/opt/apps/deepin-wine-runner/Icon/Function/CHROOT.png
Executable file
|
After Width: | Height: | Size: 22 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Function/more-wine.png
Executable file
|
After Width: | Height: | Size: 62 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Function/wine.png
Executable file
|
After Width: | Height: | Size: 67 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Function/wine23A.png
Executable file
|
After Width: | Height: | Size: 75 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Function/wine23P.png
Executable file
|
After Width: | Height: | Size: 75 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Program/Windows虚拟机.png
Executable file
|
After Width: | Height: | Size: 63 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Program/webp2.png
Executable file
|
After Width: | Height: | Size: 84 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Program/webp3.png
Executable file
|
After Width: | Height: | Size: 85 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Program/wine打包器.png
Executable file
|
After Width: | Height: | Size: 67 KiB |
BIN
deb/opt/apps/deepin-wine-runner/Icon/Program/wine运行器.png
Executable file
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
29
deb/opt/apps/deepin-wine-runner/IconList.json
Executable file
@@ -0,0 +1,29 @@
|
||||
[
|
||||
[
|
||||
["QQ", "wineBottonPath/drive_c/Program Files/Tencent/QQ/Bin/QQ.exe"],
|
||||
["QQ", "wineBottonPath/drive_c/Program Files (x86)/Tencent/QQ/Bin/QQ.exe"],
|
||||
["TIM", "wineBottonPath/drive_c/Program Files/Tencent/TIM/Bin/TIM.exe"],
|
||||
["TIM", "wineBottonPath/drive_c/Program Files (x86)/Tencent/TIM/Bin/TIM.exe"]
|
||||
],
|
||||
[
|
||||
["cmd", "cmd"],
|
||||
["cmd", "cmd.exe"],
|
||||
["cmd", "wineBottonPath/drive_c/windows/system32/cmd.exe"],
|
||||
["Internet Explorer", "iexplore"],
|
||||
["Internet Explorer", "iexplore.exe"],
|
||||
["Internet Explorer", "wineBottonPath/drive_c/Program Files/Internet Explorer/iexplore.exe"],
|
||||
["Internet Explorer", "wineBottonPath/drive_c/Program Files (x86)/Internet Explorer/iexplore.exe"],
|
||||
["微信", "wineBottonPath/drive_c/Program Files/Tencent/WeChat/WeChat.exe"],
|
||||
["微信", "wineBottonPath/drive_c/Program Files (x86)/Tencent/WeChat/WeChat.exe"],
|
||||
["UltraISO", "wineBottonPath/drive_c/Program Files/UltraISO/UltraISO.exe"],
|
||||
["UltraISO", "wineBottonPath/drive_c/Program Files (x86)/UltraISO/UltraISO.exe"],
|
||||
["迅雷", "wineBottonPath/drive_c/Program Files/Thunder Network/MiniThunder/Bin/ThunderMini.exe"],
|
||||
["迅雷", "wineBottonPath/drive_c/Program Files (x86)/Thunder Network/MiniThunder/Bin/ThunderMini.exe"],
|
||||
["Microsoft Office Word", "wineBottonPath/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE"],
|
||||
["Microsoft Office Word", "wineBottonPath/drive_c/Program Files (x86)/Microsoft Office/Office12/WINWORD.EXE"],
|
||||
["腾讯会议", "wineBottonPath/drive_c/Program Files/Tencent/WeMeet/wemeetapp.exe"],
|
||||
["腾讯会议", "wineBottonPath/drive_c/Program Files (x86)/Tencent/WeMeet/wemeetapp.exe"],
|
||||
["腾讯课堂", "wineBottonPath/drive_c/Program Files/Tencent/EDU/bin/TXEDU.exe"],
|
||||
["腾讯课堂", "wineBottonPath/drive_c/Program Files (x86)/Tencent/EDU/bin/TXEDU.exe"]
|
||||
]
|
||||
]
|
||||
44
deb/opt/apps/deepin-wine-runner/Mount.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
if [ ` whoami ` != "root" ]; then
|
||||
echo "Only root can run me"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "路径不存在!"
|
||||
exit 1
|
||||
fi
|
||||
echo $0
|
||||
echo $1
|
||||
echo $2
|
||||
echo $3
|
||||
# 挂载必备目录
|
||||
cd "$1"
|
||||
# 拷贝 Qemu Static
|
||||
cp -r /usr/bin/qemu-*-static ./usr/bin
|
||||
# 挂载目录
|
||||
mount --bind /dev ./dev
|
||||
#mount --bind /dev/pts ./dev/pts
|
||||
mount -t proc /proc ./proc
|
||||
mount --bind /etc/resolv.conf ./etc/resolv.conf
|
||||
mount -t sysfs /sys ./sys
|
||||
#mount --bind /dev/shm ./dev/shm
|
||||
chmod 777 -R root
|
||||
xhost +
|
||||
# 挂载 Wine 运行器目录
|
||||
mount -o bind `dirname $0` ./opt/apps/deepin-wine-runner/
|
||||
# 挂载字体
|
||||
mount -o bind /usr/share/fonts ./usr/share/fonts
|
||||
# 配置用户
|
||||
if [ ! -d "home/$2" ]; then
|
||||
# 新建用户,且密码为 123456,以便读写
|
||||
chroot . bash /opt/apps/deepin-wine-runner/ChangePassword.sh "$2"
|
||||
fi
|
||||
# 挂载用户目录到 /root(默认 $HOME 路径)
|
||||
if [[ $2 == "root" ]]; then
|
||||
mount --bind root "$1/root/"
|
||||
else
|
||||
mount --bind "/home/$2" "$1/home/$2"
|
||||
fi
|
||||
|
||||
# 如果参数 3 存在
|
||||
chroot "--userspec=$2:$2" . env "HOME=/home/$2" ${@:3}
|
||||
29
deb/opt/apps/deepin-wine-runner/MountWithoutHome.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
if [ ` whoami ` != "root" ]; then
|
||||
echo "Only root can run me"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "路径不存在!"
|
||||
exit 1
|
||||
fi
|
||||
echo $0
|
||||
echo $1
|
||||
echo $2
|
||||
echo $3
|
||||
# 挂载必备目录
|
||||
cd "$1"
|
||||
# 拷贝 Qemu Static
|
||||
cp -r /usr/bin/qemu-*-static ./usr/bin
|
||||
# 挂载目录
|
||||
mount --bind /dev ./dev
|
||||
#mount --bind /dev/pts ./dev/pts
|
||||
mount -t proc /proc ./proc
|
||||
mount --bind /etc/resolv.conf ./etc/resolv.conf
|
||||
mount -t sysfs /sys ./sys
|
||||
#mount --bind /dev/shm ./dev/shm
|
||||
chmod 777 -R root
|
||||
xhost +
|
||||
|
||||
# 如果参数 3 存在
|
||||
chroot . ${@:3}
|
||||
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(ProgramRunStatusShow.msgWindow)
|
||||
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, 1]:
|
||||
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(5)
|
||||
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(ProgramRunStatusUpload.msgWindow, 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(ProgramRunStatusUpload.msgWindow, 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_()
|
||||
438
deb/opt/apps/deepin-wine-runner/QemuDownload.py
Executable file
@@ -0,0 +1,438 @@
|
||||
#!/usr/bin/env python3
|
||||
# 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写
|
||||
#########################################################################
|
||||
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布
|
||||
# 版本:2.4.0
|
||||
# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序
|
||||
# 基于 Python3 的 PyQt5 构建
|
||||
#########################################################################
|
||||
#################
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import shutil
|
||||
import random
|
||||
import sys
|
||||
import json
|
||||
import traceback
|
||||
import requests
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
sys.path.append(f"{programPath}/../")
|
||||
from Model import *
|
||||
from trans import *
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
# UI 布局(自动生成)
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(693, 404)
|
||||
if not get_now_lang() == "zh_CN.UTF-8":
|
||||
transla = Trans("en_US", f"{programPath}/trans/deepin-wine-runner-qemu-download.json")
|
||||
else:
|
||||
transla = Trans("zh_CN")
|
||||
_translate = transla.transe
|
||||
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")
|
||||
self.verticalLayout_2.addWidget(QtWidgets.QLabel(_translate("U", """使用前须知:
|
||||
1、Qemu 跨架构效率较低,如果有条件建议优先使用 box86、exagear 等效率较高的转换层;
|
||||
2、使用此方案需要使用到 Root 权限(需开启管理员模式)并安装 qemu-user-static;
|
||||
3、chroot 时候可能会出现问题导致程序闪退或异常,出现该问题重启电脑即可;
|
||||
4、在此环境使用 Wine 时,只能读取到您用户目录或本程序文件夹下的文件,其它路径无法读取;
|
||||
5、移除容器时请保证在这次打开电脑时没有调用过需要删除容器,如果有调用过建议重启电脑后再移除;
|
||||
6、暂时属于测试功能;""")))
|
||||
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)
|
||||
#self.addOtherWine = QtWidgets.QPushButton(self.centralWidget)
|
||||
#self.horizontalLayout.addWidget(self.addOtherWine)
|
||||
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)
|
||||
# 菜单栏
|
||||
#_translate = QtCore.QCoreApplication.translate
|
||||
|
||||
self.menu = MainWindow.menuBar()
|
||||
self.changeSources = self.menu.addMenu(_translate("MainWindow", "更换源"))
|
||||
self.gitlinkAction = QtWidgets.QAction(_translate("MainWindow", "Gitlink 源(推荐)"))
|
||||
self.ipv6Action = QtWidgets.QAction(_translate("MainWindow", "备用源(只支持 IPv6 用户)"))
|
||||
self.localAction = QtWidgets.QAction(_translate("MainWindow", "本地测试源(127.0.0.1)"))
|
||||
self.changeSources.addAction(self.gitlinkAction)
|
||||
self.changeSources.addAction(self.ipv6Action)
|
||||
self.changeSources.addAction(self.localAction)
|
||||
for i in [self.gitlinkAction, self.ipv6Action, self.localAction]:
|
||||
i.setCheckable(True)
|
||||
self.gitlinkAction.setChecked(True)
|
||||
self.changeSourcesGroup = QtWidgets.QActionGroup(MainWindow)
|
||||
self.changeSourcesGroup.addAction(self.gitlinkAction)
|
||||
self.changeSourcesGroup.addAction(self.ipv6Action)
|
||||
self.changeSourcesGroup.addAction(self.localAction)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "下载 Qemu 镜像"))
|
||||
self.addButton.setText(_translate("MainWindow", "<<"))
|
||||
self.delButton.setText(_translate("MainWindow", ">>"))
|
||||
#self.unzip.setText(_translate("MainWindow", "不解压Wine资源文件"))
|
||||
#self.deleteZip.setText(_translate("MainWindow", "删除下载的资源包,只解压保留(两个选项都选相互抵消)"))
|
||||
#self.addOtherWine.setText(_translate("MainWindow", "导入自己的Wine"))
|
||||
|
||||
def ReadLocalInformation():
|
||||
try:
|
||||
global localJsonList
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.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()
|
||||
except:
|
||||
print("新建空列表")
|
||||
try:
|
||||
with open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "w") as file:
|
||||
file.write("[]")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
|
||||
|
||||
def InstallOtherWine():
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(window, "选择 Wine", os.getenv("~"), "wine(wine);;wine64(wine64);;全部文件(*.*)")
|
||||
if path[0] == "" or not path[1]:
|
||||
return
|
||||
try:
|
||||
# 写入配置文件
|
||||
rfile = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/winelist.json", "r")
|
||||
list = json.loads(rfile.read())
|
||||
rfile.close()
|
||||
# 创建映射
|
||||
name = os.path.basename(os.path.dirname(os.path.dirname(path[0])))
|
||||
if name == "" or name == None:
|
||||
name = f"useradd-wine-{random.randint(0, 99999)}"
|
||||
#binPath = os.path.dirname(os.path.dirname(path[0]))
|
||||
os.makedirs(f"{programPath}/{name}/bin")
|
||||
if os.system(f"ln -s '{path[0]}' '{programPath}/{name}/bin/wine'") != 0:
|
||||
QtWidgets.QMessageBox.critical(window, "新建wine映射失败")
|
||||
# C++ 版注释:不直接用 readwrite 是因为不能覆盖写入
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "w")
|
||||
list.append(name)
|
||||
file.write(json.dumps(list))
|
||||
file.close()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
|
||||
ReadLocalInformation()
|
||||
|
||||
def ChangeSources():
|
||||
global urlSources
|
||||
global internetWineSource
|
||||
sources = [ui.gitlinkAction, ui.ipv6Action, ui.localAction]
|
||||
for i in range(0, len(sources)):
|
||||
if sources[i].isChecked():
|
||||
urlSources = internetWineSourceList[i]
|
||||
internetWineSource = internetWineSourceList[i]
|
||||
# 读取信息
|
||||
ReadLocalInformation()
|
||||
ReadInternetInformation()
|
||||
break
|
||||
print(urlSources)
|
||||
|
||||
# 下面内容均翻译自 C++ 版本
|
||||
def ReadInternetInformation():
|
||||
global internetJsonList
|
||||
# C++ 版本是用 curl 的,考虑到 Python 用 requests 反而方便,于是不用 curl
|
||||
try:
|
||||
internetJsonList = json.loads(requests.get(f"{internetWineSource}/lists.json").text)
|
||||
internetJsonListNew = []
|
||||
for k in internetJsonList:
|
||||
archList = json.loads(requests.get(f"{internetWineSource}/{k}/lists.json").text)
|
||||
for e in archList:
|
||||
internetJsonListNew.append([e[0], e[1], k])
|
||||
internetJsonList = internetJsonListNew
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", "无法连接服务器!")
|
||||
return
|
||||
print(internetJsonList)
|
||||
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):
|
||||
global localJsonList
|
||||
try:
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.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()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
# 创建文件夹
|
||||
dir = QtCore.QDir()
|
||||
#savePath = f"{programPath}/{self.fileSaveName}"
|
||||
choose = ui.internetWineList.currentIndex().row()
|
||||
arch = internetJsonList[choose][2]
|
||||
savePath = f"{homePath}/.deepin-wine-runner-ubuntu-images/{arch}/{self.fileSaveName}"
|
||||
if not os.path.exists(os.path.dirname(savePath)):
|
||||
os.makedirs(os.path.dirname(savePath))
|
||||
# 文件下载
|
||||
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)
|
||||
self.ChangeDialog.emit(self.dialog, 100, 100, 100)
|
||||
# 写入配置文件
|
||||
rfile = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "r")
|
||||
list = json.loads(rfile.read())
|
||||
rfile.close()
|
||||
# C++ 版注释:不直接用 readwrite 是因为不能覆盖写入
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "w")
|
||||
list.append(self.fileSaveName.replace(".tar.gz", ""))
|
||||
file.write(json.dumps(list))
|
||||
file.close()
|
||||
# 读取配置文件
|
||||
self.ReadLocalInformation()
|
||||
self.localJsonList = list
|
||||
# 解压文件
|
||||
shellCommand = ""
|
||||
path = f"{homePath}/.deepin-wine-runner-ubuntu-images/{arch}/{self.fileSaveName.replace('.tar.gz', '')}/"
|
||||
#path = f"{programPath}/{self.fileSaveName.replace('.7z', '')}"
|
||||
shellCommand += f"""#!/bin/bash
|
||||
mkdir -p \"{path}\"
|
||||
tar -xvf \"{savePath}\" -C \"{path}\"
|
||||
rm \"{savePath}\"
|
||||
"""
|
||||
#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()
|
||||
OpenTerminal("bash /tmp/depein-wine-runner-wine-install.sh")
|
||||
self.Finish.emit()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
self.MessageBoxError.emit(traceback.format_exc())
|
||||
|
||||
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.replace(".tar.gz", "") == internetJsonList[choose][0]:
|
||||
QtWidgets.QMessageBox.information(window, "提示", "您已经安装了这个镜像了!无需重复安装!")
|
||||
return
|
||||
#if(ui.deleteZip.isChecked() + ui.unzip.isChecked() == 2):
|
||||
# ui.deleteZip.setChecked(False)
|
||||
# ui.unzip.setChecked(False)
|
||||
arch = internetJsonList[choose][2]
|
||||
downloadUrl = f"{internetWineSource}/{arch}/{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,
|
||||
False,
|
||||
not True,
|
||||
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 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:
|
||||
QtWidgets.QMessageBox.information(window, "提示", "您未选择任何项")
|
||||
return
|
||||
try:
|
||||
# {localJsonList[ui.localWineList.currentIndex().row()]}
|
||||
path = f"{homePath}/.deepin-wine-runner-ubuntu-images/"
|
||||
changed = False
|
||||
for i in os.listdir(path):
|
||||
if os.path.exists(f"{path}/{i}/{localJsonList[ui.localWineList.currentIndex().row()]}"):
|
||||
changed = True
|
||||
name = f"{path}/{i}/{localJsonList[ui.localWineList.currentIndex().row()]}".replace(".tar.gz", "")
|
||||
if not changed:
|
||||
name = f"{path}/i386/{localJsonList[ui.localWineList.currentIndex().row()]}".replace(".tar.gz", "")
|
||||
print(name)
|
||||
# 必须取消挂载目录才行
|
||||
os.system(f"bash '{programPath}/UnMount.sh' '{name}'")
|
||||
#name = f"{homePath}/.deepin-wine-runner-ubuntu-images/{localJsonList[ui.localWineList.currentIndex().row()]}"
|
||||
dir = QtCore.QDir(name)
|
||||
dir.removeRecursively()
|
||||
QtCore.QFile.remove(name + ".tar.gz")
|
||||
del localJsonList[ui.localWineList.currentIndex().row()]
|
||||
file = open(f"{homePath}/.deepin-wine-runner-ubuntu-images/lists.json", "w")
|
||||
file.write(json.dumps(localJsonList))
|
||||
file.close()
|
||||
ReadLocalInformation()
|
||||
QtWidgets.QMessageBox.information(window, "提示", "删除成功!")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(window, "错误", traceback.format_exc())
|
||||
|
||||
# 获取当前语言
|
||||
def get_now_lang()->"获取当前语言":
|
||||
return os.getenv('LANG')
|
||||
|
||||
if __name__ == "__main__":
|
||||
homePath = os.getenv("HOME")
|
||||
localJsonList = []
|
||||
internetJsonList = []
|
||||
internetWineSourceList = [
|
||||
"https://code.gitlink.org.cn/gfdgd_xi/deepin-wine-runner-ubuntu-image/raw/branch/master/Sandbox",
|
||||
"http://gfdgdxi.msns.cn/deepin-wine-runner-ubuntu-image/Sandbox", # 备用源,纯 IPv6 源
|
||||
"http://127.0.0.1/deepin-wine-runner-ubuntu-image/Sandbox/" # 本地测试源
|
||||
]
|
||||
internetWineSource = internetWineSourceList[0]
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
if os.system("which qemu-i386-static"):
|
||||
if QtWidgets.QMessageBox.question(None, "提示", "检测到您未安装 qemu-user-static,是否安装?") == QtWidgets.QMessageBox.Yes:
|
||||
OpenTerminal(f"pkexec bash '{programPath}/ShellList/InstallQemuUserStatic.sh'")
|
||||
exit()
|
||||
try:
|
||||
if not os.path.exists(f"{homePath}/.deepin-wine-runner-ubuntu-images/"):
|
||||
os.makedirs(f"{homePath}/.deepin-wine-runner-ubuntu-images/")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(None, "错误", traceback.format_exc())
|
||||
exit()
|
||||
# 读取翻译
|
||||
if not get_now_lang() == "zh_CN.UTF-8":
|
||||
trans = QtCore.QTranslator()
|
||||
trans.load(f"{programPath}/../LANG/installwine-en_US.qm")
|
||||
app.installTranslator(trans)
|
||||
# 窗口构建
|
||||
window = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
window.setWindowIcon(QtGui.QIcon(f"{programPath}/deepin-wine-runner.svg"))
|
||||
ui.setupUi(window)
|
||||
window.show()
|
||||
# 连接信号
|
||||
ui.addButton.clicked.connect(on_addButton_clicked)
|
||||
ui.delButton.clicked.connect(on_delButton_clicked)
|
||||
#ui.addOtherWine.clicked.connect(InstallOtherWine)
|
||||
ui.changeSourcesGroup.triggered.connect(ChangeSources)
|
||||
## 加载内容
|
||||
# 设置列表双击不会编辑
|
||||
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_()
|
||||
44
deb/opt/apps/deepin-wine-runner/QemuRun.py
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import getpass
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
if __name__ == "__main__":
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
homePath = os.getenv("HOME")
|
||||
if len(sys.argv) <= 1:
|
||||
print("参数不足")
|
||||
sys.exit(1)
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
# 判断是否已下载镜像
|
||||
if not os.path.exists(f"{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}"):
|
||||
QtWidgets.QMessageBox.information(None, "提示", "此镜像未下载解压,无法继续")
|
||||
exit()
|
||||
commandList = ""
|
||||
userName = getpass.getuser()
|
||||
for i in sys.argv[3:]:
|
||||
commandList += f"'{i}' "
|
||||
if commandList.replace(" ", "") == "":
|
||||
commandList = "bash"
|
||||
# 需要先取消挂载其它目录以防止冲突
|
||||
path = f"{homePath}/.deepin-wine-runner-ubuntu-images"
|
||||
for i in os.listdir(path):
|
||||
archPath = f"{path}/{i}"
|
||||
if os.path.isdir(archPath):
|
||||
for k in os.listdir(archPath):
|
||||
bottlePath = f"{archPath}/{k}"
|
||||
if os.path.isdir(bottlePath):
|
||||
if f"{i}/{k}" == sys.argv[1]:
|
||||
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("文件暂未挂载,开始挂载")
|
||||
if int(sys.argv[2]):
|
||||
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash '{programPath}/MountWithoutHome.sh' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}' '{userName}' {commandList}"))
|
||||
else:
|
||||
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash '{programPath}/Mount.sh' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}' '{userName}' {commandList}"))
|
||||
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY chroot '--userspec={userName}:{userName}' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/' env 'HOME=/home/{userName}' {commandList}"))
|
||||
@@ -8,10 +8,10 @@
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
cd `dirname $0`
|
||||
which VBoxManage1
|
||||
which VBoxManage
|
||||
if test $? == 0 ; then
|
||||
VM/VirtualMachine
|
||||
exit
|
||||
fi
|
||||
zenity --info --no-wrap --text="未安装 VirtualBox,请自行安装 VirtualBox 并重新运行"
|
||||
#./launch.sh deepin-terminal -C "pkexec apt install virtualbox-6.1 -y && zenity --info --text=\"安装完毕,关闭此对话框和安装终端重新运行程序即可\" --no-wrap" --keep-open
|
||||
#./launch.sh deepin-terminal -C "pkexec apt install virtualbox-6.1 -y && zenity --info --text=\"安装完毕,关闭此对话框和安装终端重新运行程序即可\" --no-wrap" --keep-open
|
||||
|
||||
3
deb/opt/apps/deepin-wine-runner/ShellList/InstallQemuUserStatic.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
echo 开始安装 qemu-user-static
|
||||
pkexec apt update
|
||||
pkexec apt install qemu-user-static -y
|
||||
37
deb/opt/apps/deepin-wine-runner/UnMount.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
if [ ` whoami ` != "root" ]; then
|
||||
echo "Only root can run me"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "路径不存在!"
|
||||
exit 1
|
||||
fi
|
||||
echo $0
|
||||
echo $1
|
||||
echo $2
|
||||
#echo $3
|
||||
# 挂载必备目录
|
||||
cd "$1"
|
||||
umount ./dev
|
||||
umount ./dev/pts
|
||||
umount ./proc
|
||||
umount ./etc/resolv.conf
|
||||
umount ./sys
|
||||
umount ./dev/shm
|
||||
# 挂载 Wine 运行器目录
|
||||
umount ./opt
|
||||
umount ./opt/apps/deepin-wine-runner
|
||||
# 挂载字体
|
||||
umount ./usr/share/fonts
|
||||
# 挂载用户目录到 /root(默认 $HOME 路径)
|
||||
umount ./root
|
||||
for username in $(ls ./home)
|
||||
do
|
||||
echo ./home/$username
|
||||
umount ./home/$username
|
||||
# if [ -d ./home/$username/.deepinwine/$CONTAINER_NAME ]
|
||||
# then
|
||||
# rm -rf ./home/$username/.deepinwine/$CONTAINER_NAME
|
||||
# fi
|
||||
done
|
||||
648
deb/opt/apps/deepin-wine-runner/deepin-wine-easy-packager.py
Executable file
@@ -0,0 +1,648 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import random
|
||||
import xpinyin
|
||||
import traceback
|
||||
import subprocess
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
def ShowText(text: str):
|
||||
if text.replace(" ", "").replace("\n", "") == "":
|
||||
return
|
||||
logText.append(text.replace("\n", ""))
|
||||
|
||||
def ErrorMessage(text: str):
|
||||
QtWidgets.QMessageBox.critical(window, "错误", text)
|
||||
|
||||
def InformationMessage(text: str):
|
||||
QtWidgets.QMessageBox.information(window, "提示", text)
|
||||
|
||||
questionChoose = False
|
||||
questionStatus = False
|
||||
def QuestionMessage(text: str):
|
||||
global questionChoose
|
||||
global questionStatus
|
||||
# 清零
|
||||
questionChoose = False
|
||||
questionStatus = False
|
||||
if QtWidgets.QMessageBox.question(window, "提示", text) == QtWidgets.QMessageBox.Yes:
|
||||
questionChoose = True
|
||||
print(questionChoose)
|
||||
questionStatus = True
|
||||
return
|
||||
questionChoose = False
|
||||
questionStatus = True
|
||||
|
||||
|
||||
def DisbledAndEnabledAll(choose: bool):
|
||||
exePath.setDisabled(choose)
|
||||
browserExeButton.setDisabled(choose)
|
||||
buildButton.setDisabled(choose)
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
def get_desktop_path():
|
||||
try:
|
||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||
if desktop_index != -1: # 如果有对应项
|
||||
break # 结束循环
|
||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||
return -1
|
||||
else:
|
||||
get = line[17:-2] # 截取桌面目录路径
|
||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||
if get != -1: # 如果有
|
||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||
return get # 返回目录
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return get_home()
|
||||
|
||||
def CleanPressCompleteDownloadState(option):
|
||||
global pressCompleteDownload
|
||||
pressCompleteDownload = False
|
||||
installCmpleteButton.setEnabled(True)
|
||||
|
||||
# 读取 lnk 文件
|
||||
def GetLnkDesktop(path):
|
||||
lnkList = []
|
||||
for i in os.listdir(path):
|
||||
filePath = f"{path}/{i}"
|
||||
if os.path.islink(filePath):
|
||||
# 忽略 link 链接
|
||||
continue
|
||||
if os.path.isdir(filePath):
|
||||
lists = GetLnkDesktop(filePath)
|
||||
for k in lists:
|
||||
lnkList.append(k)
|
||||
continue
|
||||
if os.path.isfile(filePath) and os.path.splitext(filePath)[1] == ".lnk":
|
||||
with open(filePath, "rb") as file:
|
||||
while True:
|
||||
things = file.readline().lower()
|
||||
if things == b"":
|
||||
break
|
||||
print(things[1: -2].split("\x00".encode("gbk")))
|
||||
for k in things[1: -2].split("\x00".encode("gbk")):
|
||||
if "c:".encode("gbk") in k:
|
||||
print(k.decode("gbk"))
|
||||
lnkList.append([filePath, k.decode("gbk")])
|
||||
return lnkList
|
||||
|
||||
def ReplaceText(string: str, lists: list):
|
||||
for i in lists:
|
||||
string = string.replace(i[0], i[1])
|
||||
return string
|
||||
|
||||
control = '''Package: @@@Package@@@
|
||||
Version: @@@Version@@@
|
||||
Architecture: i386
|
||||
Maintainer: @@@Maintainer@@@
|
||||
Depends: @@@Depends@@@
|
||||
Section: non-free/otherosfs
|
||||
Priority: optional
|
||||
Multi-Arch: foreign
|
||||
Installed-Size: @@@Installed-Size@@@
|
||||
Description: @@@Description@@@
|
||||
'''
|
||||
|
||||
info = f'''{{
|
||||
"appid": "@@@Package@@@",
|
||||
"name": "@@@Name@@@",
|
||||
"version": "@@@Version@@@",
|
||||
"arch": ["i386"],
|
||||
"permissions": {{
|
||||
"autostart": false,
|
||||
"notification": false,
|
||||
"trayicon": true,
|
||||
"clipboard": true,
|
||||
"account": false,
|
||||
"bluetooth": false,
|
||||
"camera": true,
|
||||
"audio_record": true,
|
||||
"installed_apps": false
|
||||
}}
|
||||
}}'''
|
||||
|
||||
postrm = f"""#!/bin/bash
|
||||
if [ "$1" = "remove" ] || [ "$1" = "purge" ];then
|
||||
|
||||
echo "清理卸载残留"
|
||||
CONTAINER_NAME="@@@Package@@@"
|
||||
|
||||
if [ -z $CONTAINER_NAME ];then
|
||||
echo "W: 没有指定容器,跳过清理容器。请手动前往 ~/.deepinwine/ 下删除"
|
||||
exit
|
||||
fi
|
||||
|
||||
/opt/deepinwine/tools/kill.sh $CONTAINER_NAME
|
||||
###这里注意,如果没写CONTAINER_NAME,会把QQ杀了
|
||||
|
||||
for username in $(ls /home)
|
||||
do
|
||||
echo /home/$username
|
||||
if [ -d /home/$username/.deepinwine/$CONTAINER_NAME ]
|
||||
then
|
||||
rm -rf /home/$username/.deepinwine/$CONTAINER_NAME
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "非卸载,跳过清理"
|
||||
fi"""
|
||||
|
||||
runsh = f'''#!/bin/sh
|
||||
|
||||
# Copyright (C) 2016 Deepin, Inc.
|
||||
#
|
||||
# Author: Li LongYu <lilongyu@linuxdeepin.com>
|
||||
# Peng Hao <penghao@linuxdeepin.com>
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2022 The Spark Project
|
||||
#
|
||||
#
|
||||
# Modifier shenmo <shenmo@spark-app.store>
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
#######################函数段。下文调用的额外功能会在此处声明
|
||||
|
||||
Get_Dist_Name()
|
||||
{{
|
||||
if grep -Eqii "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then
|
||||
DISTRO='Deepin'
|
||||
elif grep -Eqi "UnionTech" /etc/issue || grep -Eq "UnionTech" /etc/*-release; then
|
||||
DISTRO='UniontechOS'
|
||||
else
|
||||
DISTRO='OtherOS'
|
||||
fi
|
||||
}}
|
||||
|
||||
|
||||
####获得发行版名称
|
||||
|
||||
#########################预设值段
|
||||
|
||||
version_gt() {{ test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }}
|
||||
####用于比较版本?未实装
|
||||
BOTTLENAME="@@@Package@@@"
|
||||
APPVER="@@@Version@@@"
|
||||
EXEC_PATH="@@@EXEC_PATH@@@"
|
||||
##### 软件在wine中的启动路径
|
||||
START_SHELL_PATH="/opt/deepinwine/tools/spark_run_v4.sh"
|
||||
export MIME_TYPE=""
|
||||
#####没什么用
|
||||
export DEB_PACKAGE_NAME="@@@Package@@@"
|
||||
####这里写包名才能在启动的时候正确找到files.7z,似乎也和杀残留进程有关
|
||||
export APPRUN_CMD="deepin-wine6-stable"
|
||||
#####wine启动指令,建议
|
||||
EXPORT_ENVS=""
|
||||
|
||||
export SPECIFY_SHELL_DIR=`dirname $START_SHELL_PATH`
|
||||
|
||||
ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files"
|
||||
|
||||
export WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64
|
||||
|
||||
export WINEPREDLL="$ARCHIVE_FILE_DIR/dlls"
|
||||
|
||||
DISABLE_ATTACH_FILE_DIALOG=""
|
||||
##默认为空。若为1,则不使用系统自带的文件选择,而是使用wine的
|
||||
##对于deepin/UOS,大部分的应用都不需要使用wine的,如果有需求(比如wine应用选择的限定种类文件系统的文管不支持)
|
||||
##请填1。
|
||||
##注意:因为非DDE的环境不确定,所以默认会在非Deepin/UOS发行版上禁用这个功能。如果你确认在适配的发行版上可以正常启动,请注释或者删除下面这段
|
||||
|
||||
##############<<<<<<<<<禁用文件选择工具开始
|
||||
Get_Dist_Name
|
||||
#此功能实现参见结尾函数段
|
||||
if [ "$DISTRO" != "Deepin" ] && [ "$DISTRO" != "UniontechOS" ];then
|
||||
DISABLE_ATTACH_FILE_DIALOG="1"
|
||||
echo "非deepin/UOS,默认关闭系统自带的文件选择工具,使用Wine的"
|
||||
echo "如果你想改变这个行为,请到/opt/apps/$DEB_PACKAGE_NAME/files/$0处修改"
|
||||
echo "To打包者:如果你要打开自带请注意在适配的发行版上进行测试"
|
||||
echo "To用户:打包者没有打开这个功能,这证明启用这个功能可能造成运行问题。如果你要修改这个行为,请确保你有一定的动手能力"
|
||||
fi
|
||||
##############>>>>>>>>>禁用文件选择工具结束
|
||||
|
||||
##############<<<<<<<<<屏蔽mono和gecko安装器开始
|
||||
##默认屏蔽mono和gecko安装器
|
||||
#if [ "$APPRUN_CMD" = "spark-wine7-devel" ];then
|
||||
|
||||
#export WINEDLLOVERRIDES="mscoree,mshtml="
|
||||
#echo "为了降低打包体积,默认关闭gecko和momo,如有需要,注释此行(仅对spark-wine7-devel有效)"
|
||||
|
||||
#fi
|
||||
##############>>>>>>>>>屏蔽mono和gecko安装器结束
|
||||
|
||||
#########################执行段
|
||||
|
||||
|
||||
|
||||
|
||||
if [ -z "$DISABLE_ATTACH_FILE_DIALOG" ];then
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
fi
|
||||
|
||||
if [ -n "$EXPORT_ENVS" ];then
|
||||
export $EXPORT_ENVS
|
||||
fi
|
||||
|
||||
if [ -n "$EXEC_PATH" ];then
|
||||
if [ -z "${{EXEC_PATH##*.lnk*}}" ];then
|
||||
$START_SHELL_PATH $BOTTLENAME $APPVER "C:/windows/command/start.exe" "/Unix" "$EXEC_PATH" "$@"
|
||||
else
|
||||
$START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" "$@"
|
||||
fi
|
||||
else
|
||||
$START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@"
|
||||
fi'''
|
||||
|
||||
desktopFile = f'''#!/usr/bin/env xdg-open
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=Application
|
||||
X-Created-By=@@@Maintainer@@@
|
||||
Icon=@@@Icon@@@
|
||||
Exec="/opt/apps/@@@Package@@@/files/run.sh"
|
||||
Name=@@@Name@@@
|
||||
Comment=@@@Description@@@
|
||||
MimeType=
|
||||
GenericName=@@@Package@@@
|
||||
Terminal=false
|
||||
StartupNotify=false'''
|
||||
|
||||
def getFileFolderSize(fileOrFolderPath):
|
||||
"""get size for file or folder"""
|
||||
totalSize = 0
|
||||
if not os.path.exists(fileOrFolderPath):
|
||||
return totalSize
|
||||
if os.path.isfile(fileOrFolderPath):
|
||||
totalSize = os.path.getsize(fileOrFolderPath) # 5041481
|
||||
return totalSize
|
||||
if os.path.isdir(fileOrFolderPath):
|
||||
with os.scandir(fileOrFolderPath) as dirEntryList:
|
||||
for curSubEntry in dirEntryList:
|
||||
curSubEntryFullPath = os.path.join(fileOrFolderPath, curSubEntry.name)
|
||||
if curSubEntry.is_dir():
|
||||
curSubFolderSize = getFileFolderSize(curSubEntryFullPath) # 5800007
|
||||
totalSize += curSubFolderSize
|
||||
elif curSubEntry.is_file():
|
||||
curSubFileSize = os.path.getsize(curSubEntryFullPath) # 1891
|
||||
totalSize += curSubFileSize
|
||||
return totalSize
|
||||
|
||||
|
||||
def WriteTxt(path, things):
|
||||
with open(path, "w") as file:
|
||||
file.write(things)
|
||||
|
||||
def ReadTxt(path):
|
||||
things = ""
|
||||
with open(path, "r") as file:
|
||||
things = file.read()
|
||||
return things
|
||||
|
||||
def GetEXEVersion(exePath):
|
||||
versionPath = f"/tmp/wine-runner-exe-version-{random.randint(0, 1000)}.txt"
|
||||
if os.system(f"deepin-wine6-stable '{programPath}/GetEXEVersion.exe' '{exePath}' '{versionPath}'"):
|
||||
return "1.0.0"
|
||||
try:
|
||||
exeVersion = ReadTxt(versionPath).replace("\n", "")
|
||||
if exeVersion.replace(" ", "") == "":
|
||||
return "1.0.0"
|
||||
return exeVersion
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return "1.0.0"
|
||||
|
||||
def StrToByteToStr(text: str):
|
||||
lists = text.split("\\x")
|
||||
for i in range(len(lists)):
|
||||
lists[i]
|
||||
return text
|
||||
|
||||
def UnUseUpperCharPath(path: str):
|
||||
pathList = []
|
||||
lowerList = path.split("/")[1:]
|
||||
for i in lowerList:
|
||||
path = "/" + "/".join(pathList)
|
||||
before = len(pathList)
|
||||
for k in os.listdir(path):
|
||||
if k.lower() == i.lower():
|
||||
pathList.append(k)
|
||||
break
|
||||
end = len(pathList)
|
||||
if before == end:
|
||||
raise OSError("文件路径不存在")
|
||||
return "/" + "/".join(pathList)
|
||||
|
||||
def ReadMe():
|
||||
QtWidgets.QMessageBox.information(window, "提示", """1、目前只支持打包 X86 架构的 deb 包,暂未支持 arm;
|
||||
2、需要区分要打包的程序是绿色软件还是单文件安装包,两个对应的打包方式不相同;
|
||||
3、打包绿色软件时为尽可能减小程序体积,请将绿化后的程序(或程序文件夹)单独拷贝到干净的目录后再浏览选择主程序打包;
|
||||
4、打包详情:
|
||||
①调用 Wine:Deepin Wine6 Stable
|
||||
②调用 Helper:Spark Wine Helper
|
||||
③有卸载自动移除容器脚本""")
|
||||
|
||||
|
||||
class RunThread(QtCore.QThread):
|
||||
showLogText = QtCore.pyqtSignal(str)
|
||||
error = QtCore.pyqtSignal(str)
|
||||
info = QtCore.pyqtSignal(str)
|
||||
question = QtCore.pyqtSignal(str)
|
||||
disbledAll = QtCore.pyqtSignal(bool)
|
||||
cleanPressState = QtCore.pyqtSignal(bool)
|
||||
def RunCommand(self, command):
|
||||
res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
while res.poll() is None:
|
||||
try:
|
||||
text = res.stdout.readline().decode("utf8")
|
||||
except:
|
||||
text = ""
|
||||
self.showLogText.emit(text)
|
||||
print(text, end="")
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
def GetEXEVersion(self, exePath):
|
||||
versionPath = f"/tmp/wine-runner-exe-version-{random.randint(0, 1000)}.txt"
|
||||
self.RunCommand(f"deepin-wine6-stable '{programPath}/GetEXEVersion.exe' '{exePath}' '{versionPath}'")
|
||||
try:
|
||||
exeVersion = ReadTxt(versionPath).replace("\n", "")
|
||||
if exeVersion.replace(" ", "") == "":
|
||||
return "1.0.0"
|
||||
return exeVersion
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return "1.0.0"
|
||||
|
||||
def QuestionMsg(self, text):
|
||||
global questionStatus
|
||||
questionStatus = False
|
||||
self.question.emit(text)
|
||||
while not questionStatus:
|
||||
time.sleep(0.1)
|
||||
print(questionChoose)
|
||||
return questionChoose
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.disbledAll.emit(True)
|
||||
if not self.QuestionMsg("在此过程中,需要回答一系列的问题以进行打包,点击确定继续"):
|
||||
self.disbledAll.emit(False)
|
||||
return
|
||||
bottlePath = f"/tmp/deepin-wine-runner-bottle-{random.randint(0, 10000)}"
|
||||
# 清空容器以保证能正常使用
|
||||
if os.path.exists(bottlePath):
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}'")
|
||||
############# 后面将全部调用 deepin wine6 stable 进行操作
|
||||
exeName = os.path.basename(exePath.text())
|
||||
# 暂定
|
||||
packageName = xpinyin.Pinyin().get_pinyin(os.path.splitext(exeName)[0].replace(" ", ""), "").lower().replace(" ", "").replace("_", ".").replace("-", ".").replace("..", ".")
|
||||
|
||||
if " " in packageName:
|
||||
packageName = ""
|
||||
for i in os.path.splitext(exeName)[0].split(" "):
|
||||
packageName += xpinyin.Pinyin().get_pinyin(i).lower().replace(" ", "").replace("_", ".").replace("-", ".").replace("..", ".") + "."
|
||||
print(packageName)
|
||||
packageName = packageName[:-1]
|
||||
debPackageName = "com." + packageName + ".spark"
|
||||
debPackageVersion = "1.0.0"
|
||||
programIconPath = f"/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/{debPackageName}.png"
|
||||
debMaintainer = os.getlogin()
|
||||
debBuildPath = f"/tmp/deepin-wine-packager-builder-{debPackageName}-{random.randint(0, 1000)}"
|
||||
bottlePackagePath = f"{debBuildPath}/opt/apps/{debPackageName}/files/files.7z"
|
||||
desktopPath = get_desktop_path()
|
||||
############## 运行 EXE
|
||||
if self.QuestionMsg("请问此可执行文件是安装包还是绿色软件?是安装包请按 Yes,绿色软件按 No"):
|
||||
# 清空无益处的 lnk 文件
|
||||
lnkPath = f"{bottlePath}/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs"
|
||||
self.RunCommand(f"rm -rfv '{lnkPath}'")
|
||||
self.RunCommand(f"mkdir -pv '{bottlePath}'")
|
||||
self.RunCommand(f"chmod 777 -Rv '{bottlePath}'")
|
||||
# 禁止生成 .desktop 文件
|
||||
self.RunCommand(f"WINEPREFIX='{bottlePath}' deepin-wine6-stable 'reg' 'add' 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f'")
|
||||
# 安装包
|
||||
self.info.emit("请在运行完安装程序后按下打包器主界面的“安装程序执行完成按钮”以进行下一步操作")
|
||||
global pressCompleteDownload
|
||||
pressCompleteDownload = False
|
||||
installCmpleteButton.setEnabled(True)
|
||||
self.RunCommand(f"WINEPREFIX='{bottlePath}' deepin-wine6-stable '{exePath.text()}' &") # 非堵塞线程
|
||||
|
||||
# 安装锁,锁解除后才可继续
|
||||
while not pressCompleteDownload:
|
||||
time.sleep(0.1)
|
||||
# 杀死容器内应用
|
||||
self.RunCommand(f"'{programPath}/kill.sh' '{os.path.basename(bottlePath)}'")
|
||||
# 识别 lnk
|
||||
lnkList = GetLnkDesktop(lnkPath)
|
||||
if len(lnkList) <= 0:
|
||||
self.error.emit("无法识别到任何 lnk 快捷方式")
|
||||
self.RunCommand(f"rm -rfv '{debBuildPath}' > /dev/null")
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}' > /dev/null")
|
||||
self.disbledAll.emit(False)
|
||||
return
|
||||
# 选择最优 lnk
|
||||
secondChooseList = []
|
||||
for k in lnkList:
|
||||
lnkPath = k[0].lower()
|
||||
lnkExePath = k[1].lower()
|
||||
if "卸载" in lnkPath or "uninstall" in lnkPath or "update" in lnkPath or "网页" in lnkPath or "websize" in lnkPath or not ".exe" in lnkExePath:
|
||||
continue
|
||||
secondChooseList.append(k)
|
||||
if len(secondChooseList) <= 0:
|
||||
secondChooseList = lnkList
|
||||
rightLnk = secondChooseList[0]
|
||||
miniLenge = len(rightLnk[1])
|
||||
for k in secondChooseList:
|
||||
# 择优选择路径最短一项
|
||||
if len(k[1]) < miniLenge:
|
||||
rightLnk = k
|
||||
miniLenge = len(rightLnk[1])
|
||||
debPackageName = "com." + xpinyin.Pinyin().get_pinyin(os.path.splitext(os.path.basename(rightLnk[0]))[0].replace(" ", "")).lower().replace("--", "-").replace(" ", "").replace("_", "-").replace("-", ".") + ".spark"
|
||||
programIconPath = f"/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/{debPackageName}.png"
|
||||
bottlePackagePath = f"{debBuildPath}/opt/apps/{debPackageName}/files/files.7z"
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/'")
|
||||
folderExePath = os.path.dirname(rightLnk[1].replace("\\", "/").replace("c:/", bottlePath))
|
||||
exePathInBottle = rightLnk[1]
|
||||
exeName = os.path.splitext(os.path.basename(folderExePath))[0]
|
||||
exePathInSystem = rightLnk[1].replace("\\", "/").replace("c:", f"{bottlePath}/drive_c")
|
||||
debPackageVersion = self.GetEXEVersion(exePathInSystem)
|
||||
cpNow = False
|
||||
for i in iconList:
|
||||
path = i[1].replace("wineBottonPath", bottlePath).lower()
|
||||
if path == exePathInSystem.lower():
|
||||
self.RunCommand(f"cp -rv '{programPath}/Icon/{i[0]}.svg' '{debBuildPath}/{programIconPath}'")
|
||||
exeName = i[0]
|
||||
cpNow = True
|
||||
break
|
||||
if not cpNow:
|
||||
self.RunCommand(f"'{programPath}/wrestool' '{UnUseUpperCharPath(exePathInSystem)}' -x -t 14 > '{debBuildPath}/{programIconPath}'")
|
||||
else:
|
||||
#/home/gfdgd_xi/Desktop/新建文件夹1/BeCyIconGrabber.exe
|
||||
# 绿色软件
|
||||
self.RunCommand(f"mkdir -pv '{bottlePath}'")
|
||||
self.RunCommand(f"chmod 777 -Rv '{bottlePath}'")
|
||||
self.RunCommand(f"WINEPREFIX='{bottlePath}' deepin-wine6-stable exit")
|
||||
folderExePath = os.path.dirname(exePath.text())
|
||||
exePathInBottle = f"c:/Program Files/{os.path.basename(folderExePath)}/{exeName}"
|
||||
exeName = os.path.splitext(os.path.basename(os.path.basename(exePath.text())))[0]
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/'")
|
||||
self.RunCommand(f"'{programPath}/wrestool' '{exePath.text()}' -x -t 14 > '{debBuildPath}/{programIconPath}'")
|
||||
# 拷贝文件到容器
|
||||
self.RunCommand(f"cp -rv '{folderExePath}' '{bottlePath}/drive_c/Program Files'")
|
||||
debPackageVersion = self.GetEXEVersion(exePath.text())
|
||||
debDescription = f"{exeName} By Deepin Wine 6 Stable And Build By Wine Runner Easy Packager"
|
||||
debDepends = "deepin-wine6-stable, spark-dwine-helper | store.spark-app.spark-dwine-helper, fonts-wqy-microhei, fonts-wqy-zenhei"
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/DEBIAN'")
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/files'")
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/applications'")
|
||||
#self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/'")
|
||||
############ 处理容器
|
||||
# 对用户目录进行处理
|
||||
os.chdir(bottlePath)
|
||||
self.RunCommand("sed -i \"s#$USER#@current_user@#\" ./*.reg")
|
||||
os.chdir(f"{bottlePath}/drive_c/users")
|
||||
# 如果缩放文件 scale.txt 存在,需要移除以便用户自行调节缩放设置
|
||||
if os.path.exists(f"{bottlePath}/scale.txt"):
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}/scale.txt'")
|
||||
# 删除因为脚本失误导致用户目录嵌套(如果存在)
|
||||
if os.path.exists(f"{bottlePath}/drive_c/users/@current_user@/@current_user@"):
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}/drive_c/users/@current_user@/@current_user@'")
|
||||
self.RunCommand(f"mv -fv '{os.getlogin()}' @current_user@")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/我的'*")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/My '*")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/Desktop'")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/Downloads'")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/Templates'")
|
||||
########### 打包容器
|
||||
self.RunCommand(f"7z a '{bottlePackagePath}' '{bottlePath}/'*")
|
||||
########### 生成文件内容
|
||||
buildProgramSize = getFileFolderSize(debBuildPath) / 1000
|
||||
replaceMap = [
|
||||
["@@@Package@@@", debPackageName],
|
||||
["@@@Version@@@", debPackageVersion],
|
||||
["@@@Maintainer@@@", debMaintainer],
|
||||
["@@@Depends@@@", debDepends],
|
||||
["@@@Description@@@", debDescription],
|
||||
["@@@Installed-Size@@@", str(buildProgramSize)],
|
||||
["@@@Name@@@", exeName],
|
||||
["@@@EXEC_PATH@@@", exePathInBottle],
|
||||
["@@@Icon@@@", programIconPath]
|
||||
]
|
||||
debControl = ReplaceText(control, replaceMap)
|
||||
debPostrm = ReplaceText(postrm, replaceMap)
|
||||
debInfo = ReplaceText(info, replaceMap)
|
||||
debRunSh = ReplaceText(runsh, replaceMap)
|
||||
debDesktop = ReplaceText(desktopFile, replaceMap)
|
||||
########### 写入文件
|
||||
WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/entries/applications/{debPackageName}.desktop", debDesktop)
|
||||
WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/files/run.sh", debRunSh)
|
||||
WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/info", debInfo)
|
||||
WriteTxt(f"{debBuildPath}/DEBIAN/control", debControl)
|
||||
WriteTxt(f"{debBuildPath}/DEBIAN/postrm", debPostrm)
|
||||
########### 赋值权限
|
||||
self.RunCommand(f"chmod -Rv 644 '{debBuildPath}/opt/apps/{debPackageName}/info'")
|
||||
self.RunCommand(f"chmod -Rv 0755 '{debBuildPath}/DEBIAN'")
|
||||
self.RunCommand(f"chmod -Rv 755 '{debBuildPath}/opt/apps/{debPackageName}/files/'*.sh")
|
||||
self.RunCommand(f"chmod -Rv 755 '{debBuildPath}/opt/apps/{debPackageName}/entries/applications/'*.desktop")
|
||||
########### 打包 deb
|
||||
print(debPackageVersion)
|
||||
self.RunCommand(f"dpkg -b '{debBuildPath}' '{desktopPath}/{debPackageName}_{debPackageVersion}_i386.deb'")
|
||||
self.info.emit("打包完成!")
|
||||
self.disbledAll.emit(False)
|
||||
########### 移除临时文件
|
||||
self.RunCommand(f"rm -rfv '{debBuildPath}' > /dev/null")
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}' > /dev/null")
|
||||
except:
|
||||
self.RunCommand(f"rm -rfv '{debBuildPath}' > /dev/null")
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}' > /dev/null")
|
||||
# 若打包出现任何错误
|
||||
traceback.print_exc()
|
||||
self.error.emit(f"打包错误,详细详细如下:{traceback.format_exc()}")
|
||||
self.showLogText.emit(traceback.format_exc())
|
||||
self.disbledAll.emit(False)
|
||||
|
||||
#/home/gfdgd_xi/Downloads/XPcalc.exe
|
||||
def RunBuildThread():
|
||||
global buildThread
|
||||
buildThread = RunThread()
|
||||
buildThread.showLogText.connect(ShowText)
|
||||
buildThread.error.connect(ErrorMessage)
|
||||
buildThread.info.connect(InformationMessage)
|
||||
buildThread.question.connect(QuestionMessage)
|
||||
buildThread.disbledAll.connect(DisbledAndEnabledAll)
|
||||
buildThread.cleanPressState.connect(CleanPressCompleteDownloadState)
|
||||
logText.clear()
|
||||
buildThread.start()
|
||||
|
||||
pressCompleteDownload = False
|
||||
|
||||
def PressCompleteDownload():
|
||||
global pressCompleteDownload
|
||||
pressCompleteDownload = True
|
||||
installCmpleteButton.setDisabled(True)
|
||||
|
||||
def BrowserExe():
|
||||
filePath = QtWidgets.QFileDialog.getOpenFileName(window, "选择 exe", get_home(), "可执行文件(*.exe);;所有文件(*.*)")
|
||||
if filePath[0] != "" or filePath[0] != None:
|
||||
exePath.setText(filePath[0])
|
||||
|
||||
if __name__ == "__main__":
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
|
||||
information = json.loads(ReadTxt(f"{programPath}/information.json"))
|
||||
iconListUnBuild = json.loads(ReadTxt(f"{programPath}/IconList.json"))[0]
|
||||
iconList = json.loads(ReadTxt(f"{programPath}/IconList.json"))[1]
|
||||
for i in iconListUnBuild:
|
||||
iconList.append(i)
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
version = information["Version"]
|
||||
window = QtWidgets.QMainWindow()
|
||||
widget = QtWidgets.QWidget()
|
||||
layout = QtWidgets.QGridLayout()
|
||||
exePath = QtWidgets.QLineEdit()
|
||||
browserExeButton = QtWidgets.QPushButton("浏览……")
|
||||
logText = QtWidgets.QTextBrowser()
|
||||
logText.setStyleSheet("""
|
||||
background-color: black;
|
||||
color: white;
|
||||
""")
|
||||
controlLayout = QtWidgets.QHBoxLayout()
|
||||
buildButton = QtWidgets.QPushButton("现在打包……")
|
||||
installCmpleteButton = QtWidgets.QPushButton("安装程序执行完成")
|
||||
helpButton = QtWidgets.QPushButton("帮助")
|
||||
browserExeButton.clicked.connect(BrowserExe)
|
||||
buildButton.clicked.connect(RunBuildThread)
|
||||
installCmpleteButton.clicked.connect(PressCompleteDownload)
|
||||
helpButton.clicked.connect(ReadMe)
|
||||
installCmpleteButton.setDisabled(True)
|
||||
controlLayout.addWidget(buildButton)
|
||||
controlLayout.addWidget(installCmpleteButton)
|
||||
controlLayout.addWidget(helpButton)
|
||||
layout.addWidget(QtWidgets.QLabel("选择 EXE:"), 0, 0)
|
||||
layout.addWidget(exePath, 0, 1)
|
||||
layout.addWidget(browserExeButton, 0, 2)
|
||||
layout.addLayout(controlLayout, 1, 1)
|
||||
layout.addWidget(logText, 2, 0, 1, 3)
|
||||
widget.setLayout(layout)
|
||||
window.setCentralWidget(widget)
|
||||
window.setWindowTitle(f"Wine 运行器 {version}——简易打包器")
|
||||
try:
|
||||
exePath.setText(sys.argv[1])
|
||||
except:
|
||||
pass
|
||||
window.resize(int(window.frameGeometry().width() * 1.2), int(window.frameGeometry().height() * 1.1))
|
||||
window.show()
|
||||
sys.exit(app.exec_())
|
||||
@@ -23,23 +23,24 @@ from PIL import Image
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
from trans import *
|
||||
|
||||
#################
|
||||
# 程序所需事件
|
||||
#################
|
||||
|
||||
def button1_cl():
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(widget, QtCore.QCoreApplication.translate("U", "选择 wine 容器"), f"{get_home()}/.deepinwine")
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(widget, transla.transe("U", "选择 wine 容器"), f"{get_home()}/.deepinwine")
|
||||
if path != "":
|
||||
e6_text.setText(path)
|
||||
|
||||
def button2_cl(number):
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(widget, QtCore.QCoreApplication.translate("U", "选择图标文件"), get_home(), "PNG图标(*.png);;SVG图标(*.svg);;全部文件(*.*)")[0]
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(widget, transla.transe("U", "选择图标文件"), get_home(), "PNG图标(*.png);;SVG图标(*.svg);;全部文件(*.*)")[0]
|
||||
if path != "":
|
||||
mapLink[number].setText(path)
|
||||
|
||||
def button4_cl():
|
||||
path = QtWidgets.QFileDialog.getSaveFileName(widget, QtCore.QCoreApplication.translate("U", "保存 deb 包"), get_home(), "deb 文件(*.deb);;所有文件(*.*)", "{}_{}_i386.deb".format(e1_text.text(), e2_text.text()))[0]
|
||||
path = QtWidgets.QFileDialog.getSaveFileName(widget, transla.transe("U", "保存 deb 包"), get_home(), "deb 文件(*.deb);;所有文件(*.*)", "{}_{}_i386.deb".format(e1_text.text(), e2_text.text()))[0]
|
||||
if path != "":
|
||||
e12_text.setText(path)
|
||||
|
||||
@@ -203,14 +204,41 @@ def Build7zButton_Clicked():
|
||||
QT.thread.start()
|
||||
|
||||
def make_deb(build=False):
|
||||
global bottleNameLock
|
||||
clean_textbox1_things()
|
||||
disabled_or_NORMAL_all(False)
|
||||
if e1_text.text() == "" or e2_text.text() == "" or e3_text.text() == "" or e4_text.text() == "" or e5_text.text() == "" or e6_text.text() == "" or e7_text.text() == "" or e8_text.text() == "" or e12_text.text() == "":
|
||||
badComplete = False
|
||||
# 规范检测
|
||||
if e1_text.text().lower() != e1_text.text():
|
||||
if QtWidgets.QMessageBox.warning(window, "提示", f"包名 {e1_text.text()} 似乎不符合规范,可能会导致打包后的包无法投稿到应用商店,是否继续?\n可参考 deb 安装包打包标准", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("用户已取消")
|
||||
return
|
||||
for i in range(len(iconUiList)):
|
||||
if os.path.splitext(iconUiList[i][4].text())[1] == ".ico":
|
||||
if QtWidgets.QMessageBox.warning(window, "提示", f"图标 {iconUiList[i][4].text()} 似乎为 ico 格式,可能会导致打包后的程序在启动器的图标无法正常显示,是否继续?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("用户已取消")
|
||||
return
|
||||
if os.path.exists(iconUiList[i][0].text()) and not "c:" in iconUiList[i][0].text().lower():
|
||||
if not e6_text.text() in iconUiList[i][0].text():
|
||||
if QtWidgets.QMessageBox.warning(window, "提示", f"路径 {iconUiList[i][0].text()} 似乎不符合规范且不位于容器内,可能会导致打包后的程序无法运行,是否继续?\n可参考 Windows 下的文件路径", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("用户已取消")
|
||||
return
|
||||
if QtWidgets.QMessageBox.warning(window, "提示", f"路径 {iconUiList[i][0].text()} 似乎不符合规范,可能会导致打包后的程序无法运行,是否继续?\n可参考 Windows 下的文件路径", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("用户已取消")
|
||||
return
|
||||
for k in [0, 3]:
|
||||
if iconUiList[i][k].text().replace(" ", "") == "":
|
||||
badComplete = True
|
||||
if badComplete or e1_text.text() == "" or e2_text.text() == "" or e3_text.text() == "" or e4_text.text() == "" or e5_text.text() == "" or e6_text.text() == "" or e7_text.text() == "" or e8_text.text() == "" or e12_text.text() == "":
|
||||
QtWidgets.QMessageBox.critical(widget, "错误", "必填信息没有填写完整,无法继续构建 deb 包")
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("必填信息没有填写完整,无法继续构建 deb 包")
|
||||
return
|
||||
if QtWidgets.QMessageBox.question(widget, QtCore.QCoreApplication.translate("U", "提示"), QtCore.QCoreApplication.translate("U", "打包将会改动现在选择的容器,是否继续?")) == QtWidgets.QMessageBox.No:
|
||||
if QtWidgets.QMessageBox.question(widget, transla.transe("U", "提示"), transla.transe("U", "打包将会改动现在选择的容器,是否继续?")) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
return
|
||||
# 警告信息
|
||||
@@ -232,6 +260,7 @@ def make_deb(build=False):
|
||||
QT.thread.errorMsg.connect(ErrorMsg)
|
||||
QT.thread.infoMsg.connect(InfoMsg)
|
||||
QT.thread.disabled_or_NORMAL_all.connect(disabled_or_NORMAL_all)
|
||||
bottleNameLock = False
|
||||
QT.thread.start()
|
||||
#thread.start()
|
||||
|
||||
@@ -245,7 +274,6 @@ def ReplaceText(string: str, lists: list):
|
||||
return string
|
||||
|
||||
class make_deb_threading(QtCore.QThread):
|
||||
|
||||
signal = QtCore.pyqtSignal(str)
|
||||
label = QtCore.pyqtSignal(str)
|
||||
getSavePath = QtCore.pyqtSignal(str)
|
||||
@@ -1204,7 +1232,7 @@ fi
|
||||
# 获取文件大小
|
||||
################
|
||||
self.label.emit("正在计算文件大小……")
|
||||
size = int(getFileFolderSize(debPackagePath) / 1024)
|
||||
size = int(getFileFolderSize(debPackagePath) / 1000)
|
||||
################
|
||||
# 写入文本文档
|
||||
################
|
||||
@@ -1324,6 +1352,12 @@ StartupNotify=false
|
||||
self.label.emit("正在构建 deb 包……")
|
||||
self.run_command("bash -c 'dpkg -b \"{}\" \"{}\"'".format(debPackagePath, e12_text.text()))
|
||||
################
|
||||
# 删除临时文件
|
||||
################
|
||||
if not self.build:
|
||||
self.label.emit("正在删除临时文件……")
|
||||
self.run_command(f"rm -rfv '{debPackagePath}'")
|
||||
################
|
||||
# 完成构建
|
||||
################
|
||||
self.label.emit("完成构建!")
|
||||
@@ -1689,7 +1723,7 @@ mapLink = []
|
||||
|
||||
def AddTab():
|
||||
global mapLink
|
||||
button2 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览……"))
|
||||
button2 = QtWidgets.QPushButton(transla.transe("U", "浏览……"))
|
||||
e7_text = QtWidgets.QLineEdit()
|
||||
e8_text = QtWidgets.QLineEdit()
|
||||
e9_text = QtWidgets.QLineEdit()
|
||||
@@ -1703,11 +1737,11 @@ def AddTab():
|
||||
mapLink.append(e9_text)
|
||||
#desktopIconTabLayout = QtWidgets.QGridLayout()
|
||||
desktopIconTabLayout = QtWidgets.QGridLayout()
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine 容器里需要运行的可执行文件路径(※必填):")), 6, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的分类(※必填):")), 7, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine 容器里需要运行的可执行文件的参数(选填):")), 8, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的名称(※必填):")), 9, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的图标(选填):")), 10, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "wine 容器里需要运行的可执行文件路径(※必填):")), 6, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的分类(※必填):")), 7, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "wine 容器里需要运行的可执行文件的参数:")), 8, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的名称(※必填):")), 9, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的图标:")), 10, 0, 1, 1)
|
||||
iconTab1.setLayout(desktopIconTabLayout)
|
||||
desktopIconTab.addTab(iconTab1, f"图标{desktopIconTab.count() + 1}")
|
||||
desktopIconTabLayout.addWidget(e7_text, 6, 1, 1, 1)
|
||||
@@ -1716,7 +1750,24 @@ def AddTab():
|
||||
desktopIconTabLayout.addWidget(e8_text, 9, 1, 1, 1)
|
||||
desktopIconTabLayout.addWidget(e9_text, 10, 1, 1, 1)
|
||||
desktopIconTabLayout.addWidget(button2, 10, 2, 1, 1)
|
||||
e8_text.setWhatsThis(transla.transe("U", """填写该软件的中文或英文名称。"""))
|
||||
e9_text.setWhatsThis(transla.transe("U", """图标只支持PNG格式和SVG格式,其他格式无法显示。"""))
|
||||
e15_text.setWhatsThis(transla.transe("U", "程序参数,如%u,一般不需要"))
|
||||
e7_text.setWhatsThis(transla.transe("U", """可执行文件的运行路径格式是“C:/XXX/XXX.exe”(不包含引号)"""))
|
||||
option1_text.setWhatsThis(transla.transe("U", """点击右侧的下拉箭头,选择该软件所属的软件分类即可,常见软件分类名称释义:
|
||||
Network=网络应用;
|
||||
Chat=即时通讯或社交沟通;
|
||||
Video=视频播放;
|
||||
Graphics=图形图像;
|
||||
Office=办公学习;
|
||||
Translation=阅读翻译;
|
||||
Development=软件开发;
|
||||
Utility=工具软件或其他应用。
|
||||
不明白英文的可以百度查询一下软件分类名称的意思。
|
||||
注意:此时选择的软件分类名称决定了该软件打包后再安装时会安装在启动器中的哪个软件分类目录中。"""))
|
||||
e7_text.textChanged.connect(ChangeTapTitle)
|
||||
e7_text.setPlaceholderText("例如 c:/Program Files/Tencent/QQ/Bin/QQ.exe")
|
||||
e9_text.setPlaceholderText(transla.transe("U", "支持 png 和 svg 格式,不支持 ico 格式"))
|
||||
iconUiList.append([e7_text, option1_text, e15_text, e8_text, e9_text])
|
||||
print(iconUiList)
|
||||
|
||||
@@ -1727,6 +1778,30 @@ def DelTab():
|
||||
del iconUiList[desktopIconTab.currentIndex()]
|
||||
desktopIconTab.removeTab(desktopIconTab.currentIndex())
|
||||
|
||||
def ChangeBottleName():
|
||||
global bottleNameLock
|
||||
global bottleNameChangeLock
|
||||
e1_text.setText(e1_text.text().replace(" ", ""))
|
||||
if bottleNameLock:
|
||||
return
|
||||
if os.path.basename(e6_text.text()) == ".wine" or e6_text.text() == "":
|
||||
bottleNameChangeLock = True
|
||||
e5_text.setText(e1_text.text())
|
||||
return
|
||||
bottleNameChangeLock = True
|
||||
e5_text.setText(os.path.basename(e6_text.text().replace(" ", "")))
|
||||
|
||||
def LockBottleName():
|
||||
global bottleNameLock
|
||||
if bottleNameChangeLock:
|
||||
return
|
||||
bottleNameLock = True
|
||||
|
||||
# 获取当前语言
|
||||
def get_now_lang()->"获取当前语言":
|
||||
return os.getenv('LANG')
|
||||
|
||||
bottleNameLock = False
|
||||
###############
|
||||
# 程序信息
|
||||
###############
|
||||
@@ -1758,18 +1833,27 @@ iconUiList = []
|
||||
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
|
||||
information = json.loads(readtxt(f"{programPath}/information.json"))
|
||||
version = information["Version"]
|
||||
tips = """提示:
|
||||
# 语言载入
|
||||
if not get_now_lang() == "zh_CN.UTF-8":
|
||||
#trans = QtCore.QTranslator()
|
||||
#trans.load(f"{programPath}/LANG/deepin-wine-runner-en_US.qm")
|
||||
#app.installTranslator(trans)
|
||||
transla = Trans("en_US", f"{programPath}/trans/deepin-wine-packager.json")
|
||||
else:
|
||||
transla = Trans("zh_CN")
|
||||
tips = transla.transe("U", """提示:
|
||||
1、deb 打包软件包名要求:
|
||||
软件包名只能含有小写字母(a-z)、数字(0-9)、加号(+)和减号(-)、以及点号(.),软件包名最短长度两个字符;它必须以字母开头
|
||||
2、如果要填写路径,有“浏览……”按钮的是要填本计算机对应文件的路径,否则就是填写安装到其他计算机使用的路径
|
||||
3、输入 wine 的容器路径时最后面请不要输入“/”
|
||||
4、输入可执行文件的运行路径时是以“C:/XXX/XXX.exe”的格式进行输入,默认是以 C: 为开头,不用“\”做命令的分隔,而是用“/”
|
||||
5、.desktop 的图标只支持 PNG 格式和 SVG 格式,其他格式无法显示图标
|
||||
6、路径建议不要带空格,容易出问题"""
|
||||
6、路径建议不要带空格,容易出问题""")
|
||||
|
||||
###############
|
||||
# 窗口创建
|
||||
###############
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
window = QtWidgets.QMainWindow()
|
||||
widget = QtWidgets.QWidget()
|
||||
@@ -1792,25 +1876,25 @@ e12_text = QtWidgets.QLineEdit()
|
||||
e15_text = QtWidgets.QLineEdit()
|
||||
label13_text = QtWidgets.QLabel("<p align='center'>当前 deb 打包情况:暂未打包</p>")
|
||||
option1_text = QtWidgets.QComboBox()
|
||||
button1 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览……"))
|
||||
button2 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览……"))
|
||||
button4 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览……"))
|
||||
button1 = QtWidgets.QPushButton(transla.transe("U", "浏览……"))
|
||||
button2 = QtWidgets.QPushButton(transla.transe("U", "浏览……"))
|
||||
button4 = QtWidgets.QPushButton(transla.transe("U", "浏览……"))
|
||||
debControlFrame = QtWidgets.QHBoxLayout()
|
||||
button5 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "打包……"))
|
||||
installDeb = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "安装打包完成的 deb……"))
|
||||
buildDebDir = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "根据填写内容打包模板"))
|
||||
build7z = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "打包容器 7z 包"))
|
||||
button5 = QtWidgets.QPushButton(transla.transe("U", "打包……"))
|
||||
installDeb = QtWidgets.QPushButton(transla.transe("U", "安装打包完成的 deb……"))
|
||||
buildDebDir = QtWidgets.QPushButton(transla.transe("U", "根据填写内容打包模板"))
|
||||
build7z = QtWidgets.QPushButton(transla.transe("U", "打包容器 7z 包"))
|
||||
debControlFrame.addWidget(button5)
|
||||
debControlFrame.addWidget(installDeb)
|
||||
rmBash = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "设置卸载该 deb 后自动删除该容器"))
|
||||
cleanBottonByUOS = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "使用统信 Wine 生态适配活动容器清理脚本"))
|
||||
rmBash = QtWidgets.QCheckBox(transla.transe("U", "设置卸载该 deb 后自动删除该容器"))
|
||||
cleanBottonByUOS = QtWidgets.QCheckBox(transla.transe("U", "使用统信 Wine 生态适配活动容器清理脚本"))
|
||||
debArch = QtWidgets.QComboBox()
|
||||
debArch.addItems(["i386", "arm64(box86+exagear)"])
|
||||
textbox1 = QtWidgets.QTextBrowser()
|
||||
option1_text.addItems(["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility"])
|
||||
option1_text.setCurrentText("Network")
|
||||
wineFrame = QtWidgets.QHBoxLayout()
|
||||
chooseWineHelperValue = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "使用星火wine helper\n(如不勾选默认为deepin-wine-helper)"))
|
||||
chooseWineHelperValue = QtWidgets.QCheckBox(transla.transe("U", "使用星火wine helper\n(如不勾选默认为deepin-wine-helper)"))
|
||||
button1.clicked.connect(button1_cl)
|
||||
button2.clicked.connect(lambda: button2_cl(0))
|
||||
mapLink.append(e9_text)
|
||||
@@ -1820,19 +1904,23 @@ buildDebDir.clicked.connect(lambda: make_deb(True))
|
||||
build7z.clicked.connect(Build7zButton_Clicked)
|
||||
installDeb.clicked.connect(InstallDeb)
|
||||
wineFrame.addWidget(wineVersion)
|
||||
e1_text.textChanged.connect(ChangeBottleName)
|
||||
e5_text.textChanged.connect(LockBottleName)
|
||||
e6_text.textChanged.connect(ChangeBottleName)
|
||||
e7_text.textChanged.connect(ChangeTapTitle)
|
||||
# 创建控件
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的包名(※必填):")), 0, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的版本号(※必填):")), 1, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的说明(※必填):")), 2, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的维护者(※必填):")), 3, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要解压的 wine 容器的容器名(※必填):")), 4, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要解压的 wine 容器(※必填):")), 5, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要打包的 deb 包的包名(※必填):")), 0, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包的版本号(※必填):")), 1, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包的说明(※必填):")), 2, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包的维护者(※必填):")), 3, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要解压的 wine 容器的名称(※必填):")), 4, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要打包的 wine 容器路径(※必填):")), 5, 0, 1, 1)
|
||||
desktopIconTab = QtWidgets.QTabWidget()
|
||||
controlWidget = QtWidgets.QWidget()
|
||||
controlWidgetLayout = QtWidgets.QHBoxLayout()
|
||||
desktopIconTabAdd = QtWidgets.QPushButton("+")
|
||||
desktopIconTabDel = QtWidgets.QPushButton("-")
|
||||
desktopIconTabAdd.setWhatsThis("添加新图标")
|
||||
desktopIconTabDel.setWhatsThis("移除选中图标")
|
||||
controlWidgetLayout.addWidget(desktopIconTabAdd)
|
||||
controlWidgetLayout.addWidget(desktopIconTabDel)
|
||||
controlWidget.setLayout(controlWidgetLayout)
|
||||
@@ -1840,18 +1928,18 @@ desktopIconTabAdd.clicked.connect(AddTab)
|
||||
desktopIconTabDel.clicked.connect(DelTab)
|
||||
iconTab1 = QtWidgets.QWidget()
|
||||
desktopIconTabLayout = QtWidgets.QGridLayout()
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine 容器里需要运行的可执行文件路径(※必填):")), 6, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的分类(※必填):")), 7, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine 容器里需要运行的可执行文件的参数(选填):")), 8, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的名称(※必填):")), 9, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的图标(选填):")), 10, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "wine 容器里需要运行的可执行文件路径(※必填):")), 6, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的分类(※必填):")), 7, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "wine 容器里需要运行的可执行文件的参数:")), 8, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的名称(※必填):")), 9, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的图标:")), 10, 0, 1, 1)
|
||||
iconTab1.setLayout(desktopIconTabLayout)
|
||||
#desktopIconTab.setTabPosition(QtWidgets.QTabWidget.East)
|
||||
desktopIconTab.addTab(iconTab1, "Defult")
|
||||
desktopIconTab.setCornerWidget(controlWidget)
|
||||
widgetLayout.addWidget(desktopIconTab, 8, 0, 6, 3)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "选择打包的 wine 版本(※必选):")), 6, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "打包 deb 的保存路径(※必填):")), 7, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "选择打包的 wine 版本(※必选):")), 6, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "打包 deb 的保存路径(※必填):")), 7, 0, 1, 1)
|
||||
widgetLayout.addWidget(e1_text, 0, 1, 1, 1)
|
||||
widgetLayout.addWidget(e2_text, 1, 1, 1, 1)
|
||||
widgetLayout.addWidget(e3_text, 2, 1, 1, 1)
|
||||
@@ -1874,30 +1962,30 @@ widgetLayout.addLayout(debControlFrame, 16, 1, 1, 1)
|
||||
widgetLayout.addWidget(label13_text, 17, 0, 1, 3)
|
||||
widgetLayout.addWidget(textbox1, 18, 0, 1, 3)
|
||||
# 高级功能
|
||||
moreSetting = QtWidgets.QGroupBox(QtCore.QCoreApplication.translate("U", "高级设置"))
|
||||
moreSetting = QtWidgets.QGroupBox(transla.transe("U", "高级设置"))
|
||||
debDepends = QtWidgets.QLineEdit()
|
||||
debRecommend = QtWidgets.QLineEdit()
|
||||
debDepends.setPlaceholderText(QtCore.QCoreApplication.translate("U", "deb 包的依赖(如无特殊需求默认即可)"))
|
||||
debDepends.setPlaceholderText(transla.transe("U", "deb 包的依赖(如无特殊需求默认即可)"))
|
||||
debDepends.setText("deepin-wine6-stable, deepin-wine-helper (>= 5.1.30-1), fonts-wqy-microhei, fonts-wqy-zenhei")
|
||||
debRecommend.setPlaceholderText(QtCore.QCoreApplication.translate("U", "deb 包的推荐依赖(非强制,一般默认即可)"))
|
||||
debRecommend.setPlaceholderText(transla.transe("U", "deb 包的推荐依赖(非强制,一般默认即可)"))
|
||||
moreSettingLayout = QtWidgets.QVBoxLayout()
|
||||
localWineVersion = QtWidgets.QComboBox()
|
||||
useInstallWineArch = QtWidgets.QComboBox()
|
||||
useInstallWineArch.addItems(["wine", "wine64"])
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "Wine 位数(只限本地需要打包集成的Wine):\n提示:32位的Wine不能使用64位容器")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "Wine 位数(只限本地需要打包集成的Wine):\n提示:32位的Wine不能使用64位容器")))
|
||||
#moreSettingLayout.addWidget(localWineVersion)
|
||||
moreSettingLayout.addWidget(useInstallWineArch)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "deb 包选项:")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包选项:")))
|
||||
moreSettingLayout.addWidget(rmBash)
|
||||
moreSettingLayout.addWidget(cleanBottonByUOS)
|
||||
moreSettingLayout.addWidget(chooseWineHelperValue)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "deb 的依赖(强制,如无特殊需求默认即可):")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 的依赖(强制,如无特殊需求默认即可):")))
|
||||
moreSettingLayout.addWidget(debDepends)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "deb 的推荐依赖(非强制,一般默认即可):")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 的推荐依赖(非强制,一般默认即可):")))
|
||||
moreSettingLayout.addWidget(debRecommend)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的 MimeType:")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的 MimeType:")))
|
||||
moreSettingLayout.addWidget(e10_text)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "打包 deb 架构:")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "打包 deb 架构:")))
|
||||
moreSettingLayout.addWidget(debArch)
|
||||
moreSetting.setLayout(moreSettingLayout)
|
||||
widgetLayout.addWidget(moreSetting, 0, 3, 16, 2)
|
||||
@@ -1911,22 +1999,27 @@ e2_text.textChanged.connect(AutoPathSet)
|
||||
debArch.currentIndexChanged.connect(AutoPathSet)
|
||||
debArch.currentIndexChanged.connect(ChangeArchCombobox)
|
||||
e12_text.textChanged.connect(UserPathSet)
|
||||
e1_text.setPlaceholderText("例如 spark-deepin-wine-runner,不建议有大写字符")
|
||||
e2_text.setPlaceholderText(f"例如 {version}")
|
||||
e7_text.setPlaceholderText("例如 c:/Program Files/Tencent/QQ/Bin/QQ.exe")
|
||||
e9_text.setPlaceholderText(transla.transe("U", "支持 png 和 svg 格式,不支持 ico 格式"))
|
||||
# 菜单栏
|
||||
menu = window.menuBar()
|
||||
programmenu = menu.addMenu(QtCore.QCoreApplication.translate("U", "程序"))
|
||||
debMenu = menu.addMenu(QtCore.QCoreApplication.translate("U", "deb 包"))
|
||||
uploadSparkStore = menu.addMenu(QtCore.QCoreApplication.translate("U", "投稿到星火应用商店"))
|
||||
help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助"))
|
||||
exit = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "退出程序"))
|
||||
debE = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "只读取 Control 信息"))
|
||||
debX = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "读取所有(需解包,时间较久)"))
|
||||
uploadSparkStoreWebsize = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从网页端投稿"))
|
||||
programmenu = menu.addMenu(transla.transe("U", "程序"))
|
||||
debMenu = menu.addMenu(transla.transe("U", "deb 包"))
|
||||
uploadSparkStore = menu.addMenu(transla.transe("U", "投稿到星火应用商店"))
|
||||
help = menu.addMenu(transla.transe("U", "帮助"))
|
||||
exit = QtWidgets.QAction(transla.transe("U", "退出程序"))
|
||||
debE = QtWidgets.QAction(transla.transe("U", "只读取 Control 信息"))
|
||||
debX = QtWidgets.QAction(transla.transe("U", "读取所有(需解包,时间较久)"))
|
||||
uploadSparkStoreWebsize = QtWidgets.QAction(transla.transe("U", "从网页端投稿"))
|
||||
if os.path.exists("/opt/spark-store-submitter/bin/spark-store-submitter"):
|
||||
uploadSparkStoreProgram = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用投稿器投稿(推荐)"))
|
||||
uploadSparkStoreProgram = QtWidgets.QAction(transla.transe("U", "使用投稿器投稿(推荐)"))
|
||||
else:
|
||||
uploadSparkStoreProgram = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用投稿器投稿(推荐,请先安装投稿器)"))
|
||||
uploadSparkStoreProgram = QtWidgets.QAction(transla.transe("U", "使用投稿器投稿(推荐,请先安装投稿器)"))
|
||||
uploadSparkStoreProgram.setDisabled(True)
|
||||
tip = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "小提示"))
|
||||
tip = QtWidgets.QAction(transla.transe("U", "小提示"))
|
||||
getPdfHelp = QtWidgets.QAction(transla.transe("U", "Wine运行器和Wine打包器傻瓜式使用教程(小白专用)\nBy @雁舞白沙"))
|
||||
exit.triggered.connect(window.close)
|
||||
tip.triggered.connect(helps)
|
||||
programmenu.addAction(exit)
|
||||
@@ -1938,7 +2031,9 @@ debE.triggered.connect(lambda: ReadDeb(False))
|
||||
debX.triggered.connect(lambda: ReadDeb(True))
|
||||
uploadSparkStoreWebsize.triggered.connect(lambda: webbrowser.open_new_tab("https://upload.deepinos.org"))
|
||||
uploadSparkStoreProgram.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"/opt/spark-store-submitter/bin/spark-store-submitter '{e12_text.text()}'"]).start())
|
||||
getPdfHelp.triggered.connect(lambda: webbrowser.open_new_tab("https://bbs.deepin.org/post/246837"))
|
||||
help.addAction(tip)
|
||||
help.addAction(getPdfHelp)
|
||||
# 控件配置
|
||||
try:
|
||||
e6_text.setText(sys.argv[1].replace("~", get_home()))
|
||||
@@ -1955,6 +2050,44 @@ window.setCentralWidget(widget)
|
||||
window.setWindowTitle(f"wine 应用打包器 {version}")
|
||||
window.setWindowIcon(QtGui.QIcon(iconPath))
|
||||
window.resize(int(window.frameSize().width() * 2.1), int(window.frameSize().height()))
|
||||
e1_text.setWhatsThis("""com.XXX.deepin
|
||||
XXX指windows软件的英文名称,可以自定义名称,但最好是用软件解压安装后自动生成的英文名称,如:dingtalk。包名只能含有小写字母(a-z)、数字(0-9)、加号(+)和减号(-)、以及点号(.),软件包名最短长度为两个字符,且包名必须以字母开头。""")
|
||||
# 创建控件
|
||||
e2_text.setWhatsThis(transla.transe("U", """6.5.50(随便填写或填写该软件的windows版本的版本号,6.5.50只是示例)。"""))
|
||||
e3_text.setWhatsThis(transla.transe("U", """随便填写或使用该软件的windows版本的软件简介。"""))
|
||||
e4_text.setWhatsThis(transla.transe("U", """填写自己的网名,若是自用软件,不上架至应用商店,不进行后续维护,可随便填写。"""))
|
||||
e5_text.setWhatsThis(f"<p>解压容器到其它机器的容器名称,一般自动带出</p><p><img src='{programPath}/Icon/Screen/202211121646232464_image.png'></p>")
|
||||
e6_text.setWhatsThis(transla.transe("U", f"要打包的容器所在路径,也可以选择已经好打包的 7z 文件,一般自动带出"))
|
||||
e7_text.setWhatsThis("""可执行文件的运行路径格式是“C:/XXX/XXX.exe”(不包含引号)""")
|
||||
debArch.setWhatsThis(transla.transe("U", "选择生成 deb 包所对应的架构"))
|
||||
rmBash.setWhatsThis(transla.transe("U", "清理容器无用内容,一般建议勾选,最新版本默认勾选,如果有特殊需求(如容器内有 mono、gecko 等)建议取消勾选"))
|
||||
debDepends.setWhatsThis(transla.transe("U", "生成 deb 包所需的依赖,一般情况下默认即可"))
|
||||
debRecommend.setWhatsThis(transla.transe("U", "生成 deb 包的推荐依赖,一般情况下为空即可"))
|
||||
cleanBottonByUOS.setWhatsThis(transla.transe("U", "清理容器无用内容,一般建议勾选,最新版本默认勾选,如果有特殊需求(如容器内有 mono、gecko 等)建议取消勾选"))
|
||||
chooseWineHelperValue.setWhatsThis(transla.transe("U", "使用星火 dwine helper 替换 Deepin Wine Helper,投稿星火应用商店的话建议勾选,最新版本默认勾选(如果打包 arm 包将不会提供选择)"))
|
||||
option1_text.setWhatsThis("""点击右侧的下拉箭头,选择该软件所属的软件分类即可,常见软件分类名称释义:
|
||||
Network=网络应用;
|
||||
Chat=即时通讯或社交沟通;
|
||||
Video=视频播放;
|
||||
Graphics=图形图像;
|
||||
Office=办公学习;
|
||||
Translation=阅读翻译;
|
||||
Development=软件开发;
|
||||
Utility=工具软件或其他应用。
|
||||
不明白英文的可以百度查询一下软件分类名称的意思。
|
||||
注意:此时选择的软件分类名称决定了该软件打包后再安装时会安装在启动器中的哪个软件分类目录中。""")
|
||||
e8_text.setWhatsThis(transla.transe("U", """填写该软件的中文或英文名称。"""))
|
||||
e9_text.setWhatsThis(transla.transe("U", """图标只支持PNG格式和SVG格式,其他格式无法显示。"""))
|
||||
e10_text.setWhatsThis(transla.transe("U", "快捷方式的 MimeType 项,一般为空即可"))
|
||||
option1_text.setWhatsThis(transla.transe("U", "打包的 Wine 版本,根据实际情况选择(如果打包 arm 包将不会提供选择)"))
|
||||
e12_text.setWhatsThis(transla.transe("U", "打包出的 deb 生成的位置,一般自动生成"))
|
||||
e15_text.setWhatsThis(transla.transe("U", "程序参数,如%u,一般不需要"))
|
||||
build7z.setWhatsThis(transla.transe("U", "只打包容器生成 7z 包,不做其它操作"))
|
||||
buildDebDir.setWhatsThis(transla.transe("U", "构建 deb 包目录,但不打包成 deb"))
|
||||
textbox1.setWhatsThis(transla.transe("U", "查看打包过程中命令返回内容"))
|
||||
button5.setWhatsThis(transla.transe("U", "点击该按钮打包生成 deb"))
|
||||
installDeb.setWhatsThis(transla.transe("U", "调用默认的 deb 安装工具安装生成的 deb"))
|
||||
#window.setWindowFlag(QtGui.Qt)
|
||||
window.show()
|
||||
sys.exit(app.exec_())
|
||||
# Flag:解包只读control和解包全部读取
|
||||
@@ -1,9 +1,16 @@
|
||||
{
|
||||
"Version": "2.5.0",
|
||||
"Version": "3.0.0",
|
||||
"Thank": [
|
||||
"感谢 @豪 提供程序图标",
|
||||
"感谢 @鹤舞白沙 对程序文案进行优化以及编写《Wine运行器和Wine打包器傻瓜式使用教程(小白专用) 》",
|
||||
"感谢 @璀璨星空 提供的彩蛋图标",
|
||||
"感谢 @Bail 反馈的更新策略问题",
|
||||
"感谢 @白水 反馈的安装 exagear 后无法识别和调用 box86 的问题",
|
||||
"感谢 @汐光. 提供的翻译接口",
|
||||
"感谢 @鹤舞白沙 专门为小白用户编写的使用 Wine 运行器非基于生态适配脚本的程序打包教程",
|
||||
"感谢 @牦牛儿苗 进行了龙芯 3a5000 平台的测试与移植",
|
||||
"感谢 @雁舞白沙 优化了程序文案",
|
||||
"感谢 @豪 的程序测试和制作的非官方论坛 https://gfdgdxi.flarum.cloud/",
|
||||
"感谢 @鹤舞白沙 优化了程序文案",
|
||||
"感谢 @豪 的程序测试和制作的论坛 https://gfdgdxi.flarum.cloud/",
|
||||
"感谢 @185******67 反馈的 2.4.0 无法打开 Visual Basic 组件安装工具的问题",
|
||||
"感谢 @shenmo 提供的 在打包器的 postrm 脚本添加 kill.sh、追加参数改为 --uri xxxxxxx、独立生成容器 7z 文件的功能",
|
||||
"感谢 @a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301",
|
||||
|
||||
@@ -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)
|
||||
53
deb/opt/apps/deepin-wine-runner/trans/__init__.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import json
|
||||
import requests
|
||||
import traceback
|
||||
|
||||
class Trans():
|
||||
isTrans = False
|
||||
unCloudTrans = True
|
||||
word = {}
|
||||
fileName = ""
|
||||
|
||||
def __init__(self, lang="zh_CN", fileName=f"trans.json") -> None:
|
||||
self.fileName = fileName
|
||||
self.isTrans = (lang != "zh_CN")
|
||||
if self.isTrans:
|
||||
try:
|
||||
if not os.path.exists(fileName):
|
||||
with open(fileName, "w") as file:
|
||||
file.write("{}")
|
||||
with open(fileName, "r") as file:
|
||||
self.word = json.loads(file.read())
|
||||
except:
|
||||
traceback.print_exc()
|
||||
self.isTrans = False
|
||||
|
||||
def transe(self, temp, text) -> str:
|
||||
if not self.isTrans:
|
||||
return text
|
||||
try:
|
||||
return self.word[text].replace("(", "(").replace(")", ")")
|
||||
except:
|
||||
if self.unCloudTrans:
|
||||
return text
|
||||
# 机翻
|
||||
data = { 'doctype': 'json', 'type': 'auto','i': text}
|
||||
jsonReturn = requests.post("http://fanyi.youdao.com/translate", data=data).json()["translateResult"]
|
||||
transText = ""
|
||||
for i in jsonReturn:
|
||||
print(i[0])
|
||||
transText += f'{i[0]["tgt"]}\n'
|
||||
if "\n" in text:
|
||||
transText = transText.replace("\n\n", "\n")[:-1]
|
||||
else:
|
||||
transText = transText[:-1]
|
||||
self.word[text] = transText.replace("(", "(").replace(")", ")")
|
||||
try:
|
||||
with open(self.fileName, "w") as file:
|
||||
file.write(json.dumps(self.word, ensure_ascii=False))
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print(f"{text}=>{transText}")
|
||||
return transText
|
||||
@@ -0,0 +1 @@
|
||||
{"更换源": "Change the source", "Gitlink 源(推荐)": "Gitlink source (recommended)", "备用源(只支持 IPv6 用户)": "The alternate source (only support IPv6 users)", "本地测试源(127.0.0.1)": "Local test source (127.0.0.1)", "使用前须知:\n1、Qemu 跨架构效率较低,如果有条件建议优先使用 box86、exagear 等效率较高的转换层;\n2、使用此方案需要使用到 Root 权限(需开启管理员模式)并安装 qemu-user-static;\n3、chroot 时候可能会出现问题导致程序闪退或异常,出现该问题重启电脑即可;\n4、在此环境使用 Wine 时,只能读取到您用户目录或本程序文件夹下的文件,其它路径无法读取;\n5、移除容器时请保证在这次打开电脑时没有调用过需要删除容器,如果有调用过建议重启电脑后再移除;\n6、暂时属于测试功能;": "Instructions before use:\n1, Qemu across architecture efficiency is low, if there is condition is preferred to use box86, exagear high efficiency transformation layer;\n2, use this program to need to use the Root administrator mode (open) and install qemu - user - static;\n3, when chroot flash back problems may cause the program or abnormal, the problems to restart the computer;\n4, in this environment using Wine, can only read your user directory or folder of the program files, other path cannot read;\n5, remove the container please make sure that no calls while in the open a computer need to delete the container, if there is a call after advice to restart the computer to remove;\n6, a temporary belong to test functionality;"}
|
||||
BIN
deb/opt/apps/deepin-wine-runner/vkd3d-proton.7z
Normal file
BIN
deb/opt/apps/deepin-wine-runner/wrestool
Executable file
1
deb/usr/bin/deepin-wine-packager-easy-builder
Symbolic link
@@ -0,0 +1 @@
|
||||
/opt/apps/deepin-wine-runner/deepin-wine-easy-packager.py
|
||||
0
deb/usr/share/applications/spark-deepin-wine-package-builder.desktop
Executable file → Normal file
@@ -0,0 +1,12 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
X-Categories=System;Wine;
|
||||
Exec=/usr/bin/deepin-wine-packager-easy-builder %F
|
||||
Icon=/opt/apps/deepin-wine-runner/deepin-wine-runner.svg
|
||||
Name=Wine Package Builder
|
||||
Name[zh]=Wine 简易打包器
|
||||
Terminal=false
|
||||
StartupNotify=true
|
||||
NoDisplay=true
|
||||
Keywords=exe;scr;
|
||||
MimeType=application/x-ms-dos-executable;application/x-msi;application/x-ms-shortcut;
|
||||
0
deb/usr/share/applications/spark-deepin-wine-packager-with-script.desktop
Executable file → Normal file
0
deb/usr/share/applications/spark-deepin-wine-runner-control-vm.desktop
Executable file → Normal file
0
deb/usr/share/applications/spark-deepin-wine-runner-start-vm.desktop
Executable file → Normal file
0
deb/usr/share/applications/spark-deepin-wine-runner.desktop
Executable file → Normal file
@@ -1,171 +0,0 @@
|
||||
# wine 运行器 1.6.0
|
||||
|
||||
## 介绍
|
||||
一个图形化了以下命令的程序
|
||||
```bash
|
||||
env WINEPREFIX=容器路径 wine(wine的路径) 可执行文件路径
|
||||
```
|
||||
让你可以简易方便的使用 wine
|
||||
是使用 Python3 的 tkinter 构建的
|
||||
(自己美术功底太差,图标只能在网络上找了)
|
||||
(测试平台:deepin 20.6;UOS 家庭版 21;Ubuntu 22.04)
|
||||

|
||||
而打包器可以方便的把您的 wine 容器打包成 deb 包供他人使用,程序创建的 deb 构建临时文件夹目录树如下:
|
||||
```bash
|
||||
/XXX
|
||||
├── DEBIAN
|
||||
│ └── control
|
||||
└── opt
|
||||
└── apps
|
||||
└── XXX
|
||||
├── entries
|
||||
│ ├── applications
|
||||
│ │ └── XXX.desktop
|
||||
│ └── icons
|
||||
│ └── hicolor
|
||||
│ └── scalable
|
||||
│ └── apps
|
||||
│ └── XXX.png(XXX.svg)
|
||||
├── files
|
||||
│ ├── files.7z
|
||||
│ └── run.sh
|
||||
└── info
|
||||
|
||||
11 directories, 6 files
|
||||
```
|
||||
|
||||
## 软件架构
|
||||
i386 和 amd64,deepin-wine、deepin-wine5、wine、wine64、deepin-wine5-stable、deepin-wine6-stable、spark-wine7-devel、ukylin-wine 运行在哪就运行在哪
|
||||
|
||||
|
||||
## 使用说明
|
||||
|
||||
### 均在软件的“小提示”里有说明
|
||||
### 运行器
|
||||
1、使用终端运行该程序,可以看到 wine 以及程序本身的提示和报错;
|
||||
2、wine 32 位和 64 位的容器互不兼容;
|
||||
3、所有的 wine 和 winetricks 均需要自行安装(可以从 菜单栏=>程序 里面进行安装)
|
||||
4、本程序支持带参数运行 wine 程序(之前版本也可以),只需要按以下格式即可:
|
||||
```bash
|
||||
exe路径\' 参数 \'
|
||||
```
|
||||
即可(单引号需要输入)
|
||||
5、wine 容器如果没有指定,则会默认为 ~/.wine
|
||||
### 打包器
|
||||
1、deb 打包软件包名要求:
|
||||
软件包名只能含有小写字母(a-z)、数字(0-9)、加号(+)和减号(-)、以及点号(.),软件包名最短长度两个字符;它必须以字母开头
|
||||
2、如果要填写路径,有“浏览……”按钮的是要填本计算机对应文件的路径,否则就是填写安装到其他计算机使用的路径
|
||||
3、输入 wine 的容器路径时最后面请不要输入“/”
|
||||
4、输入可执行文件的运行路径时是以“C:/XXX/XXX.exe”的格式进行输入,默认是以 C: 为开头,不用“\”做命令的分隔,而是用“/”
|
||||
5、.desktop 的图标只支持 PNG 格式和 SVG 格式,其他格式无法显示图标
|
||||
|
||||
## 更新日志
|
||||
### 1.6.0(2022年07月10日)
|
||||
**※1、新增程序感谢、谢明以及程序的建议和问题反馈和内置更新程序**
|
||||
**※2、支持 winetricks 指定 Wine 打开**
|
||||
**※3、新增窗口透明工具,感谢@a2035274 和 @虚幻的早晨 在论坛的讨论**
|
||||
**※4、支持在指定容器、Wine 安装 MSXML**
|
||||
**※5、支持启用/关闭 opengl(感谢@zhangs 在论坛发帖)以及支持安装/卸载 winbind**
|
||||
**※6、添加云沙箱的网站链接快捷方式**
|
||||
**※7、支持从星火应用商店源安装 Windows 常见字体**
|
||||
8、优化窗口布局以及默认显示位置
|
||||
9、支持打开指定容器、Wine 的资源管理器
|
||||

|
||||
|
||||
### 1.5.3(2022年07月07日)
|
||||
**※1、新增专门的程序设置,支持设置 Wine 容器架构、DEBUG 信息是否输出、默认的 Wine、默认容器路径、是否使用终端打开和 Wine 参数**
|
||||
**※2、修复了 wine 打包器的控件禁用不全和打包的 deb 用户残留的问题**
|
||||
**※3、新增暗黑主题**
|
||||
4、合并了 deepin wine 文管设置器
|
||||

|
||||
|
||||
### 1.5.2(2022年07月06日)
|
||||
**※1、添加并翻新了 deepin-wine5 打包器,改为 wine 打包器,支持常见 wine 的打包**
|
||||
**※2、新增 Visual Studio C++ 的安装程序**
|
||||
**※3、新增从系统安装镜像提取 DLL 到 wine 容器的功能(当前只支持 Windows XP 和 Windows Server 2003 的官方安装镜像)**
|
||||
4、修复了安装星火应用商店的 wine 运行器右键打开方式没有 wine 运行器选项的问题
|
||||
5、新增脚本,优化 deepin terminal 调用本程序脚本显示不佳的问题
|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
### 1.5.1(2022年07月04日)
|
||||
**※1、支持打开 spark-wine7-devel 的专门缩放设置(如未安装则此按钮禁用)**
|
||||
**※2、支持提取选择的 exe 文件的图标**
|
||||
**※3、支持向指定的 wine 容器安装 mono、gecko、.net framework(此功能在菜单栏“Wine”中,卸载只需要使用程序的卸载按钮打开 Geek Uninstaller 即可)**
|
||||
**※4、支持指定特定的 wine 容器调用 winetricks**
|
||||
**※5、在没有指定 wine 容器的情况下,将自动设置为 ~/.wine**
|
||||
6、新增 ukylin-wine
|
||||
7、将默认选择的 wine 改为 deepin-wine6 stable
|
||||
8、支持打开指定容器的 winecfg、winver、regedit、taskmgr
|
||||
9、双击使用 wine 运行器打开 exe(不知道能不能生效)
|
||||

|
||||
|
||||
|
||||
### 1.5.0(2022年07月03日)
|
||||
**※1、支持显示 wine 程序运行时的返回内容**
|
||||
**※2、优化打包方式,减少从 pip 安装的库,并将 pip 源设为阿里源提升下载速度**
|
||||
**※3、新增 spark-wine7-devel**
|
||||
**※4、支持从程序启动用于安装 wine 的程序(在菜单栏的“程序”)**
|
||||
5、优化 wine 安装脚本,在安装星火应用商店的 wine 时支持检测是否有 ss-apt-fast,如果有就调用替代 apt 提升安装速度
|
||||
6、支持关闭指定 wine 的进程,以及访问对应 wine 容器的目录和字体目录
|
||||
7、从生成shell脚本改为升级到desktop文件
|
||||

|
||||
|
||||
|
||||
### 1.4.0(2021年07月27日)
|
||||
**※1、修改了 wine 选项的说明和 wine 的启动方式;**
|
||||
**※2、设置了窗口主题;**
|
||||
**※3、修改了打包以及 .desktop 文件**
|
||||
4、删除了以前的残略调试代码;
|
||||
5、优化了 wine 列表的显示流程;
|
||||
6、更新了“关于”窗口
|
||||
7、更新了提示内容
|
||||
8、在 gitee/github 仓库上添加了 wine 安装脚本
|
||||

|
||||
|
||||
### 1.3.1(2021年05月23日)
|
||||
1、添加了历史记录,使用更加方便
|
||||
2、增加“更新内容”项
|
||||
3、支持浏览窗口的默认路径为上次访问的路径
|
||||
4、支持清空历史记录
|
||||
5、代码结构优化
|
||||
6、修改了控件大小
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
### 1.3.0(2021年05月22日)
|
||||
1. 修改了窗口显示控件的库(从 tkinter 到 tkinter.ttk)
|
||||
2. 添加了更多 wine 可以选择(deepin-wine、deepin-wine5、wine、wine64、deepin-wine5-stable、deepin-wine6-stable)
|
||||
3. 修改了程序的提示信息
|
||||

|
||||
|
||||
### 1.2.0(2021年03月14日)
|
||||
1. 修改布局方式
|
||||
2. 轻度梳理代码布局
|
||||

|
||||
|
||||
### 1.1.2 (未发布发行版)
|
||||
1. 进行了细节优化
|
||||
|
||||
### 1.1.1(2021年01月31日)
|
||||
1. 使用多线程,防止界面假死
|
||||
2. 添加软件图标
|
||||

|
||||
|
||||
### 1.1.0(2021年01月29日)
|
||||
1. 修改了代码的部分内容,使其支持容器路径可带空格无需“\”转义,以及支持手动保存运行脚本到桌面
|
||||
|
||||
### 1.0.0(2021年01月29日)
|
||||
1. 实现内容
|
||||
|
||||
## 更多
|
||||
+ https://gitee.com/gfdgd-xi/deep-wine-runner
|
||||
+ https://github.com/gfdgd-xi/deep-wine-runner
|
||||
+ https://www.gitlink.org.cn/gfdgd_xi/deep-wine-runner
|
||||
|
||||
# ©2020-Now
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
648
deepin-wine-easy-packager.py
Executable file
@@ -0,0 +1,648 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import random
|
||||
import xpinyin
|
||||
import traceback
|
||||
import subprocess
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
def ShowText(text: str):
|
||||
if text.replace(" ", "").replace("\n", "") == "":
|
||||
return
|
||||
logText.append(text.replace("\n", ""))
|
||||
|
||||
def ErrorMessage(text: str):
|
||||
QtWidgets.QMessageBox.critical(window, "错误", text)
|
||||
|
||||
def InformationMessage(text: str):
|
||||
QtWidgets.QMessageBox.information(window, "提示", text)
|
||||
|
||||
questionChoose = False
|
||||
questionStatus = False
|
||||
def QuestionMessage(text: str):
|
||||
global questionChoose
|
||||
global questionStatus
|
||||
# 清零
|
||||
questionChoose = False
|
||||
questionStatus = False
|
||||
if QtWidgets.QMessageBox.question(window, "提示", text) == QtWidgets.QMessageBox.Yes:
|
||||
questionChoose = True
|
||||
print(questionChoose)
|
||||
questionStatus = True
|
||||
return
|
||||
questionChoose = False
|
||||
questionStatus = True
|
||||
|
||||
|
||||
def DisbledAndEnabledAll(choose: bool):
|
||||
exePath.setDisabled(choose)
|
||||
browserExeButton.setDisabled(choose)
|
||||
buildButton.setDisabled(choose)
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
def get_desktop_path():
|
||||
try:
|
||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||
if desktop_index != -1: # 如果有对应项
|
||||
break # 结束循环
|
||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||
return -1
|
||||
else:
|
||||
get = line[17:-2] # 截取桌面目录路径
|
||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||
if get != -1: # 如果有
|
||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||
return get # 返回目录
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return get_home()
|
||||
|
||||
def CleanPressCompleteDownloadState(option):
|
||||
global pressCompleteDownload
|
||||
pressCompleteDownload = False
|
||||
installCmpleteButton.setEnabled(True)
|
||||
|
||||
# 读取 lnk 文件
|
||||
def GetLnkDesktop(path):
|
||||
lnkList = []
|
||||
for i in os.listdir(path):
|
||||
filePath = f"{path}/{i}"
|
||||
if os.path.islink(filePath):
|
||||
# 忽略 link 链接
|
||||
continue
|
||||
if os.path.isdir(filePath):
|
||||
lists = GetLnkDesktop(filePath)
|
||||
for k in lists:
|
||||
lnkList.append(k)
|
||||
continue
|
||||
if os.path.isfile(filePath) and os.path.splitext(filePath)[1] == ".lnk":
|
||||
with open(filePath, "rb") as file:
|
||||
while True:
|
||||
things = file.readline().lower()
|
||||
if things == b"":
|
||||
break
|
||||
print(things[1: -2].split("\x00".encode("gbk")))
|
||||
for k in things[1: -2].split("\x00".encode("gbk")):
|
||||
if "c:".encode("gbk") in k:
|
||||
print(k.decode("gbk"))
|
||||
lnkList.append([filePath, k.decode("gbk")])
|
||||
return lnkList
|
||||
|
||||
def ReplaceText(string: str, lists: list):
|
||||
for i in lists:
|
||||
string = string.replace(i[0], i[1])
|
||||
return string
|
||||
|
||||
control = '''Package: @@@Package@@@
|
||||
Version: @@@Version@@@
|
||||
Architecture: i386
|
||||
Maintainer: @@@Maintainer@@@
|
||||
Depends: @@@Depends@@@
|
||||
Section: non-free/otherosfs
|
||||
Priority: optional
|
||||
Multi-Arch: foreign
|
||||
Installed-Size: @@@Installed-Size@@@
|
||||
Description: @@@Description@@@
|
||||
'''
|
||||
|
||||
info = f'''{{
|
||||
"appid": "@@@Package@@@",
|
||||
"name": "@@@Name@@@",
|
||||
"version": "@@@Version@@@",
|
||||
"arch": ["i386"],
|
||||
"permissions": {{
|
||||
"autostart": false,
|
||||
"notification": false,
|
||||
"trayicon": true,
|
||||
"clipboard": true,
|
||||
"account": false,
|
||||
"bluetooth": false,
|
||||
"camera": true,
|
||||
"audio_record": true,
|
||||
"installed_apps": false
|
||||
}}
|
||||
}}'''
|
||||
|
||||
postrm = f"""#!/bin/bash
|
||||
if [ "$1" = "remove" ] || [ "$1" = "purge" ];then
|
||||
|
||||
echo "清理卸载残留"
|
||||
CONTAINER_NAME="@@@Package@@@"
|
||||
|
||||
if [ -z $CONTAINER_NAME ];then
|
||||
echo "W: 没有指定容器,跳过清理容器。请手动前往 ~/.deepinwine/ 下删除"
|
||||
exit
|
||||
fi
|
||||
|
||||
/opt/deepinwine/tools/kill.sh $CONTAINER_NAME
|
||||
###这里注意,如果没写CONTAINER_NAME,会把QQ杀了
|
||||
|
||||
for username in $(ls /home)
|
||||
do
|
||||
echo /home/$username
|
||||
if [ -d /home/$username/.deepinwine/$CONTAINER_NAME ]
|
||||
then
|
||||
rm -rf /home/$username/.deepinwine/$CONTAINER_NAME
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "非卸载,跳过清理"
|
||||
fi"""
|
||||
|
||||
runsh = f'''#!/bin/sh
|
||||
|
||||
# Copyright (C) 2016 Deepin, Inc.
|
||||
#
|
||||
# Author: Li LongYu <lilongyu@linuxdeepin.com>
|
||||
# Peng Hao <penghao@linuxdeepin.com>
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2022 The Spark Project
|
||||
#
|
||||
#
|
||||
# Modifier shenmo <shenmo@spark-app.store>
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
#######################函数段。下文调用的额外功能会在此处声明
|
||||
|
||||
Get_Dist_Name()
|
||||
{{
|
||||
if grep -Eqii "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then
|
||||
DISTRO='Deepin'
|
||||
elif grep -Eqi "UnionTech" /etc/issue || grep -Eq "UnionTech" /etc/*-release; then
|
||||
DISTRO='UniontechOS'
|
||||
else
|
||||
DISTRO='OtherOS'
|
||||
fi
|
||||
}}
|
||||
|
||||
|
||||
####获得发行版名称
|
||||
|
||||
#########################预设值段
|
||||
|
||||
version_gt() {{ test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }}
|
||||
####用于比较版本?未实装
|
||||
BOTTLENAME="@@@Package@@@"
|
||||
APPVER="@@@Version@@@"
|
||||
EXEC_PATH="@@@EXEC_PATH@@@"
|
||||
##### 软件在wine中的启动路径
|
||||
START_SHELL_PATH="/opt/deepinwine/tools/spark_run_v4.sh"
|
||||
export MIME_TYPE=""
|
||||
#####没什么用
|
||||
export DEB_PACKAGE_NAME="@@@Package@@@"
|
||||
####这里写包名才能在启动的时候正确找到files.7z,似乎也和杀残留进程有关
|
||||
export APPRUN_CMD="deepin-wine6-stable"
|
||||
#####wine启动指令,建议
|
||||
EXPORT_ENVS=""
|
||||
|
||||
export SPECIFY_SHELL_DIR=`dirname $START_SHELL_PATH`
|
||||
|
||||
ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files"
|
||||
|
||||
export WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64
|
||||
|
||||
export WINEPREDLL="$ARCHIVE_FILE_DIR/dlls"
|
||||
|
||||
DISABLE_ATTACH_FILE_DIALOG=""
|
||||
##默认为空。若为1,则不使用系统自带的文件选择,而是使用wine的
|
||||
##对于deepin/UOS,大部分的应用都不需要使用wine的,如果有需求(比如wine应用选择的限定种类文件系统的文管不支持)
|
||||
##请填1。
|
||||
##注意:因为非DDE的环境不确定,所以默认会在非Deepin/UOS发行版上禁用这个功能。如果你确认在适配的发行版上可以正常启动,请注释或者删除下面这段
|
||||
|
||||
##############<<<<<<<<<禁用文件选择工具开始
|
||||
Get_Dist_Name
|
||||
#此功能实现参见结尾函数段
|
||||
if [ "$DISTRO" != "Deepin" ] && [ "$DISTRO" != "UniontechOS" ];then
|
||||
DISABLE_ATTACH_FILE_DIALOG="1"
|
||||
echo "非deepin/UOS,默认关闭系统自带的文件选择工具,使用Wine的"
|
||||
echo "如果你想改变这个行为,请到/opt/apps/$DEB_PACKAGE_NAME/files/$0处修改"
|
||||
echo "To打包者:如果你要打开自带请注意在适配的发行版上进行测试"
|
||||
echo "To用户:打包者没有打开这个功能,这证明启用这个功能可能造成运行问题。如果你要修改这个行为,请确保你有一定的动手能力"
|
||||
fi
|
||||
##############>>>>>>>>>禁用文件选择工具结束
|
||||
|
||||
##############<<<<<<<<<屏蔽mono和gecko安装器开始
|
||||
##默认屏蔽mono和gecko安装器
|
||||
#if [ "$APPRUN_CMD" = "spark-wine7-devel" ];then
|
||||
|
||||
#export WINEDLLOVERRIDES="mscoree,mshtml="
|
||||
#echo "为了降低打包体积,默认关闭gecko和momo,如有需要,注释此行(仅对spark-wine7-devel有效)"
|
||||
|
||||
#fi
|
||||
##############>>>>>>>>>屏蔽mono和gecko安装器结束
|
||||
|
||||
#########################执行段
|
||||
|
||||
|
||||
|
||||
|
||||
if [ -z "$DISABLE_ATTACH_FILE_DIALOG" ];then
|
||||
export ATTACH_FILE_DIALOG=1
|
||||
fi
|
||||
|
||||
if [ -n "$EXPORT_ENVS" ];then
|
||||
export $EXPORT_ENVS
|
||||
fi
|
||||
|
||||
if [ -n "$EXEC_PATH" ];then
|
||||
if [ -z "${{EXEC_PATH##*.lnk*}}" ];then
|
||||
$START_SHELL_PATH $BOTTLENAME $APPVER "C:/windows/command/start.exe" "/Unix" "$EXEC_PATH" "$@"
|
||||
else
|
||||
$START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" "$@"
|
||||
fi
|
||||
else
|
||||
$START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@"
|
||||
fi'''
|
||||
|
||||
desktopFile = f'''#!/usr/bin/env xdg-open
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=Application
|
||||
X-Created-By=@@@Maintainer@@@
|
||||
Icon=@@@Icon@@@
|
||||
Exec="/opt/apps/@@@Package@@@/files/run.sh"
|
||||
Name=@@@Name@@@
|
||||
Comment=@@@Description@@@
|
||||
MimeType=
|
||||
GenericName=@@@Package@@@
|
||||
Terminal=false
|
||||
StartupNotify=false'''
|
||||
|
||||
def getFileFolderSize(fileOrFolderPath):
|
||||
"""get size for file or folder"""
|
||||
totalSize = 0
|
||||
if not os.path.exists(fileOrFolderPath):
|
||||
return totalSize
|
||||
if os.path.isfile(fileOrFolderPath):
|
||||
totalSize = os.path.getsize(fileOrFolderPath) # 5041481
|
||||
return totalSize
|
||||
if os.path.isdir(fileOrFolderPath):
|
||||
with os.scandir(fileOrFolderPath) as dirEntryList:
|
||||
for curSubEntry in dirEntryList:
|
||||
curSubEntryFullPath = os.path.join(fileOrFolderPath, curSubEntry.name)
|
||||
if curSubEntry.is_dir():
|
||||
curSubFolderSize = getFileFolderSize(curSubEntryFullPath) # 5800007
|
||||
totalSize += curSubFolderSize
|
||||
elif curSubEntry.is_file():
|
||||
curSubFileSize = os.path.getsize(curSubEntryFullPath) # 1891
|
||||
totalSize += curSubFileSize
|
||||
return totalSize
|
||||
|
||||
|
||||
def WriteTxt(path, things):
|
||||
with open(path, "w") as file:
|
||||
file.write(things)
|
||||
|
||||
def ReadTxt(path):
|
||||
things = ""
|
||||
with open(path, "r") as file:
|
||||
things = file.read()
|
||||
return things
|
||||
|
||||
def GetEXEVersion(exePath):
|
||||
versionPath = f"/tmp/wine-runner-exe-version-{random.randint(0, 1000)}.txt"
|
||||
if os.system(f"deepin-wine6-stable '{programPath}/GetEXEVersion.exe' '{exePath}' '{versionPath}'"):
|
||||
return "1.0.0"
|
||||
try:
|
||||
exeVersion = ReadTxt(versionPath).replace("\n", "")
|
||||
if exeVersion.replace(" ", "") == "":
|
||||
return "1.0.0"
|
||||
return exeVersion
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return "1.0.0"
|
||||
|
||||
def StrToByteToStr(text: str):
|
||||
lists = text.split("\\x")
|
||||
for i in range(len(lists)):
|
||||
lists[i]
|
||||
return text
|
||||
|
||||
def UnUseUpperCharPath(path: str):
|
||||
pathList = []
|
||||
lowerList = path.split("/")[1:]
|
||||
for i in lowerList:
|
||||
path = "/" + "/".join(pathList)
|
||||
before = len(pathList)
|
||||
for k in os.listdir(path):
|
||||
if k.lower() == i.lower():
|
||||
pathList.append(k)
|
||||
break
|
||||
end = len(pathList)
|
||||
if before == end:
|
||||
raise OSError("文件路径不存在")
|
||||
return "/" + "/".join(pathList)
|
||||
|
||||
def ReadMe():
|
||||
QtWidgets.QMessageBox.information(window, "提示", """1、目前只支持打包 X86 架构的 deb 包,暂未支持 arm;
|
||||
2、需要区分要打包的程序是绿色软件还是单文件安装包,两个对应的打包方式不相同;
|
||||
3、打包绿色软件时为尽可能减小程序体积,请将绿化后的程序(或程序文件夹)单独拷贝到干净的目录后再浏览选择主程序打包;
|
||||
4、打包详情:
|
||||
①调用 Wine:Deepin Wine6 Stable
|
||||
②调用 Helper:Spark Wine Helper
|
||||
③有卸载自动移除容器脚本""")
|
||||
|
||||
|
||||
class RunThread(QtCore.QThread):
|
||||
showLogText = QtCore.pyqtSignal(str)
|
||||
error = QtCore.pyqtSignal(str)
|
||||
info = QtCore.pyqtSignal(str)
|
||||
question = QtCore.pyqtSignal(str)
|
||||
disbledAll = QtCore.pyqtSignal(bool)
|
||||
cleanPressState = QtCore.pyqtSignal(bool)
|
||||
def RunCommand(self, command):
|
||||
res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
while res.poll() is None:
|
||||
try:
|
||||
text = res.stdout.readline().decode("utf8")
|
||||
except:
|
||||
text = ""
|
||||
self.showLogText.emit(text)
|
||||
print(text, end="")
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
def GetEXEVersion(self, exePath):
|
||||
versionPath = f"/tmp/wine-runner-exe-version-{random.randint(0, 1000)}.txt"
|
||||
self.RunCommand(f"deepin-wine6-stable '{programPath}/GetEXEVersion.exe' '{exePath}' '{versionPath}'")
|
||||
try:
|
||||
exeVersion = ReadTxt(versionPath).replace("\n", "")
|
||||
if exeVersion.replace(" ", "") == "":
|
||||
return "1.0.0"
|
||||
return exeVersion
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return "1.0.0"
|
||||
|
||||
def QuestionMsg(self, text):
|
||||
global questionStatus
|
||||
questionStatus = False
|
||||
self.question.emit(text)
|
||||
while not questionStatus:
|
||||
time.sleep(0.1)
|
||||
print(questionChoose)
|
||||
return questionChoose
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.disbledAll.emit(True)
|
||||
if not self.QuestionMsg("在此过程中,需要回答一系列的问题以进行打包,点击确定继续"):
|
||||
self.disbledAll.emit(False)
|
||||
return
|
||||
bottlePath = f"/tmp/deepin-wine-runner-bottle-{random.randint(0, 10000)}"
|
||||
# 清空容器以保证能正常使用
|
||||
if os.path.exists(bottlePath):
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}'")
|
||||
############# 后面将全部调用 deepin wine6 stable 进行操作
|
||||
exeName = os.path.basename(exePath.text())
|
||||
# 暂定
|
||||
packageName = xpinyin.Pinyin().get_pinyin(os.path.splitext(exeName)[0].replace(" ", ""), "").lower().replace(" ", "").replace("_", ".").replace("-", ".").replace("..", ".")
|
||||
|
||||
if " " in packageName:
|
||||
packageName = ""
|
||||
for i in os.path.splitext(exeName)[0].split(" "):
|
||||
packageName += xpinyin.Pinyin().get_pinyin(i).lower().replace(" ", "").replace("_", ".").replace("-", ".").replace("..", ".") + "."
|
||||
print(packageName)
|
||||
packageName = packageName[:-1]
|
||||
debPackageName = "com." + packageName + ".spark"
|
||||
debPackageVersion = "1.0.0"
|
||||
programIconPath = f"/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/{debPackageName}.png"
|
||||
debMaintainer = os.getlogin()
|
||||
debBuildPath = f"/tmp/deepin-wine-packager-builder-{debPackageName}-{random.randint(0, 1000)}"
|
||||
bottlePackagePath = f"{debBuildPath}/opt/apps/{debPackageName}/files/files.7z"
|
||||
desktopPath = get_desktop_path()
|
||||
############## 运行 EXE
|
||||
if self.QuestionMsg("请问此可执行文件是安装包还是绿色软件?是安装包请按 Yes,绿色软件按 No"):
|
||||
# 清空无益处的 lnk 文件
|
||||
lnkPath = f"{bottlePath}/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs"
|
||||
self.RunCommand(f"rm -rfv '{lnkPath}'")
|
||||
self.RunCommand(f"mkdir -pv '{bottlePath}'")
|
||||
self.RunCommand(f"chmod 777 -Rv '{bottlePath}'")
|
||||
# 禁止生成 .desktop 文件
|
||||
self.RunCommand(f"WINEPREFIX='{bottlePath}' deepin-wine6-stable 'reg' 'add' 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v winemenubuilder.exe '/f'")
|
||||
# 安装包
|
||||
self.info.emit("请在运行完安装程序后按下打包器主界面的“安装程序执行完成按钮”以进行下一步操作")
|
||||
global pressCompleteDownload
|
||||
pressCompleteDownload = False
|
||||
installCmpleteButton.setEnabled(True)
|
||||
self.RunCommand(f"WINEPREFIX='{bottlePath}' deepin-wine6-stable '{exePath.text()}' &") # 非堵塞线程
|
||||
|
||||
# 安装锁,锁解除后才可继续
|
||||
while not pressCompleteDownload:
|
||||
time.sleep(0.1)
|
||||
# 杀死容器内应用
|
||||
self.RunCommand(f"'{programPath}/kill.sh' '{os.path.basename(bottlePath)}'")
|
||||
# 识别 lnk
|
||||
lnkList = GetLnkDesktop(lnkPath)
|
||||
if len(lnkList) <= 0:
|
||||
self.error.emit("无法识别到任何 lnk 快捷方式")
|
||||
self.RunCommand(f"rm -rfv '{debBuildPath}' > /dev/null")
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}' > /dev/null")
|
||||
self.disbledAll.emit(False)
|
||||
return
|
||||
# 选择最优 lnk
|
||||
secondChooseList = []
|
||||
for k in lnkList:
|
||||
lnkPath = k[0].lower()
|
||||
lnkExePath = k[1].lower()
|
||||
if "卸载" in lnkPath or "uninstall" in lnkPath or "update" in lnkPath or "网页" in lnkPath or "websize" in lnkPath or not ".exe" in lnkExePath:
|
||||
continue
|
||||
secondChooseList.append(k)
|
||||
if len(secondChooseList) <= 0:
|
||||
secondChooseList = lnkList
|
||||
rightLnk = secondChooseList[0]
|
||||
miniLenge = len(rightLnk[1])
|
||||
for k in secondChooseList:
|
||||
# 择优选择路径最短一项
|
||||
if len(k[1]) < miniLenge:
|
||||
rightLnk = k
|
||||
miniLenge = len(rightLnk[1])
|
||||
debPackageName = "com." + xpinyin.Pinyin().get_pinyin(os.path.splitext(os.path.basename(rightLnk[0]))[0].replace(" ", "")).lower().replace("--", "-").replace(" ", "").replace("_", "-").replace("-", ".") + ".spark"
|
||||
programIconPath = f"/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/{debPackageName}.png"
|
||||
bottlePackagePath = f"{debBuildPath}/opt/apps/{debPackageName}/files/files.7z"
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/'")
|
||||
folderExePath = os.path.dirname(rightLnk[1].replace("\\", "/").replace("c:/", bottlePath))
|
||||
exePathInBottle = rightLnk[1]
|
||||
exeName = os.path.splitext(os.path.basename(folderExePath))[0]
|
||||
exePathInSystem = rightLnk[1].replace("\\", "/").replace("c:", f"{bottlePath}/drive_c")
|
||||
debPackageVersion = self.GetEXEVersion(exePathInSystem)
|
||||
cpNow = False
|
||||
for i in iconList:
|
||||
path = i[1].replace("wineBottonPath", bottlePath).lower()
|
||||
if path == exePathInSystem.lower():
|
||||
self.RunCommand(f"cp -rv '{programPath}/Icon/{i[0]}.svg' '{debBuildPath}/{programIconPath}'")
|
||||
exeName = i[0]
|
||||
cpNow = True
|
||||
break
|
||||
if not cpNow:
|
||||
self.RunCommand(f"'{programPath}/wrestool' '{UnUseUpperCharPath(exePathInSystem)}' -x -t 14 > '{debBuildPath}/{programIconPath}'")
|
||||
else:
|
||||
#/home/gfdgd_xi/Desktop/新建文件夹1/BeCyIconGrabber.exe
|
||||
# 绿色软件
|
||||
self.RunCommand(f"mkdir -pv '{bottlePath}'")
|
||||
self.RunCommand(f"chmod 777 -Rv '{bottlePath}'")
|
||||
self.RunCommand(f"WINEPREFIX='{bottlePath}' deepin-wine6-stable exit")
|
||||
folderExePath = os.path.dirname(exePath.text())
|
||||
exePathInBottle = f"c:/Program Files/{os.path.basename(folderExePath)}/{exeName}"
|
||||
exeName = os.path.splitext(os.path.basename(os.path.basename(exePath.text())))[0]
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/'")
|
||||
self.RunCommand(f"'{programPath}/wrestool' '{exePath.text()}' -x -t 14 > '{debBuildPath}/{programIconPath}'")
|
||||
# 拷贝文件到容器
|
||||
self.RunCommand(f"cp -rv '{folderExePath}' '{bottlePath}/drive_c/Program Files'")
|
||||
debPackageVersion = self.GetEXEVersion(exePath.text())
|
||||
debDescription = f"{exeName} By Deepin Wine 6 Stable And Build By Wine Runner Easy Packager"
|
||||
debDepends = "deepin-wine6-stable, spark-dwine-helper | store.spark-app.spark-dwine-helper, fonts-wqy-microhei, fonts-wqy-zenhei"
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/DEBIAN'")
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/files'")
|
||||
self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/applications'")
|
||||
#self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/'")
|
||||
############ 处理容器
|
||||
# 对用户目录进行处理
|
||||
os.chdir(bottlePath)
|
||||
self.RunCommand("sed -i \"s#$USER#@current_user@#\" ./*.reg")
|
||||
os.chdir(f"{bottlePath}/drive_c/users")
|
||||
# 如果缩放文件 scale.txt 存在,需要移除以便用户自行调节缩放设置
|
||||
if os.path.exists(f"{bottlePath}/scale.txt"):
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}/scale.txt'")
|
||||
# 删除因为脚本失误导致用户目录嵌套(如果存在)
|
||||
if os.path.exists(f"{bottlePath}/drive_c/users/@current_user@/@current_user@"):
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}/drive_c/users/@current_user@/@current_user@'")
|
||||
self.RunCommand(f"mv -fv '{os.getlogin()}' @current_user@")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/我的'*")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/My '*")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/Desktop'")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/Downloads'")
|
||||
self.RunCommand(f"rm -fv '{bottlePath}/drive_c/users/@current_user@/Templates'")
|
||||
########### 打包容器
|
||||
self.RunCommand(f"7z a '{bottlePackagePath}' '{bottlePath}/'*")
|
||||
########### 生成文件内容
|
||||
buildProgramSize = getFileFolderSize(debBuildPath) / 1000
|
||||
replaceMap = [
|
||||
["@@@Package@@@", debPackageName],
|
||||
["@@@Version@@@", debPackageVersion],
|
||||
["@@@Maintainer@@@", debMaintainer],
|
||||
["@@@Depends@@@", debDepends],
|
||||
["@@@Description@@@", debDescription],
|
||||
["@@@Installed-Size@@@", str(buildProgramSize)],
|
||||
["@@@Name@@@", exeName],
|
||||
["@@@EXEC_PATH@@@", exePathInBottle],
|
||||
["@@@Icon@@@", programIconPath]
|
||||
]
|
||||
debControl = ReplaceText(control, replaceMap)
|
||||
debPostrm = ReplaceText(postrm, replaceMap)
|
||||
debInfo = ReplaceText(info, replaceMap)
|
||||
debRunSh = ReplaceText(runsh, replaceMap)
|
||||
debDesktop = ReplaceText(desktopFile, replaceMap)
|
||||
########### 写入文件
|
||||
WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/entries/applications/{debPackageName}.desktop", debDesktop)
|
||||
WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/files/run.sh", debRunSh)
|
||||
WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/info", debInfo)
|
||||
WriteTxt(f"{debBuildPath}/DEBIAN/control", debControl)
|
||||
WriteTxt(f"{debBuildPath}/DEBIAN/postrm", debPostrm)
|
||||
########### 赋值权限
|
||||
self.RunCommand(f"chmod -Rv 644 '{debBuildPath}/opt/apps/{debPackageName}/info'")
|
||||
self.RunCommand(f"chmod -Rv 0755 '{debBuildPath}/DEBIAN'")
|
||||
self.RunCommand(f"chmod -Rv 755 '{debBuildPath}/opt/apps/{debPackageName}/files/'*.sh")
|
||||
self.RunCommand(f"chmod -Rv 755 '{debBuildPath}/opt/apps/{debPackageName}/entries/applications/'*.desktop")
|
||||
########### 打包 deb
|
||||
print(debPackageVersion)
|
||||
self.RunCommand(f"dpkg -b '{debBuildPath}' '{desktopPath}/{debPackageName}_{debPackageVersion}_i386.deb'")
|
||||
self.info.emit("打包完成!")
|
||||
self.disbledAll.emit(False)
|
||||
########### 移除临时文件
|
||||
self.RunCommand(f"rm -rfv '{debBuildPath}' > /dev/null")
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}' > /dev/null")
|
||||
except:
|
||||
self.RunCommand(f"rm -rfv '{debBuildPath}' > /dev/null")
|
||||
self.RunCommand(f"rm -rfv '{bottlePath}' > /dev/null")
|
||||
# 若打包出现任何错误
|
||||
traceback.print_exc()
|
||||
self.error.emit(f"打包错误,详细详细如下:{traceback.format_exc()}")
|
||||
self.showLogText.emit(traceback.format_exc())
|
||||
self.disbledAll.emit(False)
|
||||
|
||||
#/home/gfdgd_xi/Downloads/XPcalc.exe
|
||||
def RunBuildThread():
|
||||
global buildThread
|
||||
buildThread = RunThread()
|
||||
buildThread.showLogText.connect(ShowText)
|
||||
buildThread.error.connect(ErrorMessage)
|
||||
buildThread.info.connect(InformationMessage)
|
||||
buildThread.question.connect(QuestionMessage)
|
||||
buildThread.disbledAll.connect(DisbledAndEnabledAll)
|
||||
buildThread.cleanPressState.connect(CleanPressCompleteDownloadState)
|
||||
logText.clear()
|
||||
buildThread.start()
|
||||
|
||||
pressCompleteDownload = False
|
||||
|
||||
def PressCompleteDownload():
|
||||
global pressCompleteDownload
|
||||
pressCompleteDownload = True
|
||||
installCmpleteButton.setDisabled(True)
|
||||
|
||||
def BrowserExe():
|
||||
filePath = QtWidgets.QFileDialog.getOpenFileName(window, "选择 exe", get_home(), "可执行文件(*.exe);;所有文件(*.*)")
|
||||
if filePath[0] != "" or filePath[0] != None:
|
||||
exePath.setText(filePath[0])
|
||||
|
||||
if __name__ == "__main__":
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
|
||||
information = json.loads(ReadTxt(f"{programPath}/information.json"))
|
||||
iconListUnBuild = json.loads(ReadTxt(f"{programPath}/IconList.json"))[0]
|
||||
iconList = json.loads(ReadTxt(f"{programPath}/IconList.json"))[1]
|
||||
for i in iconListUnBuild:
|
||||
iconList.append(i)
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
version = information["Version"]
|
||||
window = QtWidgets.QMainWindow()
|
||||
widget = QtWidgets.QWidget()
|
||||
layout = QtWidgets.QGridLayout()
|
||||
exePath = QtWidgets.QLineEdit()
|
||||
browserExeButton = QtWidgets.QPushButton("浏览……")
|
||||
logText = QtWidgets.QTextBrowser()
|
||||
logText.setStyleSheet("""
|
||||
background-color: black;
|
||||
color: white;
|
||||
""")
|
||||
controlLayout = QtWidgets.QHBoxLayout()
|
||||
buildButton = QtWidgets.QPushButton("现在打包……")
|
||||
installCmpleteButton = QtWidgets.QPushButton("安装程序执行完成")
|
||||
helpButton = QtWidgets.QPushButton("帮助")
|
||||
browserExeButton.clicked.connect(BrowserExe)
|
||||
buildButton.clicked.connect(RunBuildThread)
|
||||
installCmpleteButton.clicked.connect(PressCompleteDownload)
|
||||
helpButton.clicked.connect(ReadMe)
|
||||
installCmpleteButton.setDisabled(True)
|
||||
controlLayout.addWidget(buildButton)
|
||||
controlLayout.addWidget(installCmpleteButton)
|
||||
controlLayout.addWidget(helpButton)
|
||||
layout.addWidget(QtWidgets.QLabel("选择 EXE:"), 0, 0)
|
||||
layout.addWidget(exePath, 0, 1)
|
||||
layout.addWidget(browserExeButton, 0, 2)
|
||||
layout.addLayout(controlLayout, 1, 1)
|
||||
layout.addWidget(logText, 2, 0, 1, 3)
|
||||
widget.setLayout(layout)
|
||||
window.setCentralWidget(widget)
|
||||
window.setWindowTitle(f"Wine 运行器 {version}——简易打包器")
|
||||
try:
|
||||
exePath.setText(sys.argv[1])
|
||||
except:
|
||||
pass
|
||||
window.resize(int(window.frameGeometry().width() * 1.2), int(window.frameGeometry().height() * 1.1))
|
||||
window.show()
|
||||
sys.exit(app.exec_())
|
||||
@@ -23,23 +23,24 @@ from PIL import Image
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
from trans import *
|
||||
|
||||
#################
|
||||
# 程序所需事件
|
||||
#################
|
||||
|
||||
def button1_cl():
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(widget, QtCore.QCoreApplication.translate("U", "选择 wine 容器"), f"{get_home()}/.deepinwine")
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(widget, transla.transe("U", "选择 wine 容器"), f"{get_home()}/.deepinwine")
|
||||
if path != "":
|
||||
e6_text.setText(path)
|
||||
|
||||
def button2_cl(number):
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(widget, QtCore.QCoreApplication.translate("U", "选择图标文件"), get_home(), "PNG图标(*.png);;SVG图标(*.svg);;全部文件(*.*)")[0]
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(widget, transla.transe("U", "选择图标文件"), get_home(), "PNG图标(*.png);;SVG图标(*.svg);;全部文件(*.*)")[0]
|
||||
if path != "":
|
||||
mapLink[number].setText(path)
|
||||
|
||||
def button4_cl():
|
||||
path = QtWidgets.QFileDialog.getSaveFileName(widget, QtCore.QCoreApplication.translate("U", "保存 deb 包"), get_home(), "deb 文件(*.deb);;所有文件(*.*)", "{}_{}_i386.deb".format(e1_text.text(), e2_text.text()))[0]
|
||||
path = QtWidgets.QFileDialog.getSaveFileName(widget, transla.transe("U", "保存 deb 包"), get_home(), "deb 文件(*.deb);;所有文件(*.*)", "{}_{}_i386.deb".format(e1_text.text(), e2_text.text()))[0]
|
||||
if path != "":
|
||||
e12_text.setText(path)
|
||||
|
||||
@@ -203,14 +204,41 @@ def Build7zButton_Clicked():
|
||||
QT.thread.start()
|
||||
|
||||
def make_deb(build=False):
|
||||
global bottleNameLock
|
||||
clean_textbox1_things()
|
||||
disabled_or_NORMAL_all(False)
|
||||
if e1_text.text() == "" or e2_text.text() == "" or e3_text.text() == "" or e4_text.text() == "" or e5_text.text() == "" or e6_text.text() == "" or e7_text.text() == "" or e8_text.text() == "" or e12_text.text() == "":
|
||||
badComplete = False
|
||||
# 规范检测
|
||||
if e1_text.text().lower() != e1_text.text():
|
||||
if QtWidgets.QMessageBox.warning(window, "提示", f"包名 {e1_text.text()} 似乎不符合规范,可能会导致打包后的包无法投稿到应用商店,是否继续?\n可参考 deb 安装包打包标准", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("用户已取消")
|
||||
return
|
||||
for i in range(len(iconUiList)):
|
||||
if os.path.splitext(iconUiList[i][4].text())[1] == ".ico":
|
||||
if QtWidgets.QMessageBox.warning(window, "提示", f"图标 {iconUiList[i][4].text()} 似乎为 ico 格式,可能会导致打包后的程序在启动器的图标无法正常显示,是否继续?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("用户已取消")
|
||||
return
|
||||
if os.path.exists(iconUiList[i][0].text()) and not "c:" in iconUiList[i][0].text().lower():
|
||||
if not e6_text.text() in iconUiList[i][0].text():
|
||||
if QtWidgets.QMessageBox.warning(window, "提示", f"路径 {iconUiList[i][0].text()} 似乎不符合规范且不位于容器内,可能会导致打包后的程序无法运行,是否继续?\n可参考 Windows 下的文件路径", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("用户已取消")
|
||||
return
|
||||
if QtWidgets.QMessageBox.warning(window, "提示", f"路径 {iconUiList[i][0].text()} 似乎不符合规范,可能会导致打包后的程序无法运行,是否继续?\n可参考 Windows 下的文件路径", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("用户已取消")
|
||||
return
|
||||
for k in [0, 3]:
|
||||
if iconUiList[i][k].text().replace(" ", "") == "":
|
||||
badComplete = True
|
||||
if badComplete or e1_text.text() == "" or e2_text.text() == "" or e3_text.text() == "" or e4_text.text() == "" or e5_text.text() == "" or e6_text.text() == "" or e7_text.text() == "" or e8_text.text() == "" or e12_text.text() == "":
|
||||
QtWidgets.QMessageBox.critical(widget, "错误", "必填信息没有填写完整,无法继续构建 deb 包")
|
||||
disabled_or_NORMAL_all(True)
|
||||
label13_text_change("必填信息没有填写完整,无法继续构建 deb 包")
|
||||
return
|
||||
if QtWidgets.QMessageBox.question(widget, QtCore.QCoreApplication.translate("U", "提示"), QtCore.QCoreApplication.translate("U", "打包将会改动现在选择的容器,是否继续?")) == QtWidgets.QMessageBox.No:
|
||||
if QtWidgets.QMessageBox.question(widget, transla.transe("U", "提示"), transla.transe("U", "打包将会改动现在选择的容器,是否继续?")) == QtWidgets.QMessageBox.No:
|
||||
disabled_or_NORMAL_all(True)
|
||||
return
|
||||
# 警告信息
|
||||
@@ -232,6 +260,7 @@ def make_deb(build=False):
|
||||
QT.thread.errorMsg.connect(ErrorMsg)
|
||||
QT.thread.infoMsg.connect(InfoMsg)
|
||||
QT.thread.disabled_or_NORMAL_all.connect(disabled_or_NORMAL_all)
|
||||
bottleNameLock = False
|
||||
QT.thread.start()
|
||||
#thread.start()
|
||||
|
||||
@@ -245,7 +274,6 @@ def ReplaceText(string: str, lists: list):
|
||||
return string
|
||||
|
||||
class make_deb_threading(QtCore.QThread):
|
||||
|
||||
signal = QtCore.pyqtSignal(str)
|
||||
label = QtCore.pyqtSignal(str)
|
||||
getSavePath = QtCore.pyqtSignal(str)
|
||||
@@ -1204,7 +1232,7 @@ fi
|
||||
# 获取文件大小
|
||||
################
|
||||
self.label.emit("正在计算文件大小……")
|
||||
size = int(getFileFolderSize(debPackagePath) / 1024)
|
||||
size = int(getFileFolderSize(debPackagePath) / 1000)
|
||||
################
|
||||
# 写入文本文档
|
||||
################
|
||||
@@ -1324,6 +1352,12 @@ StartupNotify=false
|
||||
self.label.emit("正在构建 deb 包……")
|
||||
self.run_command("bash -c 'dpkg -b \"{}\" \"{}\"'".format(debPackagePath, e12_text.text()))
|
||||
################
|
||||
# 删除临时文件
|
||||
################
|
||||
if not self.build:
|
||||
self.label.emit("正在删除临时文件……")
|
||||
self.run_command(f"rm -rfv '{debPackagePath}'")
|
||||
################
|
||||
# 完成构建
|
||||
################
|
||||
self.label.emit("完成构建!")
|
||||
@@ -1689,7 +1723,7 @@ mapLink = []
|
||||
|
||||
def AddTab():
|
||||
global mapLink
|
||||
button2 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览……"))
|
||||
button2 = QtWidgets.QPushButton(transla.transe("U", "浏览……"))
|
||||
e7_text = QtWidgets.QLineEdit()
|
||||
e8_text = QtWidgets.QLineEdit()
|
||||
e9_text = QtWidgets.QLineEdit()
|
||||
@@ -1703,11 +1737,11 @@ def AddTab():
|
||||
mapLink.append(e9_text)
|
||||
#desktopIconTabLayout = QtWidgets.QGridLayout()
|
||||
desktopIconTabLayout = QtWidgets.QGridLayout()
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine 容器里需要运行的可执行文件路径(※必填):")), 6, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的分类(※必填):")), 7, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine 容器里需要运行的可执行文件的参数(选填):")), 8, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的名称(※必填):")), 9, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的图标(选填):")), 10, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "wine 容器里需要运行的可执行文件路径(※必填):")), 6, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的分类(※必填):")), 7, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "wine 容器里需要运行的可执行文件的参数:")), 8, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的名称(※必填):")), 9, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的图标:")), 10, 0, 1, 1)
|
||||
iconTab1.setLayout(desktopIconTabLayout)
|
||||
desktopIconTab.addTab(iconTab1, f"图标{desktopIconTab.count() + 1}")
|
||||
desktopIconTabLayout.addWidget(e7_text, 6, 1, 1, 1)
|
||||
@@ -1716,7 +1750,24 @@ def AddTab():
|
||||
desktopIconTabLayout.addWidget(e8_text, 9, 1, 1, 1)
|
||||
desktopIconTabLayout.addWidget(e9_text, 10, 1, 1, 1)
|
||||
desktopIconTabLayout.addWidget(button2, 10, 2, 1, 1)
|
||||
e8_text.setWhatsThis(transla.transe("U", """填写该软件的中文或英文名称。"""))
|
||||
e9_text.setWhatsThis(transla.transe("U", """图标只支持PNG格式和SVG格式,其他格式无法显示。"""))
|
||||
e15_text.setWhatsThis(transla.transe("U", "程序参数,如%u,一般不需要"))
|
||||
e7_text.setWhatsThis(transla.transe("U", """可执行文件的运行路径格式是“C:/XXX/XXX.exe”(不包含引号)"""))
|
||||
option1_text.setWhatsThis(transla.transe("U", """点击右侧的下拉箭头,选择该软件所属的软件分类即可,常见软件分类名称释义:
|
||||
Network=网络应用;
|
||||
Chat=即时通讯或社交沟通;
|
||||
Video=视频播放;
|
||||
Graphics=图形图像;
|
||||
Office=办公学习;
|
||||
Translation=阅读翻译;
|
||||
Development=软件开发;
|
||||
Utility=工具软件或其他应用。
|
||||
不明白英文的可以百度查询一下软件分类名称的意思。
|
||||
注意:此时选择的软件分类名称决定了该软件打包后再安装时会安装在启动器中的哪个软件分类目录中。"""))
|
||||
e7_text.textChanged.connect(ChangeTapTitle)
|
||||
e7_text.setPlaceholderText("例如 c:/Program Files/Tencent/QQ/Bin/QQ.exe")
|
||||
e9_text.setPlaceholderText(transla.transe("U", "支持 png 和 svg 格式,不支持 ico 格式"))
|
||||
iconUiList.append([e7_text, option1_text, e15_text, e8_text, e9_text])
|
||||
print(iconUiList)
|
||||
|
||||
@@ -1727,6 +1778,30 @@ def DelTab():
|
||||
del iconUiList[desktopIconTab.currentIndex()]
|
||||
desktopIconTab.removeTab(desktopIconTab.currentIndex())
|
||||
|
||||
def ChangeBottleName():
|
||||
global bottleNameLock
|
||||
global bottleNameChangeLock
|
||||
e1_text.setText(e1_text.text().replace(" ", ""))
|
||||
if bottleNameLock:
|
||||
return
|
||||
if os.path.basename(e6_text.text()) == ".wine" or e6_text.text() == "":
|
||||
bottleNameChangeLock = True
|
||||
e5_text.setText(e1_text.text())
|
||||
return
|
||||
bottleNameChangeLock = True
|
||||
e5_text.setText(os.path.basename(e6_text.text().replace(" ", "")))
|
||||
|
||||
def LockBottleName():
|
||||
global bottleNameLock
|
||||
if bottleNameChangeLock:
|
||||
return
|
||||
bottleNameLock = True
|
||||
|
||||
# 获取当前语言
|
||||
def get_now_lang()->"获取当前语言":
|
||||
return os.getenv('LANG')
|
||||
|
||||
bottleNameLock = False
|
||||
###############
|
||||
# 程序信息
|
||||
###############
|
||||
@@ -1758,18 +1833,27 @@ iconUiList = []
|
||||
iconPath = "{}/deepin-wine-runner.svg".format(programPath)
|
||||
information = json.loads(readtxt(f"{programPath}/information.json"))
|
||||
version = information["Version"]
|
||||
tips = """提示:
|
||||
# 语言载入
|
||||
if not get_now_lang() == "zh_CN.UTF-8":
|
||||
#trans = QtCore.QTranslator()
|
||||
#trans.load(f"{programPath}/LANG/deepin-wine-runner-en_US.qm")
|
||||
#app.installTranslator(trans)
|
||||
transla = Trans("en_US", f"{programPath}/trans/deepin-wine-packager.json")
|
||||
else:
|
||||
transla = Trans("zh_CN")
|
||||
tips = transla.transe("U", """提示:
|
||||
1、deb 打包软件包名要求:
|
||||
软件包名只能含有小写字母(a-z)、数字(0-9)、加号(+)和减号(-)、以及点号(.),软件包名最短长度两个字符;它必须以字母开头
|
||||
2、如果要填写路径,有“浏览……”按钮的是要填本计算机对应文件的路径,否则就是填写安装到其他计算机使用的路径
|
||||
3、输入 wine 的容器路径时最后面请不要输入“/”
|
||||
4、输入可执行文件的运行路径时是以“C:/XXX/XXX.exe”的格式进行输入,默认是以 C: 为开头,不用“\”做命令的分隔,而是用“/”
|
||||
5、.desktop 的图标只支持 PNG 格式和 SVG 格式,其他格式无法显示图标
|
||||
6、路径建议不要带空格,容易出问题"""
|
||||
6、路径建议不要带空格,容易出问题""")
|
||||
|
||||
###############
|
||||
# 窗口创建
|
||||
###############
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
window = QtWidgets.QMainWindow()
|
||||
widget = QtWidgets.QWidget()
|
||||
@@ -1792,25 +1876,25 @@ e12_text = QtWidgets.QLineEdit()
|
||||
e15_text = QtWidgets.QLineEdit()
|
||||
label13_text = QtWidgets.QLabel("<p align='center'>当前 deb 打包情况:暂未打包</p>")
|
||||
option1_text = QtWidgets.QComboBox()
|
||||
button1 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览……"))
|
||||
button2 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览……"))
|
||||
button4 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "浏览……"))
|
||||
button1 = QtWidgets.QPushButton(transla.transe("U", "浏览……"))
|
||||
button2 = QtWidgets.QPushButton(transla.transe("U", "浏览……"))
|
||||
button4 = QtWidgets.QPushButton(transla.transe("U", "浏览……"))
|
||||
debControlFrame = QtWidgets.QHBoxLayout()
|
||||
button5 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "打包……"))
|
||||
installDeb = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "安装打包完成的 deb……"))
|
||||
buildDebDir = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "根据填写内容打包模板"))
|
||||
build7z = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "打包容器 7z 包"))
|
||||
button5 = QtWidgets.QPushButton(transla.transe("U", "打包……"))
|
||||
installDeb = QtWidgets.QPushButton(transla.transe("U", "安装打包完成的 deb……"))
|
||||
buildDebDir = QtWidgets.QPushButton(transla.transe("U", "根据填写内容打包模板"))
|
||||
build7z = QtWidgets.QPushButton(transla.transe("U", "打包容器 7z 包"))
|
||||
debControlFrame.addWidget(button5)
|
||||
debControlFrame.addWidget(installDeb)
|
||||
rmBash = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "设置卸载该 deb 后自动删除该容器"))
|
||||
cleanBottonByUOS = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "使用统信 Wine 生态适配活动容器清理脚本"))
|
||||
rmBash = QtWidgets.QCheckBox(transla.transe("U", "设置卸载该 deb 后自动删除该容器"))
|
||||
cleanBottonByUOS = QtWidgets.QCheckBox(transla.transe("U", "使用统信 Wine 生态适配活动容器清理脚本"))
|
||||
debArch = QtWidgets.QComboBox()
|
||||
debArch.addItems(["i386", "arm64(box86+exagear)"])
|
||||
textbox1 = QtWidgets.QTextBrowser()
|
||||
option1_text.addItems(["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility"])
|
||||
option1_text.setCurrentText("Network")
|
||||
wineFrame = QtWidgets.QHBoxLayout()
|
||||
chooseWineHelperValue = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "使用星火wine helper\n(如不勾选默认为deepin-wine-helper)"))
|
||||
chooseWineHelperValue = QtWidgets.QCheckBox(transla.transe("U", "使用星火wine helper\n(如不勾选默认为deepin-wine-helper)"))
|
||||
button1.clicked.connect(button1_cl)
|
||||
button2.clicked.connect(lambda: button2_cl(0))
|
||||
mapLink.append(e9_text)
|
||||
@@ -1820,19 +1904,23 @@ buildDebDir.clicked.connect(lambda: make_deb(True))
|
||||
build7z.clicked.connect(Build7zButton_Clicked)
|
||||
installDeb.clicked.connect(InstallDeb)
|
||||
wineFrame.addWidget(wineVersion)
|
||||
e1_text.textChanged.connect(ChangeBottleName)
|
||||
e5_text.textChanged.connect(LockBottleName)
|
||||
e6_text.textChanged.connect(ChangeBottleName)
|
||||
e7_text.textChanged.connect(ChangeTapTitle)
|
||||
# 创建控件
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的包名(※必填):")), 0, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的版本号(※必填):")), 1, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的说明(※必填):")), 2, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要打包的 deb 包的维护者(※必填):")), 3, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要解压的 wine 容器的容器名(※必填):")), 4, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要解压的 wine 容器(※必填):")), 5, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要打包的 deb 包的包名(※必填):")), 0, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包的版本号(※必填):")), 1, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包的说明(※必填):")), 2, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包的维护者(※必填):")), 3, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要解压的 wine 容器的名称(※必填):")), 4, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要打包的 wine 容器路径(※必填):")), 5, 0, 1, 1)
|
||||
desktopIconTab = QtWidgets.QTabWidget()
|
||||
controlWidget = QtWidgets.QWidget()
|
||||
controlWidgetLayout = QtWidgets.QHBoxLayout()
|
||||
desktopIconTabAdd = QtWidgets.QPushButton("+")
|
||||
desktopIconTabDel = QtWidgets.QPushButton("-")
|
||||
desktopIconTabAdd.setWhatsThis("添加新图标")
|
||||
desktopIconTabDel.setWhatsThis("移除选中图标")
|
||||
controlWidgetLayout.addWidget(desktopIconTabAdd)
|
||||
controlWidgetLayout.addWidget(desktopIconTabDel)
|
||||
controlWidget.setLayout(controlWidgetLayout)
|
||||
@@ -1840,18 +1928,18 @@ desktopIconTabAdd.clicked.connect(AddTab)
|
||||
desktopIconTabDel.clicked.connect(DelTab)
|
||||
iconTab1 = QtWidgets.QWidget()
|
||||
desktopIconTabLayout = QtWidgets.QGridLayout()
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine 容器里需要运行的可执行文件路径(※必填):")), 6, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的分类(※必填):")), 7, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "wine 容器里需要运行的可执行文件的参数(选填):")), 8, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的名称(※必填):")), 9, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的图标(选填):")), 10, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "wine 容器里需要运行的可执行文件路径(※必填):")), 6, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的分类(※必填):")), 7, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "wine 容器里需要运行的可执行文件的参数:")), 8, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的名称(※必填):")), 9, 0, 1, 1)
|
||||
desktopIconTabLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的图标:")), 10, 0, 1, 1)
|
||||
iconTab1.setLayout(desktopIconTabLayout)
|
||||
#desktopIconTab.setTabPosition(QtWidgets.QTabWidget.East)
|
||||
desktopIconTab.addTab(iconTab1, "Defult")
|
||||
desktopIconTab.setCornerWidget(controlWidget)
|
||||
widgetLayout.addWidget(desktopIconTab, 8, 0, 6, 3)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "选择打包的 wine 版本(※必选):")), 6, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "打包 deb 的保存路径(※必填):")), 7, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "选择打包的 wine 版本(※必选):")), 6, 0, 1, 1)
|
||||
widgetLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "打包 deb 的保存路径(※必填):")), 7, 0, 1, 1)
|
||||
widgetLayout.addWidget(e1_text, 0, 1, 1, 1)
|
||||
widgetLayout.addWidget(e2_text, 1, 1, 1, 1)
|
||||
widgetLayout.addWidget(e3_text, 2, 1, 1, 1)
|
||||
@@ -1874,30 +1962,30 @@ widgetLayout.addLayout(debControlFrame, 16, 1, 1, 1)
|
||||
widgetLayout.addWidget(label13_text, 17, 0, 1, 3)
|
||||
widgetLayout.addWidget(textbox1, 18, 0, 1, 3)
|
||||
# 高级功能
|
||||
moreSetting = QtWidgets.QGroupBox(QtCore.QCoreApplication.translate("U", "高级设置"))
|
||||
moreSetting = QtWidgets.QGroupBox(transla.transe("U", "高级设置"))
|
||||
debDepends = QtWidgets.QLineEdit()
|
||||
debRecommend = QtWidgets.QLineEdit()
|
||||
debDepends.setPlaceholderText(QtCore.QCoreApplication.translate("U", "deb 包的依赖(如无特殊需求默认即可)"))
|
||||
debDepends.setPlaceholderText(transla.transe("U", "deb 包的依赖(如无特殊需求默认即可)"))
|
||||
debDepends.setText("deepin-wine6-stable, deepin-wine-helper (>= 5.1.30-1), fonts-wqy-microhei, fonts-wqy-zenhei")
|
||||
debRecommend.setPlaceholderText(QtCore.QCoreApplication.translate("U", "deb 包的推荐依赖(非强制,一般默认即可)"))
|
||||
debRecommend.setPlaceholderText(transla.transe("U", "deb 包的推荐依赖(非强制,一般默认即可)"))
|
||||
moreSettingLayout = QtWidgets.QVBoxLayout()
|
||||
localWineVersion = QtWidgets.QComboBox()
|
||||
useInstallWineArch = QtWidgets.QComboBox()
|
||||
useInstallWineArch.addItems(["wine", "wine64"])
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "Wine 位数(只限本地需要打包集成的Wine):\n提示:32位的Wine不能使用64位容器")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "Wine 位数(只限本地需要打包集成的Wine):\n提示:32位的Wine不能使用64位容器")))
|
||||
#moreSettingLayout.addWidget(localWineVersion)
|
||||
moreSettingLayout.addWidget(useInstallWineArch)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "deb 包选项:")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 包选项:")))
|
||||
moreSettingLayout.addWidget(rmBash)
|
||||
moreSettingLayout.addWidget(cleanBottonByUOS)
|
||||
moreSettingLayout.addWidget(chooseWineHelperValue)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "deb 的依赖(强制,如无特殊需求默认即可):")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 的依赖(强制,如无特殊需求默认即可):")))
|
||||
moreSettingLayout.addWidget(debDepends)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "deb 的推荐依赖(非强制,一般默认即可):")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "deb 的推荐依赖(非强制,一般默认即可):")))
|
||||
moreSettingLayout.addWidget(debRecommend)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "要显示的 .desktop 文件的 MimeType:")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "要显示的 .desktop 文件的 MimeType:")))
|
||||
moreSettingLayout.addWidget(e10_text)
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "打包 deb 架构:")))
|
||||
moreSettingLayout.addWidget(QtWidgets.QLabel(transla.transe("U", "打包 deb 架构:")))
|
||||
moreSettingLayout.addWidget(debArch)
|
||||
moreSetting.setLayout(moreSettingLayout)
|
||||
widgetLayout.addWidget(moreSetting, 0, 3, 16, 2)
|
||||
@@ -1911,22 +1999,27 @@ e2_text.textChanged.connect(AutoPathSet)
|
||||
debArch.currentIndexChanged.connect(AutoPathSet)
|
||||
debArch.currentIndexChanged.connect(ChangeArchCombobox)
|
||||
e12_text.textChanged.connect(UserPathSet)
|
||||
e1_text.setPlaceholderText("例如 spark-deepin-wine-runner,不建议有大写字符")
|
||||
e2_text.setPlaceholderText(f"例如 {version}")
|
||||
e7_text.setPlaceholderText("例如 c:/Program Files/Tencent/QQ/Bin/QQ.exe")
|
||||
e9_text.setPlaceholderText(transla.transe("U", "支持 png 和 svg 格式,不支持 ico 格式"))
|
||||
# 菜单栏
|
||||
menu = window.menuBar()
|
||||
programmenu = menu.addMenu(QtCore.QCoreApplication.translate("U", "程序"))
|
||||
debMenu = menu.addMenu(QtCore.QCoreApplication.translate("U", "deb 包"))
|
||||
uploadSparkStore = menu.addMenu(QtCore.QCoreApplication.translate("U", "投稿到星火应用商店"))
|
||||
help = menu.addMenu(QtCore.QCoreApplication.translate("U", "帮助"))
|
||||
exit = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "退出程序"))
|
||||
debE = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "只读取 Control 信息"))
|
||||
debX = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "读取所有(需解包,时间较久)"))
|
||||
uploadSparkStoreWebsize = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "从网页端投稿"))
|
||||
programmenu = menu.addMenu(transla.transe("U", "程序"))
|
||||
debMenu = menu.addMenu(transla.transe("U", "deb 包"))
|
||||
uploadSparkStore = menu.addMenu(transla.transe("U", "投稿到星火应用商店"))
|
||||
help = menu.addMenu(transla.transe("U", "帮助"))
|
||||
exit = QtWidgets.QAction(transla.transe("U", "退出程序"))
|
||||
debE = QtWidgets.QAction(transla.transe("U", "只读取 Control 信息"))
|
||||
debX = QtWidgets.QAction(transla.transe("U", "读取所有(需解包,时间较久)"))
|
||||
uploadSparkStoreWebsize = QtWidgets.QAction(transla.transe("U", "从网页端投稿"))
|
||||
if os.path.exists("/opt/spark-store-submitter/bin/spark-store-submitter"):
|
||||
uploadSparkStoreProgram = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用投稿器投稿(推荐)"))
|
||||
uploadSparkStoreProgram = QtWidgets.QAction(transla.transe("U", "使用投稿器投稿(推荐)"))
|
||||
else:
|
||||
uploadSparkStoreProgram = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "使用投稿器投稿(推荐,请先安装投稿器)"))
|
||||
uploadSparkStoreProgram = QtWidgets.QAction(transla.transe("U", "使用投稿器投稿(推荐,请先安装投稿器)"))
|
||||
uploadSparkStoreProgram.setDisabled(True)
|
||||
tip = QtWidgets.QAction(QtCore.QCoreApplication.translate("U", "小提示"))
|
||||
tip = QtWidgets.QAction(transla.transe("U", "小提示"))
|
||||
getPdfHelp = QtWidgets.QAction(transla.transe("U", "Wine运行器和Wine打包器傻瓜式使用教程(小白专用)\nBy @雁舞白沙"))
|
||||
exit.triggered.connect(window.close)
|
||||
tip.triggered.connect(helps)
|
||||
programmenu.addAction(exit)
|
||||
@@ -1938,7 +2031,9 @@ debE.triggered.connect(lambda: ReadDeb(False))
|
||||
debX.triggered.connect(lambda: ReadDeb(True))
|
||||
uploadSparkStoreWebsize.triggered.connect(lambda: webbrowser.open_new_tab("https://upload.deepinos.org"))
|
||||
uploadSparkStoreProgram.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"/opt/spark-store-submitter/bin/spark-store-submitter '{e12_text.text()}'"]).start())
|
||||
getPdfHelp.triggered.connect(lambda: webbrowser.open_new_tab("https://bbs.deepin.org/post/246837"))
|
||||
help.addAction(tip)
|
||||
help.addAction(getPdfHelp)
|
||||
# 控件配置
|
||||
try:
|
||||
e6_text.setText(sys.argv[1].replace("~", get_home()))
|
||||
@@ -1955,6 +2050,44 @@ window.setCentralWidget(widget)
|
||||
window.setWindowTitle(f"wine 应用打包器 {version}")
|
||||
window.setWindowIcon(QtGui.QIcon(iconPath))
|
||||
window.resize(int(window.frameSize().width() * 2.1), int(window.frameSize().height()))
|
||||
e1_text.setWhatsThis("""com.XXX.deepin
|
||||
XXX指windows软件的英文名称,可以自定义名称,但最好是用软件解压安装后自动生成的英文名称,如:dingtalk。包名只能含有小写字母(a-z)、数字(0-9)、加号(+)和减号(-)、以及点号(.),软件包名最短长度为两个字符,且包名必须以字母开头。""")
|
||||
# 创建控件
|
||||
e2_text.setWhatsThis(transla.transe("U", """6.5.50(随便填写或填写该软件的windows版本的版本号,6.5.50只是示例)。"""))
|
||||
e3_text.setWhatsThis(transla.transe("U", """随便填写或使用该软件的windows版本的软件简介。"""))
|
||||
e4_text.setWhatsThis(transla.transe("U", """填写自己的网名,若是自用软件,不上架至应用商店,不进行后续维护,可随便填写。"""))
|
||||
e5_text.setWhatsThis(f"<p>解压容器到其它机器的容器名称,一般自动带出</p><p><img src='{programPath}/Icon/Screen/202211121646232464_image.png'></p>")
|
||||
e6_text.setWhatsThis(transla.transe("U", f"要打包的容器所在路径,也可以选择已经好打包的 7z 文件,一般自动带出"))
|
||||
e7_text.setWhatsThis("""可执行文件的运行路径格式是“C:/XXX/XXX.exe”(不包含引号)""")
|
||||
debArch.setWhatsThis(transla.transe("U", "选择生成 deb 包所对应的架构"))
|
||||
rmBash.setWhatsThis(transla.transe("U", "清理容器无用内容,一般建议勾选,最新版本默认勾选,如果有特殊需求(如容器内有 mono、gecko 等)建议取消勾选"))
|
||||
debDepends.setWhatsThis(transla.transe("U", "生成 deb 包所需的依赖,一般情况下默认即可"))
|
||||
debRecommend.setWhatsThis(transla.transe("U", "生成 deb 包的推荐依赖,一般情况下为空即可"))
|
||||
cleanBottonByUOS.setWhatsThis(transla.transe("U", "清理容器无用内容,一般建议勾选,最新版本默认勾选,如果有特殊需求(如容器内有 mono、gecko 等)建议取消勾选"))
|
||||
chooseWineHelperValue.setWhatsThis(transla.transe("U", "使用星火 dwine helper 替换 Deepin Wine Helper,投稿星火应用商店的话建议勾选,最新版本默认勾选(如果打包 arm 包将不会提供选择)"))
|
||||
option1_text.setWhatsThis("""点击右侧的下拉箭头,选择该软件所属的软件分类即可,常见软件分类名称释义:
|
||||
Network=网络应用;
|
||||
Chat=即时通讯或社交沟通;
|
||||
Video=视频播放;
|
||||
Graphics=图形图像;
|
||||
Office=办公学习;
|
||||
Translation=阅读翻译;
|
||||
Development=软件开发;
|
||||
Utility=工具软件或其他应用。
|
||||
不明白英文的可以百度查询一下软件分类名称的意思。
|
||||
注意:此时选择的软件分类名称决定了该软件打包后再安装时会安装在启动器中的哪个软件分类目录中。""")
|
||||
e8_text.setWhatsThis(transla.transe("U", """填写该软件的中文或英文名称。"""))
|
||||
e9_text.setWhatsThis(transla.transe("U", """图标只支持PNG格式和SVG格式,其他格式无法显示。"""))
|
||||
e10_text.setWhatsThis(transla.transe("U", "快捷方式的 MimeType 项,一般为空即可"))
|
||||
option1_text.setWhatsThis(transla.transe("U", "打包的 Wine 版本,根据实际情况选择(如果打包 arm 包将不会提供选择)"))
|
||||
e12_text.setWhatsThis(transla.transe("U", "打包出的 deb 生成的位置,一般自动生成"))
|
||||
e15_text.setWhatsThis(transla.transe("U", "程序参数,如%u,一般不需要"))
|
||||
build7z.setWhatsThis(transla.transe("U", "只打包容器生成 7z 包,不做其它操作"))
|
||||
buildDebDir.setWhatsThis(transla.transe("U", "构建 deb 包目录,但不打包成 deb"))
|
||||
textbox1.setWhatsThis(transla.transe("U", "查看打包过程中命令返回内容"))
|
||||
button5.setWhatsThis(transla.transe("U", "点击该按钮打包生成 deb"))
|
||||
installDeb.setWhatsThis(transla.transe("U", "调用默认的 deb 安装工具安装生成的 deb"))
|
||||
#window.setWindowFlag(QtGui.Qt)
|
||||
window.show()
|
||||
sys.exit(app.exec_())
|
||||
# Flag:解包只读control和解包全部读取
|
||||
7
demo/APICheck/main.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <iostream>
|
||||
#include <Windows.h>
|
||||
using namespace std;
|
||||
int main(){
|
||||
MessageBox(NULL, TEXT("a"), TEXT("A"), 32);
|
||||
return 0;
|
||||
}
|
||||
BIN
demo/APICheck/main.exe
Executable file
69
demo/GetExeVersion/main.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/**********************************
|
||||
* <20><><EFBFBD>ߣ<EFBFBD>gfdgd xi<78><69>Ϊʲô<CAB2><C3B4><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>ܳ<EFBFBD>û<EFBFBD>Ͱ<EFBFBD><CDB0><EFBFBD><EFBFBD><EFBFBD>
|
||||
* <20>汾<EFBFBD><E6B1BE>2.5.0
|
||||
* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣺2022<32><32>11<31><31>27<32><37>
|
||||
* ֻ<><D6BB><EFBFBD><EFBFBD> Wine/Windows <20><><EFBFBD><EFBFBD>
|
||||
**********************************/
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <Windows.h>
|
||||
#pragma comment(lib, "version.lib");
|
||||
using namespace std;
|
||||
|
||||
// <20>ȿӡ<C8BF><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA> Dev CPP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD> -lversion
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>汾<EFBFBD><E6B1BE>
|
||||
//@params:filename:<3A>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
string GetFileVersion(LPCWSTR filename)
|
||||
{
|
||||
string asVer = "";
|
||||
VS_FIXEDFILEINFO *pVsInfo;
|
||||
unsigned int iFileInfoSize = sizeof(VS_FIXEDFILEINFO);
|
||||
int iVerInfoSize = GetFileVersionInfoSizeW(filename, NULL);
|
||||
if(iVerInfoSize != 0)
|
||||
{
|
||||
char *pBuf = NULL;
|
||||
|
||||
while(!pBuf)
|
||||
{
|
||||
pBuf = new char[iVerInfoSize];
|
||||
}
|
||||
if(GetFileVersionInfoW(filename, 0, iVerInfoSize, pBuf))
|
||||
{
|
||||
if(VerQueryValueA(pBuf, "\\", (void **)&pVsInfo, &iFileInfoSize))
|
||||
{
|
||||
sprintf(pBuf, "%d.%d.%d.%d", HIWORD(pVsInfo->dwFileVersionMS), LOWORD(pVsInfo->dwFileVersionMS), HIWORD(pVsInfo->dwFileVersionLS), LOWORD(pVsInfo->dwFileVersionLS));
|
||||
asVer = pBuf;
|
||||
}
|
||||
}
|
||||
delete pBuf;
|
||||
}
|
||||
return asVer;
|
||||
}
|
||||
|
||||
// <20><>ʽת<CABD><D7AA>
|
||||
LPWSTR ConvertCharToLPWSTR(const char* szString)
|
||||
{
|
||||
int dwLen = strlen(szString) + 1;
|
||||
int nwLen = MultiByteToWideChar(CP_ACP, 0, szString, dwLen, NULL, 0);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵij<CAB5><C4B3><EFBFBD>
|
||||
LPWSTR lpszPath = new WCHAR[dwLen];
|
||||
MultiByteToWideChar(CP_ACP, 0, szString, dwLen, lpszPath, nwLen);
|
||||
return lpszPath;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]){
|
||||
if (argc < 2){
|
||||
cout << "Unfull Option" << endl;
|
||||
return 1;
|
||||
}
|
||||
string version = GetFileVersion(ConvertCharToLPWSTR(argv[1]));
|
||||
cout << "Version: " << version << endl;
|
||||
if (argc == 3){
|
||||
cout << "Write To " << argv[2] << endl;
|
||||
// Ϊ<>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>д<EFBFBD><D0B4><EFBFBD>ı<EFBFBD><C4B1>ĵ<EFBFBD>
|
||||
ofstream write(argv[2], ios::trunc);
|
||||
write << version;
|
||||
write.close();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||