2022-07-18 11:21:22 +08:00
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
2022-09-03 19:21:00 +08:00
#################################################################################################################
2023-04-24 21:21:28 +08:00
# 作者: gfdgd xi
2022-12-10 12:46:27 +08:00
# 版本: 3.0.0
# 更新时间: 2022年12月10日
2022-07-29 15:35:07 +08:00
# 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序
# 基于 Python3 的 PyQt5 构建
2022-09-03 19:21:00 +08:00
#################################################################################################################
2022-07-18 11:21:22 +08:00
#################
# 引入所需的库
#################
import os
import sys
import time
import json
2022-12-04 22:28:56 +08:00
import random
2022-07-29 15:35:07 +08:00
import base64
2022-07-18 11:21:22 +08:00
import shutil
2022-08-20 13:35:31 +08:00
import hashlib
2022-09-03 19:21:00 +08:00
import platform
2024-07-19 22:16:55 +08:00
try :
import pyperclip
except :
os . system ( " python3 -m pip install --upgrade pyperclip --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple --break-system-packages " )
import pyperclip
2022-07-18 11:21:22 +08:00
import threading
import traceback
import webbrowser
2023-04-05 16:53:09 +08:00
import updatekiller
2022-07-18 11:21:22 +08:00
import subprocess
2022-09-24 19:54:08 +08:00
import req as requests
2022-07-29 15:35:07 +08:00
import urllib . parse as parse
2024-02-02 11:49:30 +08:00
try :
import PyQt5 . QtGui as QtGui
2024-02-02 12:41:31 +08:00
except :
os . system ( " python3 -m pip install --upgrade pyqt5 --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple " )
2024-02-02 18:55:57 +08:00
os . system ( " python3 -m pip install --upgrade pyqt5 --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple --break-system-packages " )
2024-02-02 11:49:30 +08:00
import PyQt5 . QtGui as QtGui
2022-07-18 11:21:22 +08:00
import PyQt5 . QtCore as QtCore
import PyQt5 . QtWidgets as QtWidgets
2022-11-13 10:58:36 +08:00
try :
import PyQt5 . QtWebEngineWidgets as QtWebEngineWidgets
bad = False
except :
2024-02-02 12:41:31 +08:00
threading . Thread ( target = os . system , args = [ " python3 -m pip install --upgrade PyQtWebEngine --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple " ] ) . start ( )
2024-02-02 18:55:57 +08:00
threading . Thread ( target = os . system , args = [ " python3 -m pip install --upgrade PyQtWebEngine --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple --break-system-packages " ] ) . start ( )
2022-11-13 10:58:36 +08:00
bad = True
2022-12-05 22:21:33 +08:00
from trans import *
2022-08-27 02:00:41 +08:00
from Model import *
2023-08-13 21:50:29 +08:00
from DefaultSetting import *
2022-09-03 19:21:00 +08:00
def PythonLower ( ) :
app = QtWidgets . QApplication ( sys . argv )
QtWidgets . QMessageBox . critical ( None , " 错误 " , " Python 至少需要 3.6 及以上版本,目前版本: " + platform . python_version ( ) + " " )
sys . exit ( 1 )
# Python 版本检测,因为 f-string 格式化要至少 Python 3.6 及以上的版本,所以需要检测
# 判断主版本号
2022-09-19 21:30:36 +08:00
if sys . version_info [ 0 ] < 3 :
2022-09-03 19:21:00 +08:00
PythonLower ( )
if sys . version_info [ 1 ] < 6 :
PythonLower ( )
2022-07-18 11:21:22 +08:00
###################
# 程序所需事件
###################
2023-07-15 10:22:08 +08:00
def MiniMode ( mode ) :
for i in [ sparkWineSetting , qemuMenu , installLib , log , safeWebsize ,
checkValue , virtualMachine , killProgram , killBottonProgram ,
fontAppStore , wineConfig , trasButton , button5 ,
saveDesktopFileOnLauncher , label_r_2 , combobox1 ,
leftDown ] :
i . setVisible ( not mode )
2022-07-18 11:21:22 +08:00
# 打开程序官网
def OpenProgramURL ( ) :
webbrowser . open_new_tab ( programUrl )
# 读取文本文档
def readtxt ( path ) :
f = open ( path , " r " ) # 设置文件对象
str = f . read ( ) # 获取内容
f . close ( ) # 关闭文本对象
return str # 返回结果
# 写入文本文档
def write_txt ( path , things ) :
file = open ( path , ' w ' , encoding = ' UTF-8 ' ) # 设置文件对象
file . write ( things ) # 写入文本
file . close ( ) # 关闭文本对象
# 获取用户桌面目录
def get_desktop_path ( ) :
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 # 返回目录
# 获取用户主目录
def get_home ( ) :
return os . path . expanduser ( ' ~ ' )
# 第一个浏览按钮事件
def liulanbutton ( ) :
path = QtWidgets . QFileDialog . getExistingDirectory ( widget , " 选择 wine 容器 " , json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/WineBotton.json " ) ) [ " path " ] )
if path != " " and path != " () " :
e1 . setEditText ( path )
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/WineBotton.json " , json . dumps ( { " path " : path } ) ) # 写入配置文件
# 第二个浏览按钮事件
def liulanexebutton ( ) :
2022-11-20 17:48:10 +08:00
path = QtWidgets . QFileDialog . getOpenFileName ( widget , " 选择 exe 可执行文件 " , json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/FindExe.json " ) ) [ " path " ] , " exe 可执行文件(*.exe);;MSI 文件(*.msi);;所有文件(*.*) " )
2022-07-18 11:21:22 +08:00
if path != " " and path != " () " :
e2 . setEditText ( path [ 0 ] ) # 显示路径
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/FindExe.json " , json . dumps ( { " path " : os . path . dirname ( path [ 0 ] ) } ) ) # 写入配置文件
run = None
# 使用多线程运行可执行文件
def runexebutton ( self ) :
global run
DisableButton ( True )
2022-08-11 21:54:20 +08:00
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and not o1 . currentText ( ) in untipsWine :
2022-07-18 11:21:22 +08:00
if QtWidgets . QMessageBox . question ( widget , " 提示 " , " 检查到您未安装这个 wine, 是否继续使用这个 wine 运行? " ) == QtWidgets . QMessageBox . No :
DisableButton ( False )
return
if e2 . currentText ( ) == " " : # 判断文本框是否有内容
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 没有填写需要使用的 exe 应用 " )
DisableButton ( False )
return
returnText . setText ( " " )
run = Runexebutton_threading ( )
run . signal . connect ( QT . ShowWineReturn )
run . showHistory . connect ( QT . ShowHistory )
run . start ( )
class QT :
message = None
def ShowWineReturn ( things ) :
2024-07-15 12:52:51 +08:00
global unUseLnk
unUseLnk = True
# 不显示超链接
#returnText.setStyleSheet(returnText.styleSheet() + "a {color: white; text-decoration: none;}")
2022-07-18 11:21:22 +08:00
returnText . insertPlainText ( things )
def ShowHistory ( temp ) :
e1 . clear ( )
e2 . clear ( )
e2 . addItems ( wineBottonHistory )
e2 . setEditText ( wineBottonHistory [ - 1 ] )
e1 . addItems ( findExeHistory )
e1 . setEditText ( findExeHistory [ - 1 ] )
2022-11-20 17:48:10 +08:00
repairList = [ ]
2022-11-18 22:02:56 +08:00
# Flag: 日志推断解决方案功能
2022-11-20 17:48:10 +08:00
class LogChecking ( ) :
def ShowWindow ( ) :
global logThread
global logWindow
global questionList
global repairButton
logWindow = QtWidgets . QWidget ( )
logWindowLayout = QtWidgets . QGridLayout ( )
questionList = QtWidgets . QListView ( )
repairButton = QtWidgets . QPushButton ( " 一键修复 " )
repairButton . setDisabled ( True )
repairButton . clicked . connect ( LogChecking . RepairButton )
nmodel = QtGui . QStandardItemModel ( window )
item = QtGui . QStandardItem ( " 正在分析中…… " )
questionList . setEditTriggers ( QtWidgets . QAbstractItemView . NoEditTriggers )
nmodel . appendRow ( item )
questionList . setModel ( nmodel )
logWindowLayout . addWidget ( questionList , 0 , 0 , 3 , 1 )
logWindowLayout . addWidget ( repairButton , 0 , 2 , 1 , 1 )
logWindow . setWindowTitle ( " 分析日志 " )
logWindow . setLayout ( logWindowLayout )
logThread = LogThreading ( )
logThread . done . connect ( LogChecking . Show )
logThread . start ( )
logWindow . setWindowIcon ( QtGui . QIcon ( f " { programPath } /deepin-wine-runner.svg " ) )
logWindow . resize ( int ( logWindow . frameGeometry ( ) . width ( ) * 1.2 ) , int ( logWindow . frameGeometry ( ) . height ( ) * 1.2 ) )
logWindow . show ( )
def RepairButton ( ) :
index = questionList . currentIndex ( ) . row ( )
lists = questionMap [ index ]
print ( f " { programPath } /CheckDLL/bash/ { lists [ 1 ] . lower ( ) } .sh " )
2022-11-25 09:40:24 +08:00
if lists [ 0 ] == 1 and os . path . exists ( f " { programPath } /CheckDLL/bash/ { lists [ 1 ] . lower ( ) } .sh " ) :
2022-11-20 17:48:10 +08:00
OpenTerminal ( f " ' { programPath } /AutoShell/main.py ' ' { programPath } /CheckDLL/bash/ { lists [ 1 ] . lower ( ) } .sh ' " )
return
2022-11-25 09:40:24 +08:00
if lists [ 0 ] == 2 :
QtWidgets . QMessageBox . information ( logWindow , " 修复方法 " , " 切换其它 Wine " )
return
if lists [ 0 ] == 4 :
QtWidgets . QMessageBox . information ( logWindow , " 修复方法 " , " 如是 Deepin Wine 可以尝试切换 WineHQ, \n 并且取消勾选运行器主页面菜单栏“程序”=>“设置Wine”, 取消勾选“屏蔽 Wine 默认 Mono 和 Gecko 安装器” \n 然后尝试在菜单栏的“Wine”=>“在指定 Wine、容器安装组件”=>“在指定 Wine、容器安装 Gecko”来安装 Gecko " )
return
2022-12-07 10:21:50 +08:00
if lists [ 0 ] == 5 :
InstallMonoGecko ( " mono " )
return
2022-11-20 17:48:10 +08:00
QtWidgets . QMessageBox . critical ( logWindow , " 错误 " , " 无法修复该问题 " )
def Show ( lists ) :
global questionMap
nmodel = QtGui . QStandardItemModel ( window )
disbledButton = False
print ( lists )
if not len ( lists ) :
2022-11-25 09:40:24 +08:00
nmodel . appendRow ( QtGui . QStandardItem ( f " √ 无法分析到错误 " ) )
2022-11-20 17:48:10 +08:00
disbledButton = True
for i in lists :
if i [ 0 ] == 0 :
2022-11-25 09:40:24 +08:00
nmodel . appendRow ( QtGui . QStandardItem ( f " √ 无法分析到错误 " ) )
2022-11-20 17:48:10 +08:00
disbledButton = True
break
if i [ 0 ] == 1 :
2022-11-25 09:40:24 +08:00
nmodel . appendRow ( QtGui . QStandardItem ( f " × 无法调用 Dll: { i [ 1 ] } " ) )
if i [ 0 ] == 2 :
nmodel . appendRow ( QtGui . QStandardItem ( f " × 尝试用 Mono 运行非 .net 应用 { i [ 1 ] } ? " ) )
if i [ 0 ] == 3 :
nmodel . appendRow ( QtGui . QStandardItem ( f " ! 无法加载 Gecko, 是被禁用或未安装? " ) )
if i [ 0 ] == 4 :
nmodel . appendRow ( QtGui . QStandardItem ( f " × 无法更新 Wine 容器版本,是否还有 Wine 程序运行?" ) )
2022-12-07 10:21:50 +08:00
if i [ 0 ] == 5 :
nmodel . appendRow ( QtGui . QStandardItem ( f " × Mono 禁用/未安装" ) )
2022-11-20 17:48:10 +08:00
questionMap = lists [ : ]
repairButton . setDisabled ( disbledButton )
questionList . setModel ( nmodel )
class LogThreading ( QtCore . QThread ) :
done = QtCore . pyqtSignal ( list )
def __init__ ( self ) :
super ( ) . __init__ ( )
def run ( self ) :
global logText
repairList = [ ]
logText = returnText . toPlainText ( )
print ( logText . splitlines ( ) )
for i in logText . splitlines ( ) :
print ( i )
checkingText = i . lower ( )
if " err:module:import_dll Library " . lower ( ) in checkingText :
# Lose Dll
repairList . append ( [ 1 , i [ i . index ( " Library " ) + 8 : i . index ( " ( " ) ] . strip ( ) ] )
continue
if " err:module:fixup_imports_ilonly " . lower ( ) in checkingText :
# Lose Dll
repairList . append ( [ 1 , i [ i . index ( " _ilonly " ) + 8 : i . index ( " not " ) ] . strip ( ) ] )
continue
2022-11-25 09:40:24 +08:00
if " Cannot open assembly " . lower ( ) in checkingText and " : File does not contain a valid CIL image. " . lower ( ) in checkingText :
# Mono
repairList . append ( [ 2 , i . replace ( " : File does not contain a valid CIL image. " , " " ) . replace ( " Cannot open assembly " , " " ) . strip ( ) [ 1 : - 1 ] ] )
if " Could not load wine-gecko. HTML rendering will be disabled. " . lower ( ) in checkingText and " Could not find Wine Gecko. HTML rendering will be disabled. " . lower ( ) in checkingText :
# Disbled Gecko
repairList . append ( [ 3 , " " ] )
if " Your wineserver binary was not upgraded correctly " . lower ( ) in checkingText :
repairList . append ( [ 4 , " " ] )
2022-12-07 10:21:50 +08:00
if " Wine Mono is not installed " . lower ( ) in checkingText :
repairList . append ( [ 5 , " " ] )
2022-11-20 17:48:10 +08:00
self . done . emit ( repairList )
2022-11-18 22:02:56 +08:00
2022-07-18 11:21:22 +08:00
def DisableButton ( things ) :
2022-09-24 21:02:50 +08:00
button_r_6 . setDisabled ( things )
2022-07-18 11:21:22 +08:00
button1 . setDisabled ( things )
button2 . setDisabled ( things )
button3 . setDisabled ( things )
wineConfig . setDisabled ( things )
e1 . setDisabled ( things )
e2 . setDisabled ( things )
o1 . setDisabled ( things )
#winetricksOpen.configure(state=a[things])
getProgramIcon . setDisabled ( things )
uninstallProgram . setDisabled ( things )
trasButton . setDisabled ( things )
def CheckProgramIsInstall ( program ) :
return not bool ( os . system ( f " which ' { program } ' " ) )
class Runexebutton_threading ( QtCore . QThread ) :
signal = QtCore . pyqtSignal ( str )
showHistory = QtCore . pyqtSignal ( str )
def __init__ ( self ) :
super ( ) . __init__ ( )
def run ( self ) :
2023-12-23 12:24:20 +08:00
global lastRunCommand
2022-07-18 11:21:22 +08:00
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
option = " "
if setting [ " Architecture " ] != " Auto " :
option + = f " WINEARCH= { setting [ ' Architecture ' ] } "
2022-08-01 16:11:46 +08:00
if setting [ " MonoGeckoInstaller " ] :
option + = f " WINEDLLOVERRIDES= \" mscoree,mshtml= \" "
2022-07-18 11:21:22 +08:00
if not setting [ " Debug " ] :
option + = " WINEDEBUG=-all "
2022-09-10 07:27:10 +08:00
else :
option + = " WINEDEBUG=FIXME,ERR,WARN,TRACE,Message "
2022-08-09 13:34:44 +08:00
wineUsingOption = " "
2023-01-16 11:44:22 +08:00
exePath = e2 . currentText ( )
2024-06-01 15:39:25 +08:00
# 禁用没什么用还一堆坑的参数识别问题
if False :
2023-01-16 11:44:22 +08:00
fileName = [ " .exe " ]
changePath = False
for i in fileName :
if i in exePath :
print ( i )
print ( exePath )
l = exePath . index ( i )
exePath = f " { exePath [ : l + 4 ] } ' { exePath [ l + 4 : ] } ' "
print ( l )
print ( exePath )
changePath = True
break
#if not changePath and not os.path.exists(changePath):
if not changePath and not os . path . exists ( exePath ) :
# 删除前后无用空格以防止出现问题
print ( exePath )
exePath = exePath . strip ( )
2023-03-11 11:44:03 +08:00
# 有空格再说
if " " in exePath :
l = exePath . index ( " " )
exePath = f " { exePath [ : l ] } ' { exePath [ l : ] } ' "
print ( l )
#print(i)
2023-01-16 11:44:22 +08:00
print ( exePath )
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " :
2022-09-12 19:17:52 +08:00
wineUsingOption = " "
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
if not os . path . exists ( f " { programPath } /dlls-arm " ) :
2022-09-29 22:08:06 +08:00
if os . system ( f " 7z x -y \" { programPath } /dlls-arm.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
2022-08-11 21:54:20 +08:00
return
os . remove ( f " { programPath } /dlls-arm.7z " )
2022-07-18 11:21:22 +08:00
if setting [ " TerminalOpen " ] :
2022-08-27 02:00:41 +08:00
res = " "
2022-09-09 22:23:11 +08:00
if e2 . currentText ( ) [ - 4 : ] == " .msi " and os . path . exists ( e2 . currentText ( ) ) :
2023-12-23 12:24:20 +08:00
runCommand = " env WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " msiexec /i ' " + e2 . currentText ( ) + " ' " + setting [ " WineOption " ]
OpenTerminal ( runCommand )
2023-01-06 13:26:32 +08:00
elif e2 . currentText ( ) [ - 4 : ] == " .bat " and os . path . exists ( e2 . currentText ( ) ) :
2023-12-23 12:24:20 +08:00
runCommand = " env WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " wineconsole ' " + e2 . currentText ( ) + " ' " + setting [ " WineOption " ]
OpenTerminal ( runCommand )
2022-09-09 22:23:11 +08:00
else :
2023-12-23 12:24:20 +08:00
runCommand = " env WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " ' " + exePath + " ' " + setting [ " WineOption " ]
OpenTerminal ( runCommand )
2022-08-27 02:00:41 +08:00
#res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + e2.currentText() + "' " + setting["WineOption"] + "\" --keep-open" + wineUsingOption], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
2022-07-18 11:21:22 +08:00
else :
2022-09-09 22:23:11 +08:00
if e2 . currentText ( ) [ - 4 : ] == " .msi " and os . path . exists ( e2 . currentText ( ) ) :
2023-12-23 12:24:20 +08:00
runCommand = " WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " msiexec /i ' " + e2 . currentText ( ) + " ' " + setting [ " WineOption " ]
res = subprocess . Popen ( [ runCommand ] , shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
2023-01-06 13:26:32 +08:00
elif e2 . currentText ( ) [ - 4 : ] == " .bat " and os . path . exists ( e2 . currentText ( ) ) :
2023-12-23 12:24:20 +08:00
runCommand = " WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " wineconsole ' " + e2 . currentText ( ) + " ' " + setting [ " WineOption " ]
res = subprocess . Popen ( [ runCommand ] , shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
2022-09-09 22:23:11 +08:00
else :
2023-12-23 12:24:20 +08:00
runCommand = " WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " ' " + exePath + " ' " + setting [ " WineOption " ]
2023-01-16 11:44:22 +08:00
print ( [ " WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " ' " + exePath + " ' " + setting [ " WineOption " ] ] )
2023-12-23 12:24:20 +08:00
res = subprocess . Popen ( [ runCommand ] , shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
2022-07-18 11:21:22 +08:00
# 实时读取程序返回
#
2024-01-14 10:22:41 +08:00
print ( runCommand )
lastRunCommand = runCommand
2022-08-27 02:00:41 +08:00
if not setting [ " TerminalOpen " ] :
while res . poll ( ) is None :
try :
text = res . stdout . readline ( ) . decode ( " utf8 " )
except :
text = " "
self . signal . emit ( text )
print ( text , end = " " )
2024-01-14 10:22:41 +08:00
2022-08-05 17:46:41 +08:00
if len ( findExeHistory ) == 0 or findExeHistory [ - 1 ] != wineBottonPath :
findExeHistory . append ( wineBottonPath ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/FindExeHistory.json " , str ( json . dumps ( ListToDictionary ( findExeHistory ) ) ) ) # 将历史记录的数组转换为字典并写入
if len ( wineBottonHistory ) == 0 or wineBottonHistory [ - 1 ] != e2 . currentText ( ) :
wineBottonHistory . append ( e2 . currentText ( ) ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/WineBottonHistory.json " , str ( json . dumps ( ListToDictionary ( wineBottonHistory ) ) ) ) # 将历史记录的数组转换为字典并写入
2022-07-18 11:21:22 +08:00
self . showHistory . emit ( " " )
2022-09-10 22:07:58 +08:00
# 针对 QQ、TIM 安装后不会生成 lnk 的问题,由程序读取以及自动创建
# 判断是否安装了 QQ/TIM
for i in iconListUnBuild :
if os . path . exists ( i [ 1 ] . replace ( " wineBottonPath " , wineBottonPath ) ) :
2022-09-10 22:29:09 +08:00
if not os . path . exists ( f " { get_home ( ) } /.local/share/applications/wine/ { i [ 0 ] } - { os . path . basename ( wineBottonPath ) } .desktop " ) :
2022-09-10 22:07:58 +08:00
print ( " 图标不存在,创建图标 " )
# 图标不存在
# 写入 .desktop 文件
try :
2022-09-10 22:29:09 +08:00
os . system ( f " mkdir -p ' { get_home ( ) } /.local/share/applications/wine ' " )
name = i [ 0 ]
if setting [ " BuildByBottleName " ] :
name = f " { i [ 0 ] } —— { os . path . basename ( wineBottonPath ) } "
write_txt ( f " { get_home ( ) } /.local/share/applications/wine/ { i [ 0 ] } - { os . path . basename ( wineBottonPath ) } .desktop " , f ''' [Desktop Entry]
Name = { name }
2022-09-10 22:07:58 +08:00
Exec = env WINEPREFIX = ' {wineBottonPath} ' { option } { wine [ o1 . currentText ( ) ] } ' { i[1].replace( " wineBottonPath " , wineBottonPath)} ' { setting [ " WineOption " ] } { wineUsingOption }
Icon = { programPath } / Icon / { i [ 0 ] } . svg
Type = Application
StartupNotify = true ''' )
except :
# 写入不进去就别写入了,当什么事情都没发生就行
traceback . print_exc ( )
2022-07-18 11:21:22 +08:00
DisableButton ( False )
2022-11-13 10:58:36 +08:00
class Temp :
webWindow = None
2024-01-21 08:41:28 +08:00
2022-11-13 10:58:36 +08:00
#QtCore.QUrl().url()
2022-07-18 11:21:22 +08:00
# 显示“关于这个程序”窗口
def about_this_program ( ) - > " 显示“关于这个程序”窗口 " :
global about
global title
global iconPath
2023-12-11 20:27:52 +08:00
global clickIconTime
clickIconTime = 0
2022-07-18 11:21:22 +08:00
QT . message = QtWidgets . QMainWindow ( )
2022-07-27 22:40:05 +08:00
QT . message . setWindowIcon ( QtGui . QIcon ( iconPath ) )
2022-07-18 11:21:22 +08:00
messageWidget = QtWidgets . QWidget ( )
2024-01-21 08:41:28 +08:00
messageWidget . setObjectName ( " messageWidget " )
messageWidget . setStyleSheet ( f " QWidget#messageWidget {{ background: url( { programPath } /Icon/Program/about-background.png) no-repeat;background-position: left bottom; }} " )
2022-07-18 11:21:22 +08:00
QT . message . setWindowTitle ( f " 关于 { title } " )
messageLayout = QtWidgets . QGridLayout ( )
2023-12-11 12:11:23 +08:00
iconShow = QtWidgets . QLabel ( f " <a href= ' https://www.gfdgdxi.top ' ><img width=256 src= ' { iconPath } ' ></a> " )
2023-12-11 20:27:52 +08:00
def ChangeIcon ( ) :
global clickIconTime
if clickIconTime > = 0 :
clickIconTime = clickIconTime + 1
2023-12-29 19:48:31 +08:00
if clickIconTime > 0 :
2023-12-11 20:27:52 +08:00
clickIconTime = - 1
2024-01-21 08:41:28 +08:00
for k in [ " " , " Function " , " Program " ] :
try :
for i in os . listdir ( f " { programPath } /Icon/ { k } " ) :
if i [ - 4 : ] == " .svg " or i [ - 4 : ] == " .png " :
iconPathList . append ( f " { programPath } /Icon/ { k } / { i } " )
except :
traceback . print_exec ( )
2023-12-11 20:27:52 +08:00
randomNumber = random . randint ( 0 , len ( iconPathList ) - 1 )
iconShow . setText ( f " <a href= ' https://www.gfdgdxi.top ' ><img width=256 src= ' { iconPathList [ randomNumber ] } ' ></a><p align= ' center ' > { randomNumber + 1 } / { len ( iconPathList ) } </p> " )
iconShow . linkActivated . connect ( ChangeIcon )
2023-12-11 12:11:23 +08:00
messageLayout . addWidget ( iconShow , 0 , 0 , 1 , 1 , QtCore . Qt . AlignTop )
2022-07-18 11:21:22 +08:00
aboutInfo = QtWidgets . QTextBrowser ( messageWidget )
2022-11-13 10:58:36 +08:00
aboutInfo . setFocusPolicy ( QtCore . Qt . NoFocus )
#aboutInfo.copyAvailable.connect(lambda: print("b"))
aboutInfo . anchorClicked . connect ( OpenUrl )
aboutInfo . setOpenLinks ( False )
2022-07-18 11:21:22 +08:00
aboutInfo . setHtml ( about )
2022-11-13 10:58:36 +08:00
aboutInfo . setOpenExternalLinks ( False )
2022-07-18 11:21:22 +08:00
messageLayout . addWidget ( aboutInfo , 0 , 1 , 1 , 1 )
2023-11-26 14:34:08 +08:00
ok = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 确定 " ) )
2022-07-18 11:21:22 +08:00
ok . clicked . connect ( QT . message . close )
messageLayout . addWidget ( ok , 1 , 1 , 1 , 1 , QtCore . Qt . AlignBottom | QtCore . Qt . AlignRight )
messageWidget . setLayout ( messageLayout )
2024-01-21 08:41:28 +08:00
2022-07-18 11:21:22 +08:00
QT . message . setCentralWidget ( messageWidget )
2022-07-18 22:50:39 +08:00
QT . message . resize ( int ( messageWidget . frameGeometry ( ) . width ( ) * 1.5 ) , int ( messageWidget . frameGeometry ( ) . height ( ) * 1.5 ) )
2022-07-18 11:21:22 +08:00
QT . message . show ( )
# 显示“提示”窗口
def helps ( ) :
global tips
QtWidgets . QMessageBox . information ( widget , " 提示 " , tips )
# 显示更新内容窗口
def UpdateThings ( ) :
QtWidgets . QMessageBox . information ( widget , " 更新内容 " , updateThings )
# 生成 desktop 文件在启动器
def make_desktop_on_launcher ( ) :
2022-07-27 22:40:05 +08:00
try :
if combobox1 . currentText ( ) == " " or e2 . currentText ( ) == " " : # 判断文本框是否有内容
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 没有填写需要使用 exe 应用或保存的文件名 " )
2022-07-18 11:21:22 +08:00
return
2022-08-11 21:54:20 +08:00
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and not o1 . currentText ( ) in untipsWine :
2022-07-27 22:40:05 +08:00
if QtWidgets . QMessageBox . question ( widget , " 提示 " , " 检查到您未安装这个 wine, 是否继续使用这个 wine 写入? " ) == QtWidgets . QMessageBox . No :
DisableButton ( False )
return
else : # 如果都有
if os . path . exists ( get_home ( ) + " /.local/share/applications/ " + combobox1 . currentText ( ) + " .desktop " ) : # 判断目录是否有该文件,如果有
choose = QtWidgets . QMessageBox . question ( widget , " 提示 " , " 文件已经存在,是否覆盖? " ) == QtWidgets . QMessageBox . Yes
if choose : # 如要覆盖
os . remove ( get_home ( ) + " /.local/share/applications/ " + combobox1 . currentText ( ) + " .desktop " ) # 删除该文件
else : # 如不覆盖
return # 结束
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
option = " "
if setting [ " Architecture " ] != " Auto " :
option + = f " WINEARCH= { setting [ ' Architecture ' ] } "
if not setting [ " Debug " ] :
option + = " WINEDEBUG=-all "
2022-09-10 07:27:10 +08:00
else :
option + = " WINEDEBUG=FIXME,ERR,WARN,TRACE,Message "
2022-08-09 13:34:44 +08:00
wineUsingOption = " "
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
if not os . path . exists ( f " { programPath } /dlls-arm " ) :
2022-09-29 22:08:06 +08:00
if os . system ( f " 7z x -y \" { programPath } /dlls-arm.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
2022-08-11 21:54:20 +08:00
return
os . remove ( f " { programPath } /dlls-arm.7z " )
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " :
2022-09-12 19:17:52 +08:00
wineUsingOption = " "
value = " "
if e2 . currentText ( ) [ : 2 ] . upper ( ) == " C: " :
value = f " { wineBottonPath } /drive_c/ { e2 . currentText ( ) [ 2 : ] } " . replace ( " \\ " , " / " ) . replace ( " // " , " / " )
print ( value )
iconPaths = iconPath
2022-09-10 22:07:58 +08:00
for i in iconList :
2022-09-12 19:17:52 +08:00
listValue = i [ 1 ] . replace ( " wineBottonPath " , wineBottonPath )
if listValue == e2 . currentText ( ) or listValue == value :
2022-09-10 22:07:58 +08:00
# 如果路径相同,即可以用程序对应的图标
2022-09-12 19:17:52 +08:00
iconPaths = f " { programPath } /Icon/ { i [ 0 ] } .svg "
2022-09-10 22:07:58 +08:00
# 读到了就不需要再读取了
break
2022-09-10 22:29:09 +08:00
os . system ( f " mkdir -p ' { get_home ( ) } /.local/share/applications/wine ' " )
write_txt ( get_home ( ) + " /.local/share/applications/wine/ " + combobox1 . currentText ( ) + " .desktop " , f ''' [Desktop Entry]
2022-07-18 11:21:22 +08:00
Name = { combobox1 . currentText ( ) }
2022-08-09 13:34:44 +08:00
Exec = env WINEPREFIX = ' {wineBottonPath} ' { option } { wine [ o1 . currentText ( ) ] } ' { e2.currentText()} ' { setting [ " WineOption " ] } { wineUsingOption }
2022-09-12 19:17:52 +08:00
Icon = { iconPaths }
2022-07-18 11:21:22 +08:00
Type = Application
StartupNotify = true ''' ) # 写入文本文档
2022-08-05 17:46:41 +08:00
if len ( shellHistory ) == 0 or shellHistory [ - 1 ] != combobox1 . currentText ( ) :
shellHistory . append ( combobox1 . currentText ( ) ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/ShellHistory.json " , str ( json . dumps ( ListToDictionary ( shellHistory ) ) ) ) # 将历史记录的数组转换为字典并写入
combobox1 . clear ( )
combobox1 . addItems ( shellHistory )
2022-07-27 22:40:05 +08:00
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 生成完成! " ) # 显示完成对话框
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( widget , " 错误 " , f " 快捷方式创建失败,错误如下: \n { traceback . format_exc ( ) } " )
2022-07-18 11:21:22 +08:00
2022-12-03 21:47:05 +08:00
def ConfigQemu ( ) :
lists = [ ]
for i in qemuBottleList :
lists . append ( f " { i [ 0 ] } / { i [ 1 ] } " )
choose = QtWidgets . QInputDialog . getItem ( window , " 提示 " , " 选择需要 Chroot 到里面的容器 " , lists , 0 , False )
if not choose [ 1 ] :
return
2022-12-09 22:45:51 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " python3 ' { programPath } /QemuRun.py ' ' { choose [ 0 ] } ' ' { int ( setting [ ' QemuUnMountHome ' ] ) } ' " ] ) . start ( )
2022-12-03 21:47:05 +08:00
print ( choose )
2022-07-18 11:21:22 +08:00
# 生成 desktop 文件在桌面
# (第四个按钮的事件)
def make_desktop_on_desktop ( ) :
2022-07-27 22:40:05 +08:00
try :
if combobox1 . currentText ( ) == " " or e2 . currentText ( ) == " " : # 判断文本框是否有内容
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 没有填写需要使用 exe 应用或保存的文件名 " )
2022-07-18 11:21:22 +08:00
return
2022-08-11 21:54:20 +08:00
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and not o1 . currentText ( ) in untipsWine :
2022-07-27 22:40:05 +08:00
if QtWidgets . QMessageBox . question ( widget , " 提示 " , " 检查到您未安装这个 wine, 是否继续使用这个 wine 写入? " ) == QtWidgets . QMessageBox . No :
DisableButton ( False )
return
else : # 如果都有
if os . path . exists ( get_desktop_path ( ) + " / " + combobox1 . currentText ( ) + " .desktop " ) : # 判断目录是否有该文件,如果有
choose = QtWidgets . QMessageBox . question ( widget , " 提示 " , " 文件已经存在,是否覆盖? " ) == QtWidgets . QMessageBox . Yes
if choose : # 如要覆盖
os . remove ( get_desktop_path ( ) + " / " + combobox1 . currentText ( ) + " .desktop " ) # 删除该文件
else : # 如不覆盖
return # 结束
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-09 13:34:44 +08:00
wineUsingOption = " "
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " :
2022-09-12 19:17:52 +08:00
wineUsingOption = " "
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
if not os . path . exists ( f " { programPath } /dlls-arm " ) :
2022-09-29 22:08:06 +08:00
if os . system ( f " 7z x -y \" { programPath } /dlls-arm.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
2022-08-11 21:54:20 +08:00
return
os . remove ( f " { programPath } /dlls-arm.7z " )
2022-07-27 22:40:05 +08:00
if not os . path . exists ( get_desktop_path ( ) ) :
os . makedirs ( get_home ( ) )
os . mknod ( get_desktop_path ( ) + " / " + combobox1 . currentText ( ) + " .desktop " )
option = " "
if setting [ " Architecture " ] != " Auto " :
option + = f " WINEARCH= { setting [ ' Architecture ' ] } "
if not setting [ " Debug " ] :
option + = " WINEDEBUG=-all "
2022-09-12 19:17:52 +08:00
value = " "
if e2 . currentText ( ) [ : 2 ] . upper ( ) == " C: " :
value = f " { wineBottonPath } /drive_c/ { e2 . currentText ( ) [ 2 : ] } " . replace ( " \\ " , " / " ) . replace ( " // " , " / " )
print ( value )
iconPaths = iconPath
2022-09-10 22:07:58 +08:00
for i in iconList :
2022-09-12 19:17:52 +08:00
listValue = i [ 1 ] . replace ( " wineBottonPath " , wineBottonPath )
if listValue == e2 . currentText ( ) or listValue == value :
2022-09-10 22:07:58 +08:00
# 如果路径相同,即可以用程序对应的图标
2022-09-12 19:17:52 +08:00
iconPaths = f " { programPath } /Icon/ { i [ 0 ] } .svg "
2022-09-10 22:07:58 +08:00
# 读到了就不需要再读取了
break
2022-09-10 22:29:09 +08:00
os . system ( f " mkdir -p ' { get_home ( ) } /.local/share/applications/wine ' " )
2022-07-27 22:40:05 +08:00
write_txt ( get_desktop_path ( ) + " / " + combobox1 . currentText ( ) + " .desktop " , f ''' [Desktop Entry]
2022-07-18 11:21:22 +08:00
Name = { combobox1 . currentText ( ) }
2022-08-09 13:34:44 +08:00
Exec = env WINEPREFIX = ' {wineBottonPath} ' { option } { wine [ o1 . currentText ( ) ] } ' { e2.currentText()} ' { setting [ " WineOption " ] } { wineUsingOption }
2022-09-12 19:17:52 +08:00
Icon = { iconPaths }
2022-07-18 11:21:22 +08:00
Type = Application
StartupNotify = true ''' ) # 写入文本文档
2022-08-05 17:46:41 +08:00
if len ( shellHistory ) == 0 or shellHistory [ - 1 ] != combobox1 . currentText ( ) :
shellHistory . append ( combobox1 . currentText ( ) ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/ShellHistory.json " , str ( json . dumps ( ListToDictionary ( shellHistory ) ) ) ) # 将历史记录的数组转换为字典并写入
combobox1 . clear ( )
combobox1 . addItems ( shellHistory )
2022-07-27 22:40:05 +08:00
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 生成完成! " ) # 显示完成对话框
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( widget , " 错误 " , f " 快捷方式创建失败,错误如下: \n { traceback . format_exc ( ) } " )
2022-07-18 11:21:22 +08:00
# 数组转字典
def ListToDictionary ( list ) :
dictionary = { }
for i in range ( len ( list ) ) :
dictionary [ i ] = list [ i ]
return dictionary
def CleanProgramHistory ( ) :
2022-07-27 22:40:05 +08:00
if QtWidgets . QMessageBox . question ( widget , " 警告 " , " 删除后将无法恢复,你确定吗? \n 删除后软件将会自动重启。 " ) == QtWidgets . QMessageBox . Yes :
2022-08-08 15:49:59 +08:00
try :
shutil . rmtree ( get_home ( ) + " /.config/deepin-wine-runner " )
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( widget , " 错误 " , traceback . format_exc ( ) )
2022-07-18 11:21:22 +08:00
ReStartProgram ( )
2022-08-08 15:49:59 +08:00
def CleanProgramCache ( ) :
try :
shutil . rmtree ( get_home ( ) + " /.cache/deepin-wine-runner " )
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 缓存清理完毕! " )
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( widget , " 错误 " , traceback . format_exc ( ) )
2023-08-13 21:30:15 +08:00
def SetFont ( size ) :
font = QtGui . QFont ( defaultFont )
if size == 1 :
app . setFont ( defaultFont )
return
font . setPixelSize ( int ( defaultFont . pixelSize ( ) / size ) )
font . setPointSize ( int ( defaultFont . pointSize ( ) / size ) )
app . setFont ( font )
2022-08-08 15:49:59 +08:00
2022-07-18 11:21:22 +08:00
# 重启本应用程序
def ReStartProgram ( ) :
python = sys . executable
os . execl ( python , python , * sys . argv )
2022-10-02 14:52:32 +08:00
def KillAllProgram ( ) :
pass
2022-07-18 11:21:22 +08:00
def KillProgram ( ) :
os . system ( f " killall { wine [ o1 . currentText ( ) ] } -9 " )
os . system ( " killall winedbg -9 " )
2022-10-02 14:52:32 +08:00
exeName = os . path . basename ( e2 . currentText ( ) )
os . system ( f " killall { exeName } -9 " )
2022-07-18 11:21:22 +08:00
def InstallWine ( ) :
2022-08-27 02:00:41 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " ' { programPath } /AllInstall.py ' " ] ) . start ( )
2022-07-18 11:21:22 +08:00
2022-08-02 08:49:42 +08:00
def InstallWineOnDeepin23 ( ) :
2022-08-27 02:00:41 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " ' { programPath } /InstallWineOnDeepin23.py ' " ] ) . start ( )
2022-08-02 08:49:42 +08:00
2022-11-18 22:02:56 +08:00
class DllWindow ( ) :
def ShowWindow ( ) :
global dllMessage
global dllInfoMap
global textInfo
global dllName
dllMessage = QtWidgets . QWidget ( )
dllLayout = QtWidgets . QGridLayout ( )
try :
dllInfoMap [ " check " ]
except :
try :
with open ( f " { programPath } /CheckDLL/lists.json " , " r " ) as file :
dllInfoMap = json . loads ( file . read ( ) )
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( dllMessage , " 错误 " , traceback . format_exc ( ) )
# UI
dllName = QtWidgets . QLineEdit ( )
dllButton = QtWidgets . QPushButton ( " 查询 " )
textInfo = QtWidgets . QTextBrowser ( )
dllButton . clicked . connect ( DllWindow . Find )
dllLayout . addWidget ( QtWidgets . QLabel ( " Dll 名称: " ) , 0 , 0 )
dllLayout . addWidget ( dllName , 0 , 1 )
dllLayout . addWidget ( dllButton , 0 , 2 )
dllLayout . addWidget ( textInfo , 1 , 0 , 1 , 3 )
dllMessage . setWindowTitle ( f " { title } ——查询 Dll " )
dllMessage . setLayout ( dllLayout )
dllMessage . resize ( int ( dllMessage . frameGeometry ( ) . width ( ) * 1.2 ) , int ( dllMessage . frameGeometry ( ) . height ( ) * 1.1 ) )
dllMessage . setWindowIcon ( QtGui . QIcon ( f " { programPath } /deepin-wine-runner.svg " ) )
dllMessage . show ( )
def Find ( ) :
dllNameText = dllName . text ( ) . strip ( ) . lower ( )
if dllNameText [ - 4 : ] != " .dll " :
dllNameText + = " .dll "
try :
textInfo . setText ( dllInfoMap [ dllNameText ] )
except :
textInfo . setText ( f " 未查询到有关 Dll ' { dllNameText } ' 有关的内容 " )
2022-11-15 12:39:43 +08:00
def InstallWineOnDeepin23Alpha ( ) :
threading . Thread ( target = OpenTerminal , args = [ f " ' { programPath } /InstallWineOnDeepin23Alpha.py ' " ] ) . start ( )
2022-08-11 21:54:20 +08:00
def InstallWineHQ ( ) :
2022-08-27 02:00:41 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " { programPath } /InstallNewWineHQ.sh " ] ) . start ( )
2022-08-11 21:54:20 +08:00
2022-07-18 11:21:22 +08:00
def OpenWineBotton ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
os . system ( " xdg-open \" " + wineBottonPath . replace ( " \' " , " \\ \' " ) + " \" " )
def OpenWineFontPath ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2023-11-26 14:34:08 +08:00
QtWidgets . QMessageBox . information ( widget , " 提示 " , QtCore . QCoreApplication . translate ( " U " , " 如果安装字体?只需要把字体文件复制到此字体目录 \n 按下“OK”按钮可以打开字体目录 " ) )
2022-07-18 11:21:22 +08:00
os . system ( " xdg-open \" " + wineBottonPath . replace ( " \' " , " \\ \' " ) + " /drive_c/windows/Fonts \" " )
2022-11-18 22:02:56 +08:00
def GetLoseDll ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
option = " "
if setting [ " MonoGeckoInstaller " ] :
option + = f " WINEDLLOVERRIDES= \" mscoree,mshtml= \" "
if setting [ " Architecture " ] != " Auto " :
option + = f " WINEARCH= { setting [ ' Architecture ' ] } "
if not setting [ " Debug " ] :
option + = " WINEDEBUG=-all "
wineUsingOption = " "
if o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
os . system ( f " ' { programPath } /deepin-wine-runner-create-botton.py ' ' { wineBottonPath } ' " )
if o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " :
wineUsingOption = " "
if o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
if not os . path . exists ( f " { programPath } /dlls-arm " ) :
if os . system ( f " 7z x -y \" { programPath } /dlls-arm.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
return
os . remove ( f " { programPath } /dlls-arm.7z " )
threading . Thread ( target = os . system , args = [ f " python3 ' { programPath } /CheckDLL/main.py ' ' { e2 . currentText ( ) } ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' " + setting [ " WineOption " ] ] ) . start ( )
2022-07-18 11:21:22 +08:00
class RunWineProgramThread ( QtCore . QThread ) :
signal = QtCore . pyqtSignal ( str )
showHistory = QtCore . pyqtSignal ( str )
def __init__ ( self , wineProgram , history = False , Disbled = True ) :
super ( ) . __init__ ( )
self . wineProgram = wineProgram
self . history = history
self . Disbled = Disbled
def run ( self ) :
2023-12-23 12:24:20 +08:00
global lastRunCommand
2022-07-18 11:21:22 +08:00
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
option = " "
2022-08-01 16:11:46 +08:00
if setting [ " MonoGeckoInstaller " ] :
option + = f " WINEDLLOVERRIDES= \" mscoree,mshtml= \" "
2022-07-18 11:21:22 +08:00
if setting [ " Architecture " ] != " Auto " :
option + = f " WINEARCH= { setting [ ' Architecture ' ] } "
if not setting [ " Debug " ] :
option + = " WINEDEBUG=-all "
2022-08-09 13:34:44 +08:00
wineUsingOption = " "
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
os . system ( f " ' { programPath } /deepin-wine-runner-create-botton.py ' ' { wineBottonPath } ' " )
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " :
2022-09-12 19:17:52 +08:00
wineUsingOption = " "
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
if not os . path . exists ( f " { programPath } /dlls-arm " ) :
2022-09-29 22:08:06 +08:00
if os . system ( f " 7z x -y \" { programPath } /dlls-arm.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
2022-08-11 21:54:20 +08:00
return
os . remove ( f " { programPath } /dlls-arm.7z " )
2022-07-18 11:21:22 +08:00
if setting [ " TerminalOpen " ] :
2022-08-27 02:00:41 +08:00
res = " "
2023-12-23 12:24:20 +08:00
runCommand = f " env WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " ' " + self . wineProgram + " ' " + setting [ " WineOption " ] + " " + wineUsingOption
OpenTerminal ( runCommand )
2022-08-27 02:00:41 +08:00
#res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='" + wineBottonPath + "' " + option + wine[o1.currentText()] + " '" + self.wineProgram + "' " + setting["WineOption"] + " " + wineUsingOption + "\" --keep-open"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
2022-07-18 11:21:22 +08:00
else :
2023-12-23 12:24:20 +08:00
runCommand = " WINEPREFIX= ' " + wineBottonPath + " ' " + option + wine [ o1 . currentText ( ) ] + " ' " + self . wineProgram + " ' " + setting [ " WineOption " ]
res = subprocess . Popen ( [ runCommand ] , shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
print ( runCommand )
lastRunCommand = runCommand
2022-07-18 11:21:22 +08:00
# 实时读取程序返回
2022-08-27 02:00:41 +08:00
if not setting [ " TerminalOpen " ] :
while res . poll ( ) is None :
try :
text = res . stdout . readline ( ) . decode ( " utf8 " )
except :
text = " "
self . signal . emit ( text )
print ( text , end = " " )
2022-07-18 11:21:22 +08:00
if self . history :
2022-08-05 17:46:41 +08:00
if len ( findExeHistory ) == 0 or findExeHistory [ - 1 ] != wineBottonPath :
findExeHistory . append ( wineBottonPath ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/FindExeHistory.json " , str ( json . dumps ( ListToDictionary ( findExeHistory ) ) ) ) # 将历史记录的数组转换为字典并写入
if len ( wineBottonHistory ) == 0 or wineBottonHistory [ - 1 ] != e2 . currentText ( ) :
wineBottonHistory . append ( e2 . currentText ( ) ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/WineBottonHistory.json " , str ( json . dumps ( ListToDictionary ( wineBottonHistory ) ) ) ) # 将历史记录的数组转换为字典并写入
2022-07-18 11:21:22 +08:00
self . showHistory . emit ( " " )
if self . Disbled :
DisableButton ( False )
runProgram = None
def RunWineProgram ( wineProgram , history = False , Disbled = True ) :
global runProgram
DisableButton ( True )
2022-11-16 22:57:19 +08:00
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and o1 . currentText ( ) != " 基于 linglong 的 deepin-wine6-stable( 不推荐) " and o1 . currentText ( ) != " 基于 UOS exagear 的 deepin-wine6-stable " and o1 . currentText ( ) != " 基于 UOS box86 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and not o1 . currentText ( ) in untipsWine :
2023-03-11 11:44:03 +08:00
if QtWidgets . QMessageBox . question ( widget , " 提示 " , " 检查到您未安装这个 wine, 是否继续使用这个 wine 运行? " ) == QtWidgets . QMessageBox . No :
DisableButton ( False )
return
2022-07-18 11:21:22 +08:00
returnText . setText ( " " )
runProgram = RunWineProgramThread ( wineProgram , history , Disbled )
runProgram . signal . connect ( QT . ShowWineReturn )
runProgram . showHistory . connect ( QT . ShowHistory )
runProgram . start ( )
class RunWinetricksThread ( QtCore . QThread ) :
signal = QtCore . pyqtSignal ( str )
2023-08-05 22:30:35 +08:00
bwrap = QtCore . pyqtSignal ( str )
def __init__ ( self , bwrap ) :
self . bwrap = bwrap
2022-07-18 11:21:22 +08:00
super ( ) . __init__ ( )
def run ( self ) :
wineBottonPath = setting [ " DefultBotton " ]
if not e1 . currentText ( ) == " " :
wineBottonPath = e1 . currentText ( )
option = " "
if setting [ " Architecture " ] != " Auto " :
option + = f " WINEARCH= { setting [ ' Architecture ' ] } "
if not setting [ " Debug " ] :
option + = " WINEDEBUG=-all "
2022-08-11 21:54:20 +08:00
wineUsingOption = " "
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " :
2022-09-12 19:17:52 +08:00
wineUsingOption = " "
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
if not os . path . exists ( f " { programPath } /dlls-arm " ) :
2022-09-29 22:08:06 +08:00
if os . system ( f " 7z x -y \" { programPath } /dlls-arm.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
2022-08-11 21:54:20 +08:00
return
os . remove ( f " { programPath } /dlls-arm.7z " )
2023-08-05 22:30:35 +08:00
## 获取 WineServer 路径
wineServer = None
winePath = wine [ o1 . currentText ( ) ]
2023-08-08 14:32:26 +08:00
winePath = winePath . replace ( f " bash ' { programPath } /WineLib/run.sh ' " , " " ) . strip ( )
2023-08-05 22:30:35 +08:00
# 判断类似 xxx-server 的 WineServer
if not os . system ( f " { winePath } -server " ) >> 8 :
wineServer = f " { winePath } -server "
# 判断类似 deepin-wine6-stable 的 WineServer
elif os . path . exists ( f " /opt/ { winePath } /bin/wineserver " ) :
wineServer = f " /opt/ { winePath } /bin/wineserver "
elif os . path . exists ( winePath ) :
2023-08-08 14:32:26 +08:00
wineServer = os . path . normpath ( f " { winePath } /../wineserver " )
2023-08-05 22:30:35 +08:00
runtime = " "
if self . bwrap :
runtime = f " ' { programPath } /WineLib/run.sh ' "
winetricksPath = " winetricks "
if os . system ( " which winetricks " ) >> 8 :
winetricksPath = f " ' { programPath } /winetricks ' "
2023-08-08 14:32:26 +08:00
print ( wineServer )
wineProgramP = wine [ o1 . currentText ( ) ] . replace ( f " bash ' { programPath } /WineLib/run.sh ' " , " " ) . strip ( )
wineProgramP = subprocess . getoutput ( f " which { wineProgramP } " ) . strip ( )
2022-07-18 11:21:22 +08:00
if setting [ " TerminalOpen " ] :
2022-08-27 02:00:41 +08:00
res = " "
# 用终端开应该不用返回输出内容了
2023-08-05 22:30:35 +08:00
if wineServer == None :
2023-08-08 14:32:26 +08:00
OpenTerminal ( f " WINEPREFIX= ' { wineBottonPath } ' { option } WINE= ' { wineProgramP } ' { runtime } { winetricksPath } --gui { wineUsingOption } " )
2023-08-05 22:30:35 +08:00
else :
2023-08-08 14:32:26 +08:00
OpenTerminal ( f " WINEPREFIX= ' { wineBottonPath } ' { option } WINESERVER= ' { wineServer } ' WINE= ' { wineProgramP } ' { runtime } { winetricksPath } --gui { wineUsingOption } " )
2022-08-27 02:00:41 +08:00
#res = subprocess.Popen([f"'{programPath}/launch.sh' deepin-terminal -C \"WINEPREFIX='{wineBottonPath}' {option} WINE=" + subprocess.getoutput(f"which {wine[o1.currentText()]}").replace(" ", "").replace("\n", "") + f" winetricks --gui {wineUsingOption}\" --keep-open"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
2022-07-18 11:21:22 +08:00
else :
2023-08-05 22:30:35 +08:00
if wineServer == None :
2023-08-08 14:32:26 +08:00
res = subprocess . Popen ( [ f " WINEPREFIX= ' { wineBottonPath } ' { option } WINE= ' { wineProgramP } ' { runtime } { winetricksPath } --gui " ] , shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
2023-08-05 22:30:35 +08:00
else :
2023-08-08 14:32:26 +08:00
res = subprocess . Popen ( [ f " WINEPREFIX= ' { wineBottonPath } ' { option } WINESERVER= ' { wineServer } ' WINE= ' { wineProgramP } ' { runtime } { winetricksPath } --gui " ] , shell = True , stdout = subprocess . PIPE , stderr = subprocess . STDOUT )
2022-07-18 11:21:22 +08:00
# 实时读取程序返回
while res . poll ( ) is None :
try :
text = res . stdout . readline ( ) . decode ( " utf8 " )
except :
text = " "
self . signal . emit ( text )
print ( text , end = " " )
2022-09-10 22:07:58 +08:00
2022-07-18 11:21:22 +08:00
DisableButton ( False )
runWinetricks = None
2023-08-05 22:30:35 +08:00
def RunWinetricksWithWineLib ( ) :
global runWinetricks
DisableButton ( True )
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and o1 . currentText ( ) != " 基于 linglong 的 deepin-wine6-stable( 不推荐) " and o1 . currentText ( ) != " 基于 UOS exagear 的 deepin-wine6-stable " and o1 . currentText ( ) != " 基于 UOS box86 的 deepin-wine6-stable " :
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and not o1 . currentText ( ) in untipsWine :
DisableButton ( False )
return
if o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
if not os . path . exists ( f " { programPath } /dlls-arm " ) :
if os . system ( f " 7z x -y \" { programPath } /dlls-arm.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
return
os . remove ( f " { programPath } /dlls-arm.7z " )
returnText . setText ( " " )
runWinetricks = RunWinetricksThread ( False )
runWinetricks . signal . connect ( QT . ShowWineReturn )
runWinetricks . start ( )
2022-07-18 11:21:22 +08:00
def RunWinetricks ( ) :
global runWinetricks
DisableButton ( True )
2022-11-16 22:57:19 +08:00
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and o1 . currentText ( ) != " 基于 linglong 的 deepin-wine6-stable( 不推荐) " and o1 . currentText ( ) != " 基于 UOS exagear 的 deepin-wine6-stable " and o1 . currentText ( ) != " 基于 UOS box86 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
if not CheckProgramIsInstall ( wine [ o1 . currentText ( ) ] ) and not o1 . currentText ( ) in untipsWine :
2022-07-18 11:21:22 +08:00
DisableButton ( False )
return
2022-11-16 22:57:19 +08:00
if o1 . currentText ( ) == " 基于 UOS box86 的 deepin-wine6-stable " or o1 . currentText ( ) == " 基于 UOS exagear 的 deepin-wine6-stable " :
2022-08-11 21:54:20 +08:00
if not os . path . exists ( f " { programPath } /dlls-arm " ) :
2022-09-29 22:08:06 +08:00
if os . system ( f " 7z x -y \" { programPath } /dlls-arm.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
2022-08-11 21:54:20 +08:00
return
os . remove ( f " { programPath } /dlls-arm.7z " )
2022-07-18 11:21:22 +08:00
returnText . setText ( " " )
2023-08-05 22:30:35 +08:00
runWinetricks = RunWinetricksThread ( False )
2022-07-18 11:21:22 +08:00
runWinetricks . signal . connect ( QT . ShowWineReturn )
runWinetricks . start ( )
2022-08-11 21:54:20 +08:00
def CleanWineBottonByUOS ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " env WINE= ' { wine [ o1 . currentText ( ) ] } ' ' { programPath } /cleanbottle.sh ' ' { wineBottonPath } ' " )
2022-08-11 21:54:20 +08:00
2022-08-08 15:49:59 +08:00
def FontAppStore ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " env WINE= ' { programPath } /launch.sh ' ' { programPath } /InstallFont.py ' ' { wineBottonPath } ' { int ( setting [ ' RuntimeCache ' ] ) } " )
2022-07-18 11:21:22 +08:00
2022-08-24 16:13:47 +08:00
def GetDllFromInternet ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " env WINE= ' { programPath } /launch.sh ' ' { programPath } /InstallDll.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' { int ( setting [ ' RuntimeCache ' ] ) } " )
2022-08-26 14:00:05 +08:00
def WineBottonAutoConfig ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-10-23 21:26:47 +08:00
option = " "
if setting [ " Architecture " ] != " Auto " :
option + = f " WINEARCH= { setting [ ' Architecture ' ] } "
if setting [ " MonoGeckoInstaller " ] :
option + = f " WINEDLLOVERRIDES= \" mscoree,mshtml= \" "
if not setting [ " Debug " ] :
option + = " WINEDEBUG=-all "
else :
option + = " WINEDEBUG=FIXME,ERR,WARN,TRACE,Message "
os . system ( f " env WINEPREFIX= ' { wineBottonPath } ' { option } WINE= ' { wine [ o1 . currentText ( ) ] } ' ' { programPath } /AutoConfig.py ' ' { wine [ o1 . currentText ( ) ] } ' ' { wineBottonPath } ' " )
2022-08-24 16:13:47 +08:00
2022-07-18 11:21:22 +08:00
def InstallMonoGecko ( program ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " ' { programPath } /InstallMono.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' { program } { int ( setting [ ' RuntimeCache ' ] ) } " )
2022-07-18 11:21:22 +08:00
def InstallNetFramework ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " ' { programPath } /InstallNetFramework.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' { int ( setting [ ' RuntimeCache ' ] ) } " )
2022-07-18 11:21:22 +08:00
2022-10-05 17:54:12 +08:00
def InstallVB ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
OpenTerminal ( f " ' { programPath } /InstallVisualBasicRuntime.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' { int ( setting [ ' RuntimeCache ' ] ) } " )
2023-07-11 10:44:35 +08:00
def InstallFoxPro ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
OpenTerminal ( f " ' { programPath } /InstallFoxpro.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' { int ( setting [ ' RuntimeCache ' ] ) } " )
2022-07-18 11:21:22 +08:00
def InstallVisualStudioCPlusPlus ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " ' { programPath } /InstallVisualCPlusPlus.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' { int ( setting [ ' RuntimeCache ' ] ) } " )
2022-07-18 11:21:22 +08:00
def InstallMSXML ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " ' { programPath } /InstallMsxml.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' { int ( setting [ ' RuntimeCache ' ] ) } " )
2022-08-08 15:49:59 +08:00
def InstallDXVK ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-12-07 16:08:41 +08:00
OpenTerminal ( f " env WINE= ' { wine [ o1 . currentText ( ) ] } ' WINE64= ' { wine [ o1 . currentText ( ) ] } ' WINEPREFIX= ' { wineBottonPath } ' ' { programPath } /dxvk/setup_dxvk.sh ' uninstall " )
def InstallVkd3d ( ) :
if not os . path . exists ( f " { programPath } /vkd3d-proton " ) :
if os . system ( f " 7z x -y \" { programPath } /vkd3d-proton.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
return
os . remove ( f " { programPath } /vkd3d-proton.7z " )
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
OpenTerminal ( f " env WINE= ' { wine [ o1 . currentText ( ) ] } ' WINE64= ' { wine [ o1 . currentText ( ) ] } ' WINEPREFIX= ' { wineBottonPath } ' ' { programPath } /vkd3d-proton/setup_vkd3d_proton.sh ' install " )
def UninstallVkd3d ( ) :
if not os . path . exists ( f " { programPath } /vkd3d-proton " ) :
if os . system ( f " 7z x -y \" { programPath } /vkd3d-proton.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
return
os . remove ( f " { programPath } /vkd3d-proton.7z " )
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
OpenTerminal ( f " env WINE= ' { wine [ o1 . currentText ( ) ] } ' WINE64= ' { wine [ o1 . currentText ( ) ] } ' WINEPREFIX= ' { wineBottonPath } ' ' { programPath } /vkd3d-proton/setup_vkd3d_proton.sh ' uninstall " )
2022-08-27 02:00:41 +08:00
#process = QtCore.QProcess()
#process.startDetached(f"{programPath}/launch.sh", ["deepin-terminal", "-e",
#"env", f"WINE={wine[o1.currentText()]}", f"WINE64={wine[o1.currentText()]}", f"WINEPREFIX={wineBottonPath}", "bash",
#f"{programPath}/dxvk/setup_dxvk.sh", "install"])
2022-08-08 15:49:59 +08:00
def UninstallDXVK ( ) :
2022-08-11 21:54:20 +08:00
if not os . path . exists ( f " { programPath } /dxvk " ) :
2022-09-29 22:08:06 +08:00
if os . system ( f " 7z x -y \" { programPath } /dxvk.7z \" -o \" { programPath } \" " ) :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法解压资源 " )
2022-08-11 21:54:20 +08:00
return
os . remove ( f " { programPath } /dxvk.7z " )
2022-08-08 15:49:59 +08:00
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " env WINE= ' { wine [ o1 . currentText ( ) ] } ' WINE64= ' { wine [ o1 . currentText ( ) ] } ' WINEPREFIX= ' { wineBottonPath } ' ' { programPath } /dxvk/setup_dxvk.sh ' uninstall " )
#process = QtCore.QProcess()
#process.startDetached(f"{programPath}/launch.sh", ["deepin-terminal", "-e",
#"env", f"WINE={wine[o1.currentText()]}", f"WINE64={wine[o1.currentText()]}", f"WINEPREFIX={wineBottonPath}",
#f"{programPath}/dxvk/setup_dxvk.sh", "uninstall"])
2022-08-01 16:11:46 +08:00
2022-07-18 11:21:22 +08:00
def InstallOther ( ) :
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
2022-08-27 02:00:41 +08:00
OpenTerminal ( f " ' { programPath } /InstallOther.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' { int ( setting [ ' RuntimeCache ' ] ) } " )
2022-07-18 11:21:22 +08:00
def BuildExeDeb ( ) :
2022-07-19 08:23:31 +08:00
if e1 . currentText ( ) == " " :
2022-07-18 11:21:22 +08:00
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
threading . Thread ( target = os . system , args = [ f " python3 ' { programPath } /deepin-wine-packager.py ' ' { wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' " ] ) . start ( )
def SetDeepinFileDialogDeepin ( ) :
code = os . system ( f " pkexec \" { programPath } /deepin-wine-venturi-setter.py \" deepin " )
if code != 0 :
if code == 1 :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法更新配置:配置不准重复配置 " )
return
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 配置失败 " )
return
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 设置完成! " )
2022-10-16 22:07:48 +08:00
def AddReg ( ) :
path = QtWidgets . QFileDialog . getOpenFileName ( window , " 保存路径 " , get_home ( ) , " reg文件(*.reg);;所有文件(*.*) " )
if path [ 0 ] == " " and not path [ 1 ] :
return
RunWineProgram ( f " regedit ' /S ' { path [ 0 ] } ' ' HKEY_CURRENT_USER \ Software \ Wine \ DllOverrides " )
def SaveDllList ( ) :
path = QtWidgets . QFileDialog . getSaveFileName ( window , " 保存路径 " , get_home ( ) , " reg文件(*.reg);;所有文件(*.*) " )
if path [ 0 ] == " " and not path [ 1 ] :
return
RunWineProgram ( f " regedit ' /E ' { path [ 0 ] } ' ' HKEY_CURRENT_USER \ Software \ Wine \ DllOverrides " )
2022-07-18 11:21:22 +08:00
def SetDeepinFileDialogDefult ( ) :
code = os . system ( f " pkexec \" { programPath } /deepin-wine-venturi-setter.py \" defult " )
if code != 0 :
if code == 1 :
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 无法更新配置:配置不准重复配置 " )
return
QtWidgets . QMessageBox . critical ( widget , " 错误 " , " 配置失败 " )
return
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 设置完成! " )
def SetDeepinFileDialogRecovery ( ) :
2022-08-27 02:00:41 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " pkexec ' { programPath } /deepin-wine-venturi-setter.py ' recovery " ] ) . start ( )
2022-07-18 11:21:22 +08:00
2022-08-11 21:54:20 +08:00
def DeleteDesktopIcon ( ) :
if os . path . exists ( f " { get_home ( ) } /.local/share/applications/wine " ) :
try :
shutil . rmtree ( f " { get_home ( ) } /.local/share/applications/wine " )
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( widget , " 错误 " , traceback . format_exc ( ) )
return
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 删除完成 " )
2022-07-18 11:21:22 +08:00
def DeleteWineBotton ( ) :
if QtWidgets . QMessageBox . question ( widget , " 提示 " , " 你确定要删除容器吗?删除后将无法恢复! \n 如果没有选择 wine 容器,将会自动删除默认的容器! " ) == QtWidgets . QMessageBox . No :
return
if e1 . currentText ( ) == " " :
wineBottonPath = setting [ " DefultBotton " ]
else :
wineBottonPath = e1 . currentText ( )
try :
shutil . rmtree ( wineBottonPath )
QtWidgets . QMessageBox . information ( widget , " 提示 " , " 删除完毕! " )
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( widget , " 错误 " , traceback . format_exc ( ) )
def ThankWindow ( ) :
# 直接显示关于窗口,关于窗口已经添加
about_this_program ( )
def InstallWineFont ( ) :
2022-08-25 21:47:42 +08:00
# 筛选 apt
if not os . system ( " which aptss " ) :
2022-08-27 02:00:41 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " sudo aptss install ms-core-fonts -y " ] ) . start ( )
2022-08-25 21:47:42 +08:00
elif not os . system ( " which ss-apt-fast " ) :
2022-08-27 02:00:41 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " sudo ss-apt-fast install ms-core-fonts -y " ] ) . start ( )
2022-08-25 21:47:42 +08:00
elif not os . system ( " which apt-fast " ) :
2022-08-27 02:00:41 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " sudo apt-fast install ms-core-fonts -y " ] ) . start ( )
2022-08-25 21:47:42 +08:00
else :
2022-08-27 02:00:41 +08:00
threading . Thread ( target = OpenTerminal , args = [ f " sudo apt install ms-core-fonts -y " ] ) . start ( )
2022-07-18 11:21:22 +08:00
def WineRunnerBugUpload ( ) :
threading . Thread ( target = os . system , args = [ f " ' { programPath } /deepin-wine-runner-update-bug ' " ] ) . start ( )
2022-10-02 14:52:32 +08:00
def SetHttpProxy ( ) :
QtWidgets . QMessageBox . information ( window , " 提示 " , " 请在下面的对话框正确输入内容以便设置代理 " )
proxyServerAddress = QtWidgets . QInputDialog . getText ( window , " 提示 " , " 请输入代理服务器地址 " ) [ 0 ]
port = QtWidgets . QInputDialog . getText ( window , " 提示 " , " 请输入代理服务器端口 " ) [ 0 ]
if proxyServerAddress == " " or port == " " :
return
RunWineProgram ( " reg ' add ' HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings ' /v ProxyEnable /t REG_DWORD /d 00000001 ' /f " )
RunWineProgram ( f " reg ' add ' HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings ' /v ProxyServer /d ' { proxyServerAddress } : { port } ' ' /f " )
def DisbledHttpProxy ( ) :
RunWineProgram ( " reg ' add ' HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings ' /v ProxyEnable /t REG_DWORD /d 00000000 ' /f " )
2022-07-18 11:21:22 +08:00
def GetScreenSize ( ) :
screenInformation = [ ]
# 使用 xrandr 进行筛选
for i in subprocess . getoutput ( " xrandr " ) . split ( ' \n ' ) :
if not " connected " in i : # 检测连接的显示器
continue
# 获取分辨率基本信息,如
# DisplayPort-0 connected 1600x900+1280+0 (normal left inverted right x axis y axis) 434mm x 236mm
# 先判断是否为主屏幕
main = False
if " primary " in i :
main = True
# 进行进一步筛选
i = i [ i . index ( " connected " ) : ] . replace ( " connected " , " " ) . replace ( " primary " , " " )
# 进行初步筛选,如
# 1600x900+1280+0 (normal left inverted right x axis y axis) 434mm x 236mm
i = i [ : i . index ( " ( " ) ] . replace ( " " , " " )
# 筛选为 1600x900+0+0 进行最后数值的提取
screenInformation . append ( [
int ( i [ : i . index ( " x " ) ] ) , # 获取宽度
int ( i [ i . index ( " x " ) + 1 : i . index ( " + " ) ] ) , # 获取高度
int ( i [ i . index ( " + " ) + 1 : ] . split ( ' + ' ) [ 0 ] ) , # 获取显示屏 X 坐标
int ( i [ i . index ( " + " ) + 1 : ] . split ( ' + ' ) [ 1 ] ) , # 获取显示屏 Y 坐标
main # 是否为主屏幕
] )
return screenInformation # 返回结果
def UOSPackageScript ( ) :
threading . Thread ( target = os . system , args = [ f " python3 ' { programPath } /deepin-wine-packager-with-script.py ' " ] ) . start ( )
def RunVM ( ) :
threading . Thread ( target = os . system , args = [ f " bash ' { programPath } /RunVM.sh ' " ] ) . start ( )
2024-06-29 11:15:40 +08:00
2022-08-11 21:54:20 +08:00
2022-07-18 11:21:22 +08:00
class UpdateWindow ( ) :
data = { }
update = None
def ShowWindow ( ) :
UpdateWindow . update = QtWidgets . QMainWindow ( )
updateWidget = QtWidgets . QWidget ( )
updateWidgetLayout = QtWidgets . QGridLayout ( )
versionLabel = QtWidgets . QLabel ( f " 当前版本: { version } \n 最新版本:未知 \n 更新内容: " )
updateText = QtWidgets . QTextBrowser ( )
2023-04-08 11:07:42 +08:00
updateText . anchorClicked . connect ( OpenUrl )
2024-01-14 10:22:41 +08:00
updateText . setOpenLinks ( False )
2023-04-08 11:07:42 +08:00
updateText . setOpenExternalLinks ( False )
2023-11-26 14:34:08 +08:00
ok = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 更新(更新时会自动关闭 Wine 运行器) " ) )
2022-07-18 11:21:22 +08:00
ok . clicked . connect ( UpdateWindow . Update )
cancel = QtWidgets . QPushButton ( " 取消 " )
cancel . clicked . connect ( UpdateWindow . update . close )
2023-04-30 14:06:17 +08:00
url = " http://update.gfdgdxi.top/update.json "
2023-04-05 16:42:53 +08:00
try :
UpdateWindow . data = json . loads ( requests . get ( url ) . text )
versionLabel = QtWidgets . QLabel ( f " 当前版本: { version } \n 最新版本: { UpdateWindow . data [ ' Version ' ] } \n 更新内容: " )
if UpdateWindow . data [ " Version " ] == version :
updateText . setText ( " 此为最新版本,无需更新 " )
2022-07-18 11:21:22 +08:00
ok . setDisabled ( True )
2023-04-05 16:42:53 +08:00
else :
# 版本号读取(防止出现高版本号提示要“升级”到低版本号的问题)
localVersionList = version . split ( " . " )
webVersionList = UpdateWindow . data [ ' Version ' ] . split ( " . " )
for i in range ( len ( localVersionList ) ) :
local = int ( localVersionList [ i ] )
web = int ( webVersionList [ i ] )
if web < local :
updateText . setHtml ( f """ <p>此为最新版本,无需更新,但似乎您当前使用的程序版本比云端版本还要高。</p>
< p > 出现这个问题可能会有如下几种情况 : < / p >
< p > 1 、 使用编译或者内测版本 < / p >
< p > 2 、 自己修改了程序版本 < / p >
< p > 3 、 作者忘记更新云端上的更新信息了 < / p >
2023-04-08 11:07:42 +08:00
< p > 如果是第三种情况 , 请反馈到此 : < a href = ' https://gitee.com/gfdgd-xi/deep-wine-runner/issues/I6T3FG ' > https : / / gitee . com / gfdgd - xi / deep - wine - runner / issues / I6T3FG < / a > < / p >
2023-04-05 16:42:53 +08:00
< p > < img src = ' {programPath} /Icon/doge.png ' > < / p > """ )
ok . setDisabled ( True )
break
if web > local :
updateText . setText ( UpdateWindow . data [ " New " ] . replace ( " \\ n " , " \n " ) )
ok . setEnabled ( True )
break
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( updateWidget , " 错误 " , " 无法连接服务器! " )
2022-07-18 11:21:22 +08:00
updateWidgetLayout . addWidget ( versionLabel , 0 , 0 , 1 , 1 )
updateWidgetLayout . addWidget ( updateText , 1 , 0 , 1 , 3 )
updateWidgetLayout . addWidget ( ok , 2 , 2 , 1 , 1 )
updateWidgetLayout . addWidget ( cancel , 2 , 1 , 1 , 1 )
updateWidget . setLayout ( updateWidgetLayout )
UpdateWindow . update . setCentralWidget ( updateWidget )
2023-11-26 14:34:08 +08:00
UpdateWindow . update . setWindowTitle ( QtCore . QCoreApplication . translate ( " U " , " 检查更新 " ) )
2022-07-18 22:50:39 +08:00
UpdateWindow . update . resize ( updateWidget . frameGeometry ( ) . width ( ) , int ( updateWidget . frameGeometry ( ) . height ( ) * 1.5 ) )
2022-07-18 11:21:22 +08:00
UpdateWindow . update . show ( )
2022-07-18 15:22:00 +08:00
2022-07-18 11:21:22 +08:00
def Update ( ) :
if os . path . exists ( " /tmp/spark-deepin-wine-runner/update " ) :
shutil . rmtree ( " /tmp/spark-deepin-wine-runner/update " )
os . makedirs ( " /tmp/spark-deepin-wine-runner/update " )
2024-02-01 18:35:21 +08:00
unPackageNew = False
isArch = False
2024-02-02 18:07:06 +08:00
isFedora = False
2024-02-01 18:35:21 +08:00
if os . path . exists ( " /etc/arch-release " ) :
isArch = True
2024-02-01 18:47:47 +08:00
if UpdateWindow . data [ " Url-pkg " ] [ 0 ] == None :
2024-02-01 18:35:21 +08:00
unPackageNew = True
2024-02-02 18:07:06 +08:00
if os . path . exists ( " /etc/fedora-release " ) :
isFedora = True
if UpdateWindow . data [ " Url-rpm " ] [ 0 ] == None :
unPackageNew = True
2022-07-18 11:21:22 +08:00
try :
print ( UpdateWindow . data [ " Url " ] )
2024-02-01 18:35:21 +08:00
if os . path . exists ( f " { programPath } /off-line.lock " ) or programPath != " /opt/apps/deepin-wine-runner " or unPackageNew :
2023-12-03 10:33:04 +08:00
# 使用解压法更新
write_txt ( " /tmp/spark-deepin-wine-runner/update.sh " , f """ #!/bin/bash
echo 删除多余的安装包
rm - rfv / tmp / spark - deepin - wine - runner / update / *
echo 关闭 “ Wine 运行器 ”
python3 " {programPath} /updatekiller.py "
echo 下载安装包
wget - P / tmp / spark - deepin - wine - runner / update { UpdateWindow . data [ " Url " ] [ 0 ] }
echo 安装安装包
cd / tmp / spark - deepin - wine - runner / update
7 z x * . deb
7 z x data . tar
2023-12-03 11:12:40 +08:00
cp opt / apps / deepin - wine - runner / * " {programPath} " - rv
2023-12-03 10:33:04 +08:00
notify - send - i " {iconPath} " " 更新完毕! "
zenity - - info - - text = \" 更新完毕! \" --ellipsize
""" )
2023-12-03 11:12:40 +08:00
OpenTerminal ( " bash /tmp/spark-deepin-wine-runner/update.sh " )
return
2023-12-03 10:33:04 +08:00
else :
2024-02-01 18:35:21 +08:00
if isArch :
# 使用 pacman 安装更新
write_txt ( " /tmp/spark-deepin-wine-runner/update.sh " , f """ #!/bin/bash
echo 删除多余的安装包
rm - rfv / tmp / spark - deepin - wine - runner / update / *
echo 关闭 “ Wine 运行器 ”
python3 " {programPath} /updatekiller.py "
echo 下载安装包
2024-02-01 18:47:47 +08:00
wget - P / tmp / spark - deepin - wine - runner / update { UpdateWindow . data [ " Url-pkg " ] [ 0 ] }
2024-02-01 18:35:21 +08:00
echo 安装安装包
2024-02-01 18:52:19 +08:00
pacman - U / tmp / spark - deepin - wine - runner / update / * - - noconfirm
2024-02-01 18:35:21 +08:00
notify - send - i " {iconPath} " " 更新完毕! "
zenity - - info - - text = \" 更新完毕! \" --ellipsize
2024-02-02 18:07:06 +08:00
""" )
elif isFedora :
# 使用 yum 安装更新
write_txt ( " /tmp/spark-deepin-wine-runner/update.sh " , f """ #!/bin/bash
echo 删除多余的安装包
rm - rfv / tmp / spark - deepin - wine - runner / update / *
echo 关闭 “ Wine 运行器 ”
python3 " {programPath} /updatekiller.py "
echo 下载安装包
2024-02-02 18:14:24 +08:00
wget - O / tmp / spark - deepin - wine - runner / update / spark - deepin - wine - runner . rpm { UpdateWindow . data [ " Url-rpm " ] [ 0 ] }
2024-02-02 18:07:06 +08:00
echo 安装安装包
2024-02-02 18:55:57 +08:00
yum reinstall / tmp / spark - deepin - wine - runner / update / spark - deepin - wine - runner . rpm - y
2024-02-02 18:07:06 +08:00
notify - send - i " {iconPath} " " 更新完毕! "
zenity - - info - - text = \" 更新完毕! \" --ellipsize
2024-02-01 18:35:21 +08:00
""" )
else :
# 使用 deb 安装更新
write_txt ( " /tmp/spark-deepin-wine-runner/update.sh " , f """ #!/bin/bash
2022-07-18 11:21:22 +08:00
echo 删除多余的安装包
rm - rfv / tmp / spark - deepin - wine - runner / update / *
2023-04-05 16:53:09 +08:00
echo 关闭 “ Wine 运行器 ”
python3 " {programPath} /updatekiller.py "
2022-07-18 11:21:22 +08:00
echo 下载安装包
wget - P / tmp / spark - deepin - wine - runner / update { UpdateWindow . data [ " Url " ] [ 0 ] }
echo 安装安装包
dpkg - i / tmp / spark - deepin - wine - runner / update / *
echo 修复依赖关系
apt install - f - y
notify - send - i " {iconPath} " " 更新完毕! "
zenity - - info - - text = \" 更新完毕! \" --ellipsize
""" )
2023-12-03 11:12:40 +08:00
OpenTerminal ( " pkexec bash /tmp/spark-deepin-wine-runner/update.sh " )
2022-07-18 11:21:22 +08:00
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( None , " 出现错误,无法继续更新 " , traceback . format_exc ( ) )
2023-12-03 11:12:40 +08:00
2022-07-18 11:21:22 +08:00
class GetDllFromWindowsISO :
wineBottonPath = get_home ( ) + " /.wine "
2022-07-18 15:22:00 +08:00
isoPath = None
2022-07-18 11:21:22 +08:00
dllList = None
message = None
dllFound = None
dllControl = None
foundButton = None
saveDll = None
setWineBotton = None
browser = None
mount = False
mountButton = None
2022-07-18 15:22:00 +08:00
dllListModel = None
2022-09-10 11:55:55 +08:00
arch = 0
2022-07-18 11:21:22 +08:00
def ShowWindow ( ) :
2022-07-19 08:23:31 +08:00
#DisableButton(True)
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . message = QtWidgets . QMainWindow ( )
widget = QtWidgets . QWidget ( )
widgetLayout = QtWidgets . QGridLayout ( )
2022-07-18 11:21:22 +08:00
if not e1 . currentText ( ) == " " :
GetDllFromWindowsISO . wineBottonPath = e1 . currentText ( )
2023-11-26 14:34:08 +08:00
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , f """ 提示:
2022-09-10 13:04:44 +08:00
目前本提取功能暂只支持 NT 内核系统的官方安装镜像 , 不支持读取 ghost 等第三方封装方式的安装镜像
2022-09-10 11:55:55 +08:00
以及不要拷贝 / 替换太多的 dll , 否则可能会导致 wine 容器异常 , 以及不要替换 Wine 的核心 dll
2022-07-18 11:21:22 +08:00
最后 , 拷贝 / 替换 dll 后 , 建议点击下面 “ 设置 wine 容器 ” 按钮 == 》 函数库 进行设置
2022-12-05 22:21:33 +08:00
当前选择的 Wine 容器 : { GetDllFromWindowsISO . wineBottonPath } """ )), 0, 0, 1, 5)
2023-11-26 14:34:08 +08:00
isoLabel = QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " ISO镜像: " ) )
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . isoPath = QtWidgets . QComboBox ( )
2023-11-26 14:34:08 +08:00
GetDllFromWindowsISO . browser = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 浏览 " ) )
2022-07-18 15:22:00 +08:00
isoControl = QtWidgets . QWidget ( )
isoControlLayout = QtWidgets . QHBoxLayout ( )
isoControl . setLayout ( isoControlLayout )
dllControl = QtWidgets . QWidget ( )
dllControlLayout = QtWidgets . QHBoxLayout ( )
dllControl . setLayout ( dllControlLayout )
2023-11-26 14:34:08 +08:00
GetDllFromWindowsISO . mountButton = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 读取/挂载ISO镜像 " ) )
umountButton = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 关闭/卸载ISO镜像 " ) )
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . dllFound = QtWidgets . QComboBox ( )
2023-11-26 14:34:08 +08:00
GetDllFromWindowsISO . foundButton = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 查找 " ) )
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . dllList = QtWidgets . QListView ( )
2023-11-26 14:34:08 +08:00
GetDllFromWindowsISO . saveDll = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 保存到 wine 容器中 " ) )
GetDllFromWindowsISO . setWineBotton = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 设置 wine 容器 " ) )
2022-07-18 15:22:00 +08:00
isoLabel . setSizePolicy ( size )
GetDllFromWindowsISO . isoPath . setEditable ( True )
GetDllFromWindowsISO . isoPath . addItems ( isoPath )
GetDllFromWindowsISO . isoPath . setEditText ( " " )
GetDllFromWindowsISO . browser . setSizePolicy ( size )
GetDllFromWindowsISO . mountButton . setSizePolicy ( size )
isoControlLayout . addWidget ( GetDllFromWindowsISO . mountButton )
umountButton . setSizePolicy ( size )
isoControlLayout . addWidget ( umountButton )
GetDllFromWindowsISO . dllFound . setEditable ( True )
GetDllFromWindowsISO . dllFound . addItems ( isoPathFound )
GetDllFromWindowsISO . dllFound . setEditText ( " " )
GetDllFromWindowsISO . saveDll . setSizePolicy ( size )
dllControlLayout . addWidget ( GetDllFromWindowsISO . saveDll )
GetDllFromWindowsISO . setWineBotton . setSizePolicy ( size )
2022-07-18 11:21:22 +08:00
GetDllFromWindowsISO . DisbledDown ( True )
2022-07-18 15:22:00 +08:00
dllControlLayout . addWidget ( GetDllFromWindowsISO . setWineBotton )
widgetLayout . addWidget ( isoLabel , 1 , 0 , 1 , 1 )
widgetLayout . addWidget ( GetDllFromWindowsISO . isoPath , 1 , 1 , 1 , 1 )
widgetLayout . addWidget ( GetDllFromWindowsISO . browser , 1 , 2 , 1 , 1 )
widgetLayout . addWidget ( isoControl , 2 , 1 , 1 , 1 )
2023-11-26 14:34:08 +08:00
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 查找DLL \n (为空则代表不查找, \n 将显示全部内容): " ) ) , 3 , 0 , 1 , 1 )
2022-07-18 15:22:00 +08:00
widgetLayout . addWidget ( GetDllFromWindowsISO . dllFound , 3 , 1 , 1 , 1 )
widgetLayout . addWidget ( GetDllFromWindowsISO . foundButton , 3 , 2 , 1 , 1 )
widgetLayout . addWidget ( GetDllFromWindowsISO . dllList , 4 , 1 , 1 , 1 )
widgetLayout . addWidget ( dllControl , 5 , 1 , 1 , 1 )
widget . setLayout ( widgetLayout )
GetDllFromWindowsISO . browser . clicked . connect ( GetDllFromWindowsISO . Browser )
GetDllFromWindowsISO . mountButton . clicked . connect ( GetDllFromWindowsISO . MountDisk )
umountButton . clicked . connect ( GetDllFromWindowsISO . UmountDisk )
GetDllFromWindowsISO . foundButton . clicked . connect ( GetDllFromWindowsISO . Found )
GetDllFromWindowsISO . saveDll . clicked . connect ( GetDllFromWindowsISO . CopyDll )
GetDllFromWindowsISO . setWineBotton . clicked . connect ( lambda : RunWineProgram ( " winecfg " , Disbled = False ) )
GetDllFromWindowsISO . message . setCentralWidget ( widget )
GetDllFromWindowsISO . dllListModel = QtCore . QStringListModel ( )
GetDllFromWindowsISO . dllListModel . setStringList ( [ ] )
GetDllFromWindowsISO . dllList . setModel ( GetDllFromWindowsISO . dllListModel )
GetDllFromWindowsISO . isoPath . currentText ( )
2022-07-18 20:32:01 +08:00
GetDllFromWindowsISO . message . setWindowTitle ( f " Wine 运行器 { version } ——从 ISO 提取 DLL " )
2022-07-19 08:23:31 +08:00
GetDllFromWindowsISO . message . setWindowIcon ( QtGui . QIcon ( iconPath ) )
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . message . show ( )
2022-07-18 11:21:22 +08:00
def DisbledUp ( state ) :
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . isoPath . setDisabled ( state )
GetDllFromWindowsISO . browser . setDisabled ( state )
GetDllFromWindowsISO . mountButton . setDisabled ( state )
2022-07-18 11:21:22 +08:00
def DisbledDown ( state ) :
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . dllList . setDisabled ( state )
GetDllFromWindowsISO . dllFound . setDisabled ( state )
GetDllFromWindowsISO . saveDll . setDisabled ( state )
GetDllFromWindowsISO . setWineBotton . setDisabled ( state )
GetDllFromWindowsISO . foundButton . setDisabled ( state )
2022-07-18 11:21:22 +08:00
def Browser ( ) :
2022-07-18 15:22:00 +08:00
path = QtWidgets . QFileDialog . getOpenFileName ( GetDllFromWindowsISO . message , " 选择 ISO 镜像文件 " , json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/FindISO.json " ) ) [ " path " ] , " iso 镜像文件(*.iso);;ISO 镜像文件(*.ISO);;所有文件(*.*) " ) [ 0 ]
2022-07-18 11:21:22 +08:00
if path == None or path == " " :
return
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . isoPath . setEditText ( path )
2022-07-18 11:21:22 +08:00
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/FindISO.json " , json . dumps ( { " path " : os . path . dirname ( path ) } ) ) # 写入配置文件
def Found ( ) :
2022-07-18 15:22:00 +08:00
found = GetDllFromWindowsISO . dllFound . currentText ( )
findList = [ ]
2022-07-18 11:21:22 +08:00
try :
if found == " " :
2022-09-10 11:55:55 +08:00
# 显示所有内容
# 下面内容需要分类讨论
if GetDllFromWindowsISO . arch == 0 :
for i in os . listdir ( " /tmp/wine-runner-getdll/i386 " ) :
if i [ - 3 : ] == " dl_ " :
findList . append ( i [ : - 1 ] + " l " )
elif GetDllFromWindowsISO . arch == 32 :
for i in os . listdir ( " /tmp/wine-runner-getdll-wim/Windows/SysWOW64 " ) :
if i [ - 3 : ] == " dll " :
findList . append ( i [ : - 1 ] + " l " )
elif GetDllFromWindowsISO . arch == 64 :
for i in os . listdir ( " /tmp/wine-runner-getdll-wim/Windows/System32 " ) :
if i [ - 3 : ] == " dll " :
findList . append ( i [ : - 1 ] + " l " )
GetDllFromWindowsISO . dllListModel . setStringList ( findList )
2022-07-18 11:21:22 +08:00
return
2022-09-10 11:55:55 +08:00
if GetDllFromWindowsISO . arch == 0 :
for i in os . listdir ( " /tmp/wine-runner-getdll/i386 " ) :
if found in i [ : - 1 ] + " l " :
findList . append ( i [ : - 1 ] + " l " )
elif GetDllFromWindowsISO . arch == 32 :
for i in os . listdir ( " /tmp/wine-runner-getdll-wim/Windows/SysWOW64 " ) :
if found in i [ : - 1 ] + " l " :
findList . append ( i [ : - 1 ] + " l " )
elif GetDllFromWindowsISO . arch == 64 :
for i in os . listdir ( " /tmp/wine-runner-getdll-wim/Windows/System32 " ) :
if found in i [ : - 1 ] + " l " :
findList . append ( i [ : - 1 ] + " l " )
if len ( isoPath ) == 0 :
if isoPathFound [ - 1 ] != found :
isoPathFound . append ( found ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/ISOPathFound.json " , str ( json . dumps ( ListToDictionary ( isoPathFound ) ) ) ) # 将历史记录的数组转换为字典并写入
2022-07-18 15:22:00 +08:00
GetDllFromWindowsISO . dllFound . clear ( )
GetDllFromWindowsISO . dllFound . addItems ( isoPathFound )
GetDllFromWindowsISO . dllListModel . setStringList ( findList )
2022-07-18 11:21:22 +08:00
except :
traceback . print_exc ( )
2022-12-05 22:36:19 +08:00
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , transla . trans ( " 错误 " ) , traceback . format_exc ( ) )
2022-07-18 11:21:22 +08:00
2022-09-28 20:41:06 +08:00
2022-07-18 11:21:22 +08:00
def MountDisk ( ) :
2022-07-18 15:22:00 +08:00
if not os . path . exists ( GetDllFromWindowsISO . isoPath . currentText ( ) ) :
2022-12-05 22:36:19 +08:00
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , transla . trans ( " 错误 " ) , transla . trans ( " 您选择的 ISO 镜像文件不存在 " ) )
2022-07-18 11:21:22 +08:00
return
if os . path . exists ( " /tmp/wine-runner-getdll " ) :
try :
os . rmdir ( " /tmp/wine-runner-getdll " )
2022-09-28 20:38:23 +08:00
os . system ( " rm -rf /tmp/wine-runner-getdll-wim " )
2022-07-18 11:21:22 +08:00
except :
# 如果无法删除可能是挂载了文件
2022-09-10 11:55:55 +08:00
os . system ( " wimunmount /tmp/wine-runner-getdll-wim " )
2022-07-18 11:21:22 +08:00
os . system ( " pkexec umount /tmp/wine-runner-getdll " )
2022-09-10 11:55:55 +08:00
2022-07-18 11:21:22 +08:00
try :
os . rmdir ( " /tmp/wine-runner-getdll " )
2022-09-10 11:55:55 +08:00
os . rmdir ( " /tmp/wine-runner-getdll-wim " )
2022-07-18 11:21:22 +08:00
except :
traceback . print_exc ( )
2022-07-18 15:22:00 +08:00
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , " 错误 " , traceback . format_exc ( ) )
2022-07-18 11:21:22 +08:00
return
os . makedirs ( " /tmp/wine-runner-getdll " )
2022-07-18 15:22:00 +08:00
os . system ( f " pkexec mount ' { GetDllFromWindowsISO . isoPath . currentText ( ) } ' /tmp/wine-runner-getdll " )
findList = [ ]
2022-09-10 11:55:55 +08:00
# 判断是新版的 Windows ISO( Windows Vista 及以上版本)
if os . path . exists ( " /tmp/wine-runner-getdll/sources/install.wim " ) :
2022-09-28 20:36:04 +08:00
# 如果没有安装 wimtools 的话
if os . system ( " which wimmount " ) != 0 :
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , " 错误 " , f " 镜像内容读取/挂载失败,因为没有安装 wimtools 以至无法读取 " )
return
2022-09-10 11:55:55 +08:00
# 是新版,挂载 wim
# 需要让用户选择挂载内容
QtWidgets . QInputDialog . getMultiLineText ( GetDllFromWindowsISO . message , " 提示 " , " 挂载文件需要用户记住并在下一个对话框输入 Index 以挂载正确的镜像,按下下方任意按钮即可继续 " , subprocess . getoutput ( " wiminfo ' /tmp/wine-runner-getdll/sources/install.wim ' " ) )
choose = QtWidgets . QInputDialog . getInt ( GetDllFromWindowsISO . message , " 提示 " , " 请输入 Index " )
if not choose [ 1 ] :
return
os . makedirs ( " /tmp/wine-runner-getdll-wim " )
os . system ( f " wimmount /tmp/wine-runner-getdll/sources/install.wim { choose [ 0 ] } /tmp/wine-runner-getdll-wim " )
if os . path . exists ( " /tmp/wine-runner-getdll-wim/Windows/SysWOW64 " ) :
# 如果是 64 位镜像
if QtWidgets . QInputDialog . getItem ( GetDllFromWindowsISO . message , " 选择位数 " , " 选择位数(如果没有选择,默认为 64 位) " , [ " 32 " , " 64 " ] , 1 , False ) == " 32 " :
# 64 位镜像的 32 位是存在 SysWOW64 的
try :
for i in os . listdir ( " /tmp/wine-runner-getdll-wim/Windows/SysWOW64 " ) :
if i [ - 3 : ] == " dll " :
findList . append ( i [ : - 1 ] + " l " )
GetDllFromWindowsISO . dllListModel . setStringList ( findList )
GetDllFromWindowsISO . arch = 32
GetDllFromWindowsISO . DisbledDown ( False )
GetDllFromWindowsISO . DisbledUp ( True )
GetDllFromWindowsISO . mount = True
if len ( isoPath ) == 0 or isoPath [ - 1 ] != GetDllFromWindowsISO . isoPath . currentText ( ) :
isoPath . append ( GetDllFromWindowsISO . isoPath . currentText ( ) ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/ISOPath.json " , str ( json . dumps ( ListToDictionary ( isoPath ) ) ) ) # 将历史记录的数组转换为字典并写入
GetDllFromWindowsISO . isoPath . clear ( )
GetDllFromWindowsISO . isoPath . addItems ( isoPath )
return
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , " 错误 " , f " 镜像内容读取/挂载失败,报错如下: \n { traceback . format_exc ( ) } " )
return
try :
for i in os . listdir ( " /tmp/wine-runner-getdll-wim/Windows/System32 " ) :
if i [ - 3 : ] == " dll " :
findList . append ( i [ : - 1 ] + " l " )
GetDllFromWindowsISO . arch = 64
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , " 错误 " , f " 镜像内容读取/挂载失败,报错如下: \n { traceback . format_exc ( ) } " )
return
GetDllFromWindowsISO . dllListModel . setStringList ( findList )
else :
try :
for i in os . listdir ( " /tmp/wine-runner-getdll/i386 " ) :
if i [ - 3 : ] == " dl_ " :
findList . append ( i [ : - 1 ] + " l " )
GetDllFromWindowsISO . arch = 0
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , " 错误 " , f " 镜像内容读取/挂载失败,报错如下: \n { traceback . format_exc ( ) } " )
return
GetDllFromWindowsISO . dllListModel . setStringList ( findList )
2022-07-18 11:21:22 +08:00
GetDllFromWindowsISO . DisbledDown ( False )
GetDllFromWindowsISO . DisbledUp ( True )
GetDllFromWindowsISO . mount = True
2022-08-05 17:46:41 +08:00
if len ( isoPath ) == 0 or isoPath [ - 1 ] != GetDllFromWindowsISO . isoPath . currentText ( ) :
isoPath . append ( GetDllFromWindowsISO . isoPath . currentText ( ) ) # 将记录写进数组
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/ISOPath.json " , str ( json . dumps ( ListToDictionary ( isoPath ) ) ) ) # 将历史记录的数组转换为字典并写入
GetDllFromWindowsISO . isoPath . clear ( )
GetDllFromWindowsISO . isoPath . addItems ( isoPath )
2022-07-18 15:22:00 +08:00
#GetDllFromWindowsISO.isoPath['value'] = isoPath
2022-07-18 11:21:22 +08:00
def UmountDisk ( ) :
2022-09-10 11:55:55 +08:00
os . system ( " wimunmount /tmp/wine-runner-getdll-wim " )
2022-07-18 11:21:22 +08:00
os . system ( " pkexec umount /tmp/wine-runner-getdll " )
try :
shutil . rmtree ( " /tmp/wine-runner-getdll " )
2022-09-10 11:55:55 +08:00
os . system ( " rm -rf /tmp/wine-runner-getdll-wim " )
2022-07-18 11:21:22 +08:00
except :
traceback . print_exc ( )
2023-11-26 14:34:08 +08:00
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , QtCore . QCoreApplication . translate ( " U " , " 错误 " ) , f " 关闭/卸载镜像失败,报错如下: \n { traceback . format_exc ( ) } " )
2022-07-18 11:21:22 +08:00
return
GetDllFromWindowsISO . DisbledDown ( True )
GetDllFromWindowsISO . DisbledUp ( False )
GetDllFromWindowsISO . mount = False
2023-11-26 14:34:08 +08:00
QtWidgets . QMessageBox . information ( GetDllFromWindowsISO . message , QtCore . QCoreApplication . translate ( " U " , " 提示 " ) , QtCore . QCoreApplication . translate ( " U " , " 关闭/卸载成功! " ) )
2022-07-18 11:21:22 +08:00
def CopyDll ( ) :
2022-07-18 15:22:00 +08:00
choose = GetDllFromWindowsISO . dllList . selectionModel ( ) . selectedIndexes ( ) [ 0 ] . data ( )
if os . path . exists ( f " { GetDllFromWindowsISO . wineBottonPath } /drive_c/windows/system32/ { choose } " ) :
2022-09-10 11:55:55 +08:00
if QtWidgets . QMessageBox . question ( GetDllFromWindowsISO . message , " 提示 " , f " DLL { choose } 已经存在,是否覆盖? " ) == QtWidgets . QMessageBox . No :
2022-07-18 15:22:00 +08:00
return
try :
2022-09-10 11:55:55 +08:00
# 要分类讨论
if GetDllFromWindowsISO . arch == 0 :
shutil . copy ( f " /tmp/wine-runner-getdll/i386/ { choose [ : - 1 ] } _ " , f " { GetDllFromWindowsISO . wineBottonPath } /drive_c/windows/system32/ { choose } " )
elif GetDllFromWindowsISO . arch == 32 :
shutil . copy ( f " /tmp/wine-runner-getdll-wim/Windows/SysWOW64/ { choose [ : - 1 ] } l " , f " { GetDllFromWindowsISO . wineBottonPath } /drive_c/windows/system32/ { choose } " )
elif GetDllFromWindowsISO . arch == 64 :
shutil . copy ( f " /tmp/wine-runner-getdll-wim/Windows/System32/ { choose [ : - 1 ] } l " , f " { GetDllFromWindowsISO . wineBottonPath } /drive_c/windows/system32/ { choose } " )
# 选择原装或优于内建
if QtWidgets . QInputDialog . getItem ( GetDllFromWindowsISO . message , " 选择 " , " 选择模式 " , [ " 原装先于内建 " , " 原装 " ] , 0 , False ) == " 原装先于内建 " :
# 原装先于内建
os . system ( f " WINEPREFIX= ' { GetDllFromWindowsISO . wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' reg add ' HKEY_CURRENT_USER \ Software \ Wine \ DllOverrides ' /v { os . path . splitext ( choose ) [ 0 ] } /d native,builtin /f " )
else :
# 原装
os . system ( f " WINEPREFIX= ' { GetDllFromWindowsISO . wineBottonPath } ' ' { wine [ o1 . currentText ( ) ] } ' reg add ' HKEY_CURRENT_USER \ Software \ Wine \ DllOverrides ' /v { os . path . splitext ( choose ) [ 0 ] } /d native /f " )
2022-07-18 15:22:00 +08:00
QtWidgets . QMessageBox . information ( GetDllFromWindowsISO . message , " 提示 " , " 提取成功! " )
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( GetDllFromWindowsISO . message , " 错误 " , traceback . format_exc ( ) )
2022-08-13 17:50:21 +08:00
2022-09-20 21:53:37 +08:00
choose = None
2022-08-13 17:50:21 +08:00
2022-07-18 11:21:22 +08:00
class ProgramSetting ( ) :
wineBottonA = None
wineDebug = None
defultWine = None
defultBotton = None
terminalOpen = None
wineOption = None
#wineBottonDifferent = None
centerWindow = None
message = None
2022-07-29 15:35:07 +08:00
theme = None
2022-08-01 16:11:46 +08:00
monogeckoInstaller = None
2022-08-08 15:49:59 +08:00
autoWine = None
runtimeCache = None
2022-09-10 22:29:09 +08:00
buildByBottleName = None
2022-09-28 21:00:53 +08:00
autoPath = None
2022-12-08 22:55:40 +08:00
qemuUnmountHome = None
2023-03-19 14:58:20 +08:00
chineseLanguage = None
2023-08-13 21:30:15 +08:00
fontSize = None
2022-07-18 11:21:22 +08:00
def ShowWindow ( ) :
ProgramSetting . message = QtWidgets . QMainWindow ( )
widget = QtWidgets . QWidget ( )
widgetLayout = QtWidgets . QGridLayout ( )
2023-11-26 14:34:08 +08:00
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 选择 Wine 容器版本: " ) ) , 0 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " wine DEBUG 信息输出: " ) ) , 1 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 默认 Wine: " ) ) , 2 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 默认 Wine 容器: " ) ) , 3 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 使用终端打开: " ) ) , 4 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 自定义 wine 参数: " ) ) , 5 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 程序主题: " ) ) , 6 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " Wine 默认 Mono 和 Gecko 安装器: " ) ) , 7 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 忽略未安装的 Wine: " ) ) , 8 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 下载缓存: " ) ) , 9 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 图标生成: " ) ) , 10 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 自动根据EXE名称生成路径: " ) ) , 11 , 0 , 1 , 1 )
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " Qemu + Chroot 挂载用户目录: " ) ) , 12 , 0 , 1 , 1 )
2024-04-27 14:22:26 +08:00
#widgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "程序翻译:")), 13, 0, 1, 1)
2023-11-26 14:34:08 +08:00
widgetLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 字体缩小比例(数值越大字体越小,默认为 1) : " ) ) , 14 , 0 , 1 , 1 )
2022-07-18 11:21:22 +08:00
ProgramSetting . wineBottonA = QtWidgets . QComboBox ( )
2023-11-26 14:34:08 +08:00
ProgramSetting . wineDebug = QtWidgets . QCheckBox ( QtCore . QCoreApplication . translate ( " U " , " 开启 DEBUG 输出 " ) )
2022-07-18 11:21:22 +08:00
ProgramSetting . defultWine = QtWidgets . QComboBox ( )
ProgramSetting . defultBotton = QtWidgets . QLineEdit ( )
2022-07-29 15:35:07 +08:00
ProgramSetting . theme = QtWidgets . QComboBox ( )
ProgramSetting . theme . addItems ( QtWidgets . QStyleFactory . keys ( ) )
ProgramSetting . theme . setCurrentText ( setting [ " Theme " ] )
2023-11-26 14:34:08 +08:00
save = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 保存 " ) )
2022-07-18 11:21:22 +08:00
save . clicked . connect ( ProgramSetting . Save )
2023-11-26 14:34:08 +08:00
defultBottonButton = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 浏览 " ) )
2022-07-18 11:21:22 +08:00
defultBottonButton . clicked . connect ( ProgramSetting . Browser )
2023-11-26 14:34:08 +08:00
themeTry = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 测试(重启后变回设置的主题) " ) )
2022-07-29 15:35:07 +08:00
themeTry . clicked . connect ( ProgramSetting . Try )
2023-11-26 14:34:08 +08:00
ProgramSetting . terminalOpen = QtWidgets . QCheckBox ( QtCore . QCoreApplication . translate ( " U " , " 使用终端打开( deepin 终端) " ) )
2022-07-18 11:21:22 +08:00
ProgramSetting . wineOption = QtWidgets . QLineEdit ( )
2023-11-26 14:34:08 +08:00
ProgramSetting . monogeckoInstaller = QtWidgets . QCheckBox ( QtCore . QCoreApplication . translate ( " U " , " 屏蔽 Wine 默认 Mono 和 Gecko 安装器 " ) )
ProgramSetting . autoWine = QtWidgets . QCheckBox ( QtCore . QCoreApplication . translate ( " U " , " 不显示未检测到的 Wine " ) )
ProgramSetting . runtimeCache = QtWidgets . QCheckBox ( QtCore . QCoreApplication . translate ( " U " , " 开启下载缓存 " ) )
ProgramSetting . buildByBottleName = QtWidgets . QCheckBox ( QtCore . QCoreApplication . translate ( " U " , " 本软件构建的图标后面添加容器名 " ) )
ProgramSetting . autoPath = QtWidgets . QCheckBox ( QtCore . QCoreApplication . translate ( " U " , " 自动根据文件名生成容器路径( 开启后必须通过修改默认wine容器路径才可指定其它路径, 重启程序后生效) " ) )
ProgramSetting . qemuUnmountHome = QtWidgets . QCheckBox ( QtCore . QCoreApplication . translate ( " U " , " 使用 Qemu + Chroot 时不挂载用户目录并与系统隔离(修改后重启操作系统生效) " ) )
2024-04-27 14:22:26 +08:00
#ProgramSetting.chineseLanguage = QtWidgets.QCheckBox(QtCore.QCoreApplication.translate("U", "禁用程序界面翻译"))
2023-08-13 21:30:15 +08:00
ProgramSetting . fontSize = QtWidgets . QDoubleSpinBox ( )
2022-07-18 11:21:22 +08:00
ProgramSetting . wineBottonA . addItems ( [ " Auto " , " win32 " , " win64 " ] )
ProgramSetting . wineBottonA . setCurrentText ( setting [ " Architecture " ] )
ProgramSetting . wineDebug . setChecked ( setting [ " Debug " ] )
ProgramSetting . defultWine . addItems ( wine . keys ( ) )
ProgramSetting . defultWine . setCurrentText ( setting [ " DefultWine " ] )
ProgramSetting . defultBotton . setText ( setting [ " DefultBotton " ] )
ProgramSetting . terminalOpen . setChecked ( setting [ " TerminalOpen " ] )
ProgramSetting . wineOption . setText ( setting [ " WineOption " ] )
2022-08-01 16:11:46 +08:00
ProgramSetting . monogeckoInstaller . setChecked ( setting [ " MonoGeckoInstaller " ] )
2022-08-08 15:49:59 +08:00
ProgramSetting . autoWine . setChecked ( setting [ " AutoWine " ] )
ProgramSetting . runtimeCache . setChecked ( setting [ " RuntimeCache " ] )
2022-09-10 22:29:09 +08:00
ProgramSetting . buildByBottleName . setChecked ( setting [ " BuildByBottleName " ] )
2022-09-28 21:00:53 +08:00
ProgramSetting . autoPath . setChecked ( setting [ " AutoPath " ] )
2022-12-08 22:55:40 +08:00
ProgramSetting . qemuUnmountHome . setChecked ( setting [ " QemuUnMountHome " ] )
2024-04-27 14:22:26 +08:00
#ProgramSetting.chineseLanguage.setChecked(setting["Chinese"])
2023-08-13 21:30:15 +08:00
ProgramSetting . fontSize . setValue ( setting [ " FontSize " ] )
2022-12-08 22:55:40 +08:00
# QemuUnMountHome
2022-07-18 11:21:22 +08:00
widgetLayout . addWidget ( ProgramSetting . wineBottonA , 0 , 1 , 1 , 1 )
widgetLayout . addWidget ( ProgramSetting . wineDebug , 1 , 1 , 1 , 1 )
widgetLayout . addWidget ( ProgramSetting . defultWine , 2 , 1 , 1 , 1 )
widgetLayout . addWidget ( ProgramSetting . defultBotton , 3 , 1 , 1 , 1 )
widgetLayout . addWidget ( defultBottonButton , 3 , 2 , 1 , 1 )
widgetLayout . addWidget ( ProgramSetting . terminalOpen , 4 , 1 , 1 , 1 )
widgetLayout . addWidget ( ProgramSetting . wineOption , 5 , 1 , 1 , 1 )
2022-07-29 15:35:07 +08:00
widgetLayout . addWidget ( ProgramSetting . theme , 6 , 1 , 1 , 1 )
widgetLayout . addWidget ( themeTry , 6 , 2 , 1 , 1 )
2022-08-01 16:11:46 +08:00
widgetLayout . addWidget ( ProgramSetting . monogeckoInstaller , 7 , 1 , 1 , 1 )
2022-08-08 15:49:59 +08:00
widgetLayout . addWidget ( ProgramSetting . autoWine , 8 , 1 , 1 , 1 )
widgetLayout . addWidget ( ProgramSetting . runtimeCache , 9 , 1 , 1 , 1 )
2022-09-10 22:29:09 +08:00
widgetLayout . addWidget ( ProgramSetting . buildByBottleName , 10 , 1 , 1 , 1 )
2022-09-28 21:00:53 +08:00
widgetLayout . addWidget ( ProgramSetting . autoPath , 11 , 1 , 1 , 2 )
2022-12-08 22:55:40 +08:00
widgetLayout . addWidget ( ProgramSetting . qemuUnmountHome , 12 , 1 , 1 , 2 )
2024-04-27 14:22:26 +08:00
#widgetLayout.addWidget(ProgramSetting.chineseLanguage, 13, 1, 1, 2)
2023-08-13 21:30:15 +08:00
widgetLayout . addWidget ( ProgramSetting . fontSize , 14 , 1 , 1 , 2 )
widgetLayout . addWidget ( save , 15 , 2 , 1 , 1 )
2022-07-18 11:21:22 +08:00
widget . setLayout ( widgetLayout )
ProgramSetting . message . setCentralWidget ( widget )
2022-08-13 17:50:21 +08:00
ProgramSetting . message . setWindowIcon ( QtGui . QIcon ( iconPath ) )
2022-07-18 11:21:22 +08:00
ProgramSetting . message . setWindowTitle ( f " 设置 wine 运行器 { version } " )
ProgramSetting . message . show ( )
def Browser ( ) :
2023-11-26 14:34:08 +08:00
path = QtWidgets . QFileDialog . getExistingDirectory ( ProgramSetting . message , QtCore . QCoreApplication . translate ( " U " , " 选择 Wine 容器 " ) , json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/WineBotton.json " ) ) [ " path " ] )
2022-07-18 11:21:22 +08:00
if path == " " or path == None or path == " () " or path == ( ) :
return
ProgramSetting . defultBotton . setText ( path )
2022-07-29 15:35:07 +08:00
def Try ( ) :
app . setStyle ( QtWidgets . QStyleFactory . create ( ProgramSetting . theme . currentText ( ) ) )
2022-07-18 11:21:22 +08:00
def Save ( ) :
# 写入容器位数设置
setting [ " Architecture " ] = ProgramSetting . wineBottonA . currentText ( )
setting [ " Debug " ] = ProgramSetting . wineDebug . isChecked ( )
setting [ " DefultWine " ] = ProgramSetting . defultWine . currentText ( )
setting [ " DefultBotton " ] = ProgramSetting . defultBotton . text ( )
setting [ " TerminalOpen " ] = ProgramSetting . terminalOpen . isChecked ( )
setting [ " WineOption " ] = ProgramSetting . wineOption . text ( )
2022-07-29 15:35:07 +08:00
setting [ " Theme " ] = ProgramSetting . theme . currentText ( )
2022-08-01 16:11:46 +08:00
setting [ " MonoGeckoInstaller " ] = ProgramSetting . monogeckoInstaller . isChecked ( )
2022-08-08 15:49:59 +08:00
setting [ " AutoWine " ] = ProgramSetting . autoWine . isChecked ( )
setting [ " RuntimeCache " ] = ProgramSetting . runtimeCache . isChecked ( )
2022-09-10 22:29:09 +08:00
setting [ " BuildByBottleName " ] = ProgramSetting . buildByBottleName . isChecked ( )
2022-09-28 21:00:53 +08:00
setting [ " AutoPath " ] = ProgramSetting . autoPath . isChecked ( )
2022-12-08 22:55:40 +08:00
setting [ " QemuUnMountHome " ] = ProgramSetting . qemuUnmountHome . isChecked ( )
2024-04-27 14:22:26 +08:00
#setting["Chinese"] = ProgramSetting.chineseLanguage.isChecked()
2023-08-13 21:30:15 +08:00
setting [ " FontSize " ] = ProgramSetting . fontSize . value ( )
2022-07-18 11:21:22 +08:00
try :
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/WineSetting.json " , json . dumps ( setting ) )
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( ProgramSetting . message , " 错误 " , traceback . format_exc ( ) )
return
QtWidgets . QMessageBox . information ( ProgramSetting . message , " 提示 " , " 保存完毕! " )
2022-09-09 22:12:27 +08:00
class ValueCheck ( ) :
def __init__ ( self ) :
pass
def BASE64 ( self , filePath ) :
src = " "
with open ( filePath , " rb " ) as f :
base64Byte = base64 . b64encode ( f . read ( ) )
src + = base64Byte . decode ( " utf-8 " )
return src
def SHA1 ( self , filePath ) :
sha1 = hashlib . sha1 ( )
file = open ( filePath , " rb " )
while True :
readByte = file . read ( 1024 * 1024 )
sha1 . update ( readByte )
if not readByte :
break
file . close ( )
return sha1 . hexdigest ( )
def MD5 ( self , filePath ) :
md5 = hashlib . md5 ( )
file = open ( filePath , " rb " )
while True :
readByte = file . read ( 1024 * 1024 )
md5 . update ( readByte )
if not readByte :
break
file . close ( )
return md5 . hexdigest ( )
def SHA256 ( self , filePath ) :
value = hashlib . sha256 ( )
file = open ( filePath , " rb " )
while True :
readByte = file . read ( 1024 * 1024 )
value . update ( readByte )
if not readByte :
break
file . close ( )
return value . hexdigest ( )
def SHA384 ( self , filePath ) :
value = hashlib . sha384 ( )
file = open ( filePath , " rb " )
while True :
readByte = file . read ( 1024 * 1024 )
value . update ( readByte )
if not readByte :
break
file . close ( )
return value . hexdigest ( )
def SHA224 ( self , filePath ) :
value = hashlib . sha224 ( )
file = open ( filePath , " rb " )
while True :
readByte = file . read ( 1024 * 1024 )
value . update ( readByte )
if not readByte :
break
file . close ( )
return value . hexdigest ( )
def SHA512 ( self , filePath ) :
value = hashlib . sha512 ( )
file = open ( filePath , " rb " )
while True :
readByte = file . read ( 1024 * 1024 )
value . update ( readByte )
if not readByte :
break
file . close ( )
return value . hexdigest ( )
link = {
" SHA1 " : SHA1 ,
" MD5 " : MD5 ,
" SHA256 " : SHA256 ,
" SHA512 " : SHA512 ,
" SHA224 " : SHA224 ,
" SHA384 " : SHA384 ,
" BASE64 " : BASE64
}
2022-08-27 02:00:41 +08:00
2022-09-09 22:12:27 +08:00
def Get ( self , types ) :
QtWidgets . QMessageBox . information ( window , " 提示 " , " 在计算过程中,程序可能会出现无响应的问题,请稍后 \n 请在接下来的打开对话框中选择要计算的文件 " )
file = QtWidgets . QFileDialog . getOpenFileName ( window , " 打开 " ) [ 0 ]
if file == " " :
return
try :
2023-04-15 19:35:17 +08:00
value = self . link [ types ] ( self , file )
if QtWidgets . QInputDialog . getText ( window , " 值 " , " 下面是计算得到的值,<b>是否要复制到剪切板?</b> " , QtWidgets . QLineEdit . Normal , value ) [ 1 ] :
pyperclip . copy ( value )
QtWidgets . QMessageBox . information ( window , " 提示 " , " 复制成功! " )
2022-09-09 22:12:27 +08:00
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( window , " 错误 " , traceback . format_exc ( ) )
2022-08-27 02:00:41 +08:00
2022-09-28 21:00:53 +08:00
def ChangePath ( ) :
e1 . setCurrentText ( f ' { setting [ " DefultBotton " ] } / { os . path . splitext ( os . path . basename ( e2 . currentText ( ) ) ) [ 0 ] } ' )
2023-05-28 20:37:13 +08:00
def ConnectRemoteWindowsPC ( ip : str ) :
2023-05-28 21:01:35 +08:00
if os . system ( " which xfreerdp " ) :
if QtWidgets . QMessageBox . question ( window , " 提示 " , " 未检测到 xfreerdp, 是否立即安装? " ) == QtWidgets . QMessageBox . Yes :
OpenTerminal ( " sudo apt install xfreerdp -y " )
2023-05-28 20:37:13 +08:00
return
2023-05-28 21:01:35 +08:00
os . system ( f " xfreerdp ' { ip } ' " )
2023-05-28 20:37:13 +08:00
2022-11-24 22:46:39 +08:00
def UploadLog ( ) :
2022-11-25 09:40:24 +08:00
if QtWidgets . QMessageBox . question ( window , " 提示 " , " 您确定要上传吗?上传内容将不会公开,将用于加强日志分析功能 " ) == QtWidgets . QMessageBox . Yes :
text = QtWidgets . QInputDialog . getMultiLineText ( window , " 输入内容 " , " 输入描述信息 " )
2022-11-24 22:46:39 +08:00
try :
2022-11-25 09:40:24 +08:00
returnList = requests . post ( base64 . b64decode ( " aHR0cDovLzEyMC4yNS4xNTMuMTQ0OjMwMjUwL2xvZw== " ) . decode ( " utf-8 " ) , {
2022-11-24 22:46:39 +08:00
" Log " : returnText . toPlainText ( ) ,
" Wine " : wine [ o1 . currentText ( ) ] ,
" Tips " : text
2023-01-04 13:35:31 +08:00
} ) . json ( )
2022-11-25 09:40:24 +08:00
if returnList [ " ExitCode " ] == 0 :
QtWidgets . QMessageBox . information ( window , " 提示 " , " 上传成功! " )
else :
print ( returnList )
QtWidgets . QMessageBox . critical ( window , " 错误 " , " 上传失败! " )
2022-11-24 22:46:39 +08:00
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( window , " 错误 " , " 上传失败! " )
2022-11-25 13:12:42 +08:00
2022-11-24 22:46:39 +08:00
def SaveLog ( ) :
2022-11-25 09:40:24 +08:00
path = QtWidgets . QFileDialog . getSaveFileName ( window , " 保存日志 " , get_home ( ) , " txt文件(*.txt);;html 文件(*.html);;所有文件(*.*)) " )
2022-11-24 22:46:39 +08:00
if not path [ 1 ] :
return
2022-11-25 09:40:24 +08:00
print ( path )
2022-11-24 22:46:39 +08:00
try :
with open ( path [ 0 ] , " w " ) as file :
2022-11-25 09:40:24 +08:00
if path [ 1 ] == " html 文件(*.html) " :
file . write ( returnText . toHtml ( ) )
else :
file . write ( returnText . toPlainText ( ) )
2022-11-24 22:46:39 +08:00
except :
traceback . print_exc ( )
QtWidgets . QMessageBox . critical ( window , " 错误 " , traceback . format_exc ( ) )
2022-12-07 13:18:49 +08:00
def GetNewInformation ( ) :
try :
2024-01-14 10:22:41 +08:00
# 获取是否为最新版本的公告
informationID = requests . get ( " http://update.gfdgdxi.top/wine-runner/info/id.json " ) . json ( ) [ " Number " ]
2024-01-14 17:53:27 +08:00
text = requests . get ( " http://update.gfdgdxi.top/wine-runner/info/ " ) . text . replace ( " Icon/QR/ " , f " { programPath } /Icon/QR/ " )
2024-01-14 10:22:41 +08:00
write_txt ( f " { get_home ( ) } /.config/deepin-wine-runner/information/ { informationID } " , informationID )
2022-12-07 13:18:49 +08:00
except :
traceback . print_exc ( )
2023-03-19 15:49:49 +08:00
text = f """ <p>无法连接到服务器</p>
2022-12-07 13:18:49 +08:00
< hr / >
< p > 你可以尝试 : < / p >
2023-03-19 14:58:20 +08:00
< p > 1. 判断是否能正常连接网络 < / p >
2023-03-19 15:49:49 +08:00
< p > 2. 作者的服务出问题了 ? ( 到这反馈 : < a href = ' https://gitee.com/gfdgd-xi/deep-wine-runner/issues ' > https : / / gitee . com / gfdgd - xi / deep - wine - runner / issues < / a > ) < / p >
< p > 3. 玩个 < a href = " file:// {programPath} /2048/index.html " > 游戏 < / a > 解闷下 < / p > """
2022-12-07 13:18:49 +08:00
global webInformation
if bad :
webInformation = QtWidgets . QTextBrowser ( )
2024-01-14 10:43:43 +08:00
webInformation . anchorClicked . connect ( OpenUrl )
webInformation . setOpenLinks ( False )
webInformation . setOpenExternalLinks ( False )
2022-12-07 13:18:49 +08:00
else :
webInformation = QtWebEngineWidgets . QWebEngineView ( )
webInformation . setHtml ( text )
webInformation . setWindowTitle ( " 获取程序公告 " )
webInformation . setWindowIcon ( QtGui . QIcon ( iconPath ) )
webInformation . resize ( int ( webInformation . frameGeometry ( ) . width ( ) * 1.3 ) , int ( webInformation . frameGeometry ( ) . height ( ) * 1.1 ) )
2024-01-14 17:53:27 +08:00
webInformation . setWindowFlags ( webInformation . windowFlags ( ) | QtCore . Qt . Dialog )
webInformation . setWindowModality ( QtCore . Qt . ApplicationModal )
2022-12-07 13:18:49 +08:00
webInformation . show ( )
2022-09-20 21:53:37 +08:00
def getFileFolderSize ( fileOrFolderPath ) :
""" get size for file or folder """
totalSize = 0
2022-11-25 13:12:42 +08:00
try :
if not os . path . exists ( fileOrFolderPath ) :
2022-09-20 21:53:37 +08:00
return totalSize
2022-11-25 13:12:42 +08:00
if os . path . isfile ( fileOrFolderPath ) :
totalSize = os . path . getsize ( fileOrFolderPath ) # 5041481
return totalSize
2023-07-25 13:14:52 +08:00
if os . path . islink ( fileOrFolderPath ) :
return 0
2022-11-25 13:12:42 +08:00
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
except :
return totalSize
2022-09-20 21:53:37 +08:00
2022-08-24 16:13:47 +08:00
# 获取当前语言
def get_now_lang ( ) - > " 获取当前语言 " :
return os . getenv ( ' LANG ' )
2022-09-19 21:30:36 +08:00
2022-11-16 22:57:19 +08:00
# 又需要修复多线程导致的控件问题
def AddDockerMenu ( ) :
global dockers
global openFileManager
global openTerminal
dockers = menu . addMenu ( " 该 Docker 基础管理 " )
openFileManager = QtWidgets . QAction ( " 打开默认文件管理器 " )
openTerminal = QtWidgets . QAction ( " 打开默认终端 " )
openFileManager . triggered . connect ( lambda : threading . Thread ( target = os . system , args = [ f " xdg-open ' { get_home ( ) } ' " ] ) . start ( ) )
2022-11-18 17:18:24 +08:00
openTerminal . triggered . connect ( lambda : threading . Thread ( target = os . system , args = [ f " x-terminal-emulator " ] ) . start ( ) )
2022-11-16 22:57:19 +08:00
dockers . addAction ( openFileManager )
dockers . addAction ( openTerminal )
2022-12-18 13:04:24 +08:00
newPackage = False
2022-11-18 17:18:24 +08:00
class GetVersionThread ( QtCore . QThread ) :
signal = QtCore . pyqtSignal ( str )
def __init__ ( self ) - > None :
super ( ) . __init__ ( )
def run ( self ) :
global about
global window
2022-12-18 13:04:24 +08:00
global newPackage
2022-11-18 17:18:24 +08:00
global programVersionType
# 目前分为几个版本(在 control 文件区分):
# 星火版本:~spark
# 商店版本:~uos
# 编译版本:无版本号
# Gitee/Github……: 正常版本
# Docker 版本
programVersionTypeLnk = {
2023-03-19 14:58:20 +08:00
" spark " : " 普通版本 " ,
" uos " : " 普通版本 "
2022-11-18 17:18:24 +08:00
}
# 直接判断是不是 Docker 版本
if os . path . exists ( f " { programPath } /docker.txt " ) or os . path . exists ( " /.dockerenv " ) :
2023-03-19 14:58:20 +08:00
programVersionType = " 普通版本 "
2022-11-18 17:18:24 +08:00
self . signal . emit ( " " )
else :
programVersionType = " 从源码运行的版本 "
try :
if not os . path . exists ( " /var/lib/dpkg/status " ) :
print ( " 无 dpkg, 结束 " )
file = open ( " /var/lib/dpkg/status " , " r " )
fileName = file . read ( ) . splitlines ( )
package = False
for i in range ( 0 , len ( fileName ) ) :
if fileName [ i ] == " Package: spark-deepin-wine-runner-docker " :
2023-03-19 14:58:20 +08:00
programVersionType = " 普通版本 "
2022-11-18 17:18:24 +08:00
#AddDockerMenu()
self . signal . emit ( " " )
2022-11-16 22:57:19 +08:00
break
2022-11-18 17:18:24 +08:00
if fileName [ i ] == " Package: spark-deepin-wine-runner-52 " :
2023-03-19 14:58:20 +08:00
programVersionType = " 普通版本 "
2022-12-18 13:04:24 +08:00
newPackage = False
2022-11-18 17:18:24 +08:00
break
if fileName [ i ] == " Package: spark-deepin-wine-runner " :
2022-12-18 13:04:24 +08:00
package = True
newPackage = True
continue
if fileName [ i ] == " Package: wine-runner-linux " :
2022-11-18 17:18:24 +08:00
package = True
continue
if not package :
continue
if fileName [ i ] . replace ( " " , " " ) . replace ( " \n " , " " ) == " " :
# 空行,不再考虑
break
# 搜索版本号
try :
if fileName [ i ] [ : fileName [ i ] . index ( " : " ) ] == " Version " :
version = fileName [ i ] [ fileName [ i ] . index ( " : " ) + 1 : ] . strip ( )
print ( f " 版本号为: { version } " )
if not " - " in version :
2023-03-19 14:58:20 +08:00
programVersionType = " 普通版本 "
2022-11-18 17:18:24 +08:00
break
programVersionType = version [ version . index ( " - " ) + 1 : ]
print ( programVersionType )
if " - " in programVersionType :
# 考虑到如 2.1.0-2-spark 的情况
programVersionType = programVersionType [ programVersionType . index ( " - " ) + 1 : ]
try :
programVersionType = programVersionTypeLnk [ programVersionType ]
except :
2023-03-19 14:58:20 +08:00
programVersionType = " 普通版本 "
2022-11-18 17:18:24 +08:00
break
except :
traceback . print_exc ( )
continue
except :
print ( " 无法读取,当没有处理 " )
print ( programVersionType )
about = about . replace ( " @VersionForType@ " , programVersionType )
# 获取程序体积
about = about . replace ( " @programSize@ " , str ( int ( getFileFolderSize ( programPath ) / 1024 / 1024 ) ) )
def GetVersion ( ) :
global runVersion
runVersion = GetVersionThread ( )
runVersion . signal . connect ( AddDockerMenu )
runVersion . start ( )
2022-09-19 21:30:36 +08:00
2022-12-04 22:28:56 +08:00
def UnPackage ( ) :
2022-12-05 22:21:33 +08:00
QtWidgets . QMessageBox . information ( window , " 提示 " , " 请在下面两个对话框中选择 deb 包所在路径和容器解压到的路径 " )
2022-12-07 13:41:42 +08:00
debPath = QtWidgets . QFileDialog . getOpenFileName ( window , get_home ( ) , " deb 文件(*.deb);;所有文件(*.*) " )
2022-12-04 22:28:56 +08:00
if not debPath [ 1 ] :
return
2022-12-07 13:41:42 +08:00
path = QtWidgets . QFileDialog . getExistingDirectory ( window , get_home ( ) )
2022-12-04 22:28:56 +08:00
print ( path )
2022-12-07 13:41:42 +08:00
if not path :
2022-12-04 22:28:56 +08:00
return
tempDebDir = f " /tmp/wine-runner-unpack-deb- { random . randint ( 0 , 1000 ) } "
2022-12-07 13:41:42 +08:00
if os . system ( f " dpkg -x ' { debPath [ 0 ] } ' ' { tempDebDir } ' " ) :
2022-12-04 22:28:56 +08:00
QtWidgets . QMessageBox . critical ( window , " 错误 " , " 解压失败! " )
return
zippath = FindFile ( tempDebDir , " files.7z " )
if zippath == None :
QtWidgets . QMessageBox . critical ( window , " 错误 " , " 解压失败! " )
return
print ( path )
# 解压文件
2022-12-07 13:41:42 +08:00
os . system ( f " mkdir -p ' { path } ' " )
os . system ( f " 7z x -y ' { zippath } ' -o ' { path } ' " )
os . system ( f " rm -rfv ' { tempDebDir } ' " )
QtWidgets . QMessageBox . information ( window , " 提示 " , " 解压完成! " )
2022-12-04 22:28:56 +08:00
def FindFile ( file , name ) :
for i in os . listdir ( file ) :
path = f " { file } / { i } "
if os . path . isdir ( path ) :
returnPath = FindFile ( path , name )
if returnPath != None :
return returnPath . replace ( " // " , " / " )
if os . path . isfile ( path ) :
if i == name :
return path
return None
2022-12-05 22:21:33 +08:00
def TransLog ( ) :
oldText = returnText . toPlainText ( )
lineNumber = 0
transText = " "
chooseText = " "
for i in oldText . splitlines ( ) :
lineNumber + = 1
chooseText + = f " { i } \n "
if lineNumber > = 50 :
lineNumber = 0
try :
data = { ' doctype ' : ' json ' , ' type ' : ' auto ' , ' i ' : chooseText . replace ( " \n \n " , " \n " ) }
jsonReturn = requests . post ( " http://fanyi.youdao.com/translate " , data = data ) . json ( ) [ " translateResult " ]
for i in jsonReturn :
print ( i )
transText + = f ' { i [ 0 ] [ " tgt " ] } \n '
chooseText = " "
except :
transText + = f " { chooseText } \n "
chooseText = " "
if lineNumber != 0 :
lineNumber = 0
try :
data = { ' doctype ' : ' json ' , ' type ' : ' auto ' , ' i ' : chooseText . replace ( " \n \n " , " \n " ) }
jsonReturn = requests . post ( " http://fanyi.youdao.com/translate " , data = data ) . json ( ) [ " translateResult " ]
for i in jsonReturn :
print ( i [ 0 ] )
transText + = f ' { i [ 0 ] [ " tgt " ] } \n '
chooseText = " "
except :
transText + = f " { chooseText } \n "
chooseText = " "
#return transText
returnText . setText ( transText . replace ( " \n \n " , " \n " ) )
2022-12-08 22:55:40 +08:00
###########################
# 加载配置
###########################
2023-08-13 21:50:29 +08:00
2022-12-08 22:55:40 +08:00
if not os . path . exists ( get_home ( ) + " /.config/ " ) : # 如果没有配置文件夹
os . mkdir ( get_home ( ) + " /.config/ " ) # 创建配置文件夹
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner " ) : # 如果没有配置文件夹
os . mkdir ( get_home ( ) + " /.config/deepin-wine-runner " ) # 创建配置文件夹
2024-01-14 10:22:41 +08:00
if not os . path . exists ( f " { get_home ( ) } /.config/deepin-wine-runner/information " ) : # 如果没有配置文件夹
os . mkdir ( f " { get_home ( ) } /.config/deepin-wine-runner/information " ) # 创建配置文件夹
2022-12-08 22:55:40 +08:00
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/ShellHistory.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/ShellHistory.json " , json . dumps ( { } ) ) # 创建配置文件
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/FindExeHistory.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/FindExeHistory.json " , json . dumps ( { } ) ) # 创建配置文件
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/WineBottonHistory.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/WineBottonHistory.json " , json . dumps ( { } ) ) # 创建配置文件
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/ISOPath.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/ISOPath.json " , json . dumps ( { } ) ) # 写入(创建)一个配置文件
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/ISOPathFound.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/ISOPathFound.json " , json . dumps ( { } ) ) # 写入(创建)一个配置文件
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/FindExe.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/FindExe.json " , json . dumps ( { " path " : " ~ " } ) ) # 写入(创建)一个配置文件
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/FindISO.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/FindISO.json " , json . dumps ( { " path " : " ~ " } ) ) # 写入(创建)一个配置文件
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/WineBotton.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/WineBotton.json " , json . dumps ( { " path " : " ~/.deepinwine " } ) ) # 写入(创建)一个配置文件
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/WineSetting.json " ) : # 如果没有配置文件
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/WineSetting.json " , json . dumps ( defultProgramList ) ) # 写入(创建)一个配置文件
###########################
# 设置变量
###########################
programPath = os . path . split ( os . path . realpath ( __file__ ) ) [ 0 ] # 返回 string
# 如果要添加其他 wine, 请使用安装更多 Wine 功能
#############
# 检测 Wine
#############
2023-06-22 13:19:55 +08:00
def CheckWine ( ) :
global wine
global untipsWine
global canUseWine
try :
2023-12-03 11:12:40 +08:00
wine7zUse = [ " wine " , " wine64 " , " wine-i386 " , " wine-aarch64 " , " wine-x86_64 " ]
2023-06-22 13:19:55 +08:00
wine = {
" 基于 UOS box86 的 deepin-wine6-stable " : f " WINEPREDLL= ' { programPath } /dlls-arm ' WINEDLLPATH=/opt/deepin-wine6-stable/lib BOX86_NOSIGSEGV=1 /opt/deepin-box86/box86 /opt/deepin-wine6-stable/bin/wine " ,
" 基于 UOS exagear 的 deepin-wine6-stable " : f " WINEPREDLL= ' { programPath } /dlls-arm ' WINEDLLPATH=/opt/deepin-wine6-stable/lib /opt/exagear/bin/ubt_x64a64_al --path-prefix { get_home ( ) } /.deepinwine/debian-buster --utmp-paths-list { get_home ( ) } /.deepinwine/debian-buster/.exagear/utmp-list --vpaths-list { get_home ( ) } /.deepinwine/debian-buster/.exagear/vpaths-list --opaths-list { get_home ( ) } /.deepinwine/debian-buster/.exagear/opaths-list --smo-mode fbase --smo-severity smart --fd-limit 8192 --foreign-ubt-binary /opt/exagear/bin/ubt_x32a64_al -- /opt/deepin-wine6-stable/bin/wine " ,
" 使用 Flatpak 安装的 Wine " : " flatpak run org.winehq.Wine " ,
2023-12-21 20:56:13 +08:00
" deepin-wine8-stable " : " deepin-wine8-stable " ,
2023-06-22 13:19:55 +08:00
" deepin-wine6 stable " : " deepin-wine6-stable " ,
2023-09-30 10:52:13 +08:00
" deepin-wine6-vannila " : " deepin-wine6-vannila " ,
2023-06-22 13:19:55 +08:00
" deepin-wine5 stable " : " deepin-wine5-stable " ,
2023-07-26 15:32:09 +08:00
" spark-wine " : " spark-wine " ,
2023-06-22 13:19:55 +08:00
" spark-wine7-devel " : " spark-wine7-devel " ,
" spark-wine8 " : " spark-wine8 " ,
2023-09-18 22:01:35 +08:00
" spark-wine8-wow " : " spark-wine8-wow " ,
2024-01-26 13:14:46 +08:00
" spark-wine9 " : " spark-wine9 " ,
" spark-wine9-wow " : " spark-wine9-wow " ,
2023-06-22 13:19:55 +08:00
" deepin-wine " : " deepin-wine " ,
" deepin-wine5 " : " deepin-wine5 " ,
" wine " : " wine " ,
" wine64 " : " wine64 " ,
" ukylin-wine " : " ukylin-wine " ,
2023-12-21 22:18:34 +08:00
" okylin-wine " : " okylin-wine " ,
2023-06-22 13:19:55 +08:00
" mono( 这不是 wine, 但可以实现初步调用运行 .net 应用) " : " mono " ,
" 基于 linglong 的 deepin-wine6-stable( 不推荐) " : f " ll-cli run ' ' --exec ' /bin/deepin-wine6-stable ' "
}
untipsWine = [ " 使用 Flatpak 安装的 Wine " , " 基于 exagear 的 deepin-wine6-stable " , " 基于 UOS box86 的 deepin-wine6-stable " , " 基于 UOS exagear 的 deepin-wine6-stable " , " 基于 linglong 的 deepin-wine6-stable( 不推荐) " ]
canUseWine = [ ]
if os . path . exists ( " /opt/deepin-box86/box86 " ) and os . path . exists ( " /opt/deepin-wine6-stable/bin/wine " ) :
canUseWine . append ( " 基于 UOS box86 的 deepin-wine6-stable " )
if os . path . exists ( " /opt/exagear/bin/ubt_x64a64_al " ) and os . path . exists ( " /opt/deepin-wine6-stable/bin/wine " ) :
canUseWine . append ( " 基于 UOS exagear 的 deepin-wine6-stable " )
2023-07-11 15:25:29 +08:00
#if not os.system("which exagear") and os.path.exists("/opt/deepin-wine6-stable/bin/wine"):
#canUseWine.append("基于 exagear 的 deepin-wine6-stable")
2023-06-22 13:19:55 +08:00
for i in wine . keys ( ) :
if not os . system ( f " which ' { wine [ i ] } ' " ) :
canUseWine . append ( i )
if not os . system ( " which flatpak " ) and os . path . exists ( " /var/lib/flatpak/app/org.winehq.Wine " ) :
canUseWine . append ( " 使用 Flatpak 安装的 Wine " )
2023-02-25 07:49:22 +08:00
2023-06-22 13:19:55 +08:00
if os . path . exists ( " /persistent/linglong/layers/ " ) : # 判断是否使用 linglong
for i in os . listdir ( " /persistent/linglong/layers/ " ) :
try :
dire = os . listdir ( f " /persistent/linglong/layers/ { i } " ) [ - 1 ]
arch = os . listdir ( f " /persistent/linglong/layers/ { i } / { dire } " ) [ - 1 ]
if os . path . exists ( f " /persistent/linglong/layers/ { i } / { dire } / { arch } /runtime/bin/deepin-wine6-stable " ) :
wine [ " 基于 linglong 的 deepin-wine6-stable( 不推荐) " ] = f " ll-cli run { i } --exec ' /bin/deepin-wine6-stable ' "
canUseWine . append ( " 基于 linglong 的 deepin-wine6-stable( 不推荐) " )
break
except :
pass
# 读取自定义安装的 Wine( 需要解包的才能使用)
global qemuBottleList
global qemuPath
qemuBottleList = [ ]
qemuPath = f " { get_home ( ) } /.deepin-wine-runner-ubuntu-images "
if not os . system ( " which qemu-i386-static " ) :
if os . path . exists ( qemuPath ) :
for g in os . listdir ( qemuPath ) :
archPath = f " { qemuPath } / { g } "
arch = g
if os . path . isdir ( archPath ) :
for d in os . listdir ( archPath ) :
bottlePath = f " { archPath } / { d } "
if os . path . isdir ( bottlePath ) :
qemuBottleList . append ( [
arch ,
d ,
bottlePath
] )
global shellHistory
global findExeHistory
global wineBottonHistory
global isoPath
global isoPathFound
global setting
shellHistory = list ( json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/ShellHistory.json " ) ) . values ( ) )
findExeHistory = list ( json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/FindExeHistory.json " ) ) . values ( ) )
wineBottonHistory = list ( json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/WineBottonHistory.json " ) ) . values ( ) )
isoPath = list ( json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/ISOPath.json " ) ) . values ( ) )
isoPathFound = list ( json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/ISOPathFound.json " ) ) . values ( ) )
setting = json . loads ( readtxt ( get_home ( ) + " /.config/deepin-wine-runner/WineSetting.json " ) )
change = False
if not os . path . exists ( get_home ( ) + " /.config/deepin-wine-runner/mono-lock " ) :
os . mknod ( f " { get_home ( ) } /.config/deepin-wine-runner/mono-lock " )
setting [ " MonoGeckoInstaller " ] = False
change = True
for i in defultProgramList . keys ( ) :
if not i in setting :
change = True
setting [ i ] = defultProgramList [ i ]
if change :
write_txt ( get_home ( ) + " /.config/deepin-wine-runner/WineSetting.json " , json . dumps ( setting ) )
try :
# Read /opt Wine
2023-12-03 11:12:40 +08:00
try :
for i in os . listdir ( f " /opt " ) :
for j in wine7zUse :
if os . path . exists ( f " /opt/ { i } /bin/ { j } " ) :
wine [ f " /opt/ { i } /bin/ { j } " ] = f " /opt/ { i } /bin/ { j } "
canUseWine . append ( f " /opt/ { i } /bin/ { j } " )
except :
traceback . print_exc ( )
2023-06-22 13:19:55 +08:00
# 不再从列表读取,直接读目录
for i in os . listdir ( f " { programPath } /wine/ " ) :
#for i in json.loads(readtxt(f"{programPath}/wine/winelist.json")):
if os . path . exists ( f " { programPath } /wine/ { i } " ) and os . path . isdir ( f " { programPath } /wine/ { i } " ) :
name = " "
qemuInstall = False
nameValue = [ [ " " , " " ] ]
try :
if os . path . exists ( " /opt/deepin-box86/box86 " ) :
nameValue . append (
[
" 基于 UOS box86 的 " ,
f " WINEPREDLL= ' { programPath } /dlls-arm ' WINEDLLPATH=/opt/deepin-wine6-stable/lib BOX86_NOSIGSEGV=1 /opt/deepin-box86/box86 "
]
)
if os . system ( " which box86 " ) == 0 :
nameValue . append (
[
" 基于 box86 的 " ,
f " box86 "
]
)
if os . system ( " which box64 " ) == 0 :
nameValue . append (
[
" 基于 box64 的 " ,
f " box64 "
]
)
2023-07-11 18:52:18 +08:00
if os . system ( " which qemu-i386 " ) == 0 and subprocess . getoutput ( " arch " ) != " x86_64 " and subprocess . getoutput ( " arch " ) != " i386 " and subprocess . getoutput ( " arch " ) != " i686 " :
nameValue . append (
[
" 基于 qemu-i386 的 " ,
f " qemu-i386 "
]
)
if os . system ( " which qemu-x86_64 " ) == 0 and subprocess . getoutput ( " arch " ) != " x86_64 " and subprocess . getoutput ( " arch " ) != " i386 " and subprocess . getoutput ( " arch " ) != " i686 " :
nameValue . append (
[
" 基于 qemu-x86_64 的 " ,
f " qemu-x86_64 "
]
)
2023-07-07 12:31:43 +08:00
if os . path . exists ( " /opt/exagear/bin/ubt_x64a64_al " ) and os . path . exists ( f " { get_home ( ) } /.deepinwine/debian-buster " ) :
2023-06-22 13:19:55 +08:00
nameValue . append (
[
2023-07-07 12:31:43 +08:00
" 基于 UOS exagear 的 " ,
f " WINEPREDLL= ' { programPath } /dlls-arm ' WINEDLLPATH=/opt/deepin-wine6-stable/lib /opt/exagear/bin/ubt_x64a64_al --path-prefix { get_home ( ) } /.deepinwine/debian-buster --utmp-paths-list { get_home ( ) } /.deepinwine/debian-buster/.exagear/utmp-list --vpaths-list { get_home ( ) } /.deepinwine/debian-buster/.exagear/vpaths-list --opaths-list { get_home ( ) } /.deepinwine/debian-buster/.exagear/opaths-list --smo-mode fbase --smo-severity smart --fd-limit 8192 --foreign-ubt-binary /opt/exagear/bin/ubt_x32a64_al -- "
2023-06-22 13:19:55 +08:00
]
)
2023-07-12 12:11:38 +08:00
if os . system ( " which exagear " ) == 0 :
nameValue . append (
[
" 运行 exagear 容器内的 " ,
f " exagear -- "
]
)
2023-06-22 13:19:55 +08:00
if os . path . exists ( " /opt/exagear/bin/ubt_x64a64_al " ) :
nameValue . append (
[
2023-07-11 18:10:51 +08:00
" 使用 ubt_x64a64_al 运行 " ,
2023-07-07 12:31:43 +08:00
" /opt/exagear/bin/ubt_x64a64_al -- "
]
)
2023-07-12 12:11:38 +08:00
2023-07-07 12:31:43 +08:00
if os . path . exists ( " /opt/exagear/bin/ubt_x32a64_al " ) :
nameValue . append (
[
2023-07-11 18:10:51 +08:00
" 使用 ubt_x32a64_al 运行 " ,
2023-07-07 12:31:43 +08:00
" /opt/exagear/bin/ubt_x32a64_al -- "
2023-06-22 13:19:55 +08:00
]
)
for g in qemuBottleList :
nameValue . append ( [
f " 使用qemu- { g [ 0 ] } -static 调用容器 { g [ 1 ] } 运行 " ,
f " python3 ' { programPath } /QemuRun.py ' ' { g [ 0 ] } / { g [ 1 ] } ' { int ( setting [ ' QemuUnMountHome ' ] ) } "
2022-12-08 22:55:40 +08:00
] )
2023-06-22 13:19:55 +08:00
except :
traceback . print_exc ( )
for k in nameValue :
print ( k )
if " qemu " in k [ 0 ] :
chrootProgramPath = " /opt/apps/deepin-wine-runner "
else :
chrootProgramPath = programPath
2023-12-03 11:12:40 +08:00
for j in wine7zUse :
if os . path . exists ( f " { programPath } /wine/ { i } /bin/ { j } " ) :
wine [ f " { k [ 0 ] } { chrootProgramPath } /wine/ { i } /bin/ { j } " ] = f " { k [ 1 ] } { chrootProgramPath } /wine/ { i } /bin/ { j } "
canUseWine . append ( f " { k [ 0 ] } { chrootProgramPath } /wine/ { i } /bin/ { j } " )
untipsWine . append ( f " { k [ 0 ] } { chrootProgramPath } /wine/ { i } /bin/ { j } " )
2023-07-11 15:25:29 +08:00
2023-06-22 13:19:55 +08:00
except :
2023-07-11 15:25:29 +08:00
traceback . print_exc ( )
2023-06-22 13:19:55 +08:00
try :
2024-07-20 22:24:39 +08:00
if os . path . exists ( f " { get_home ( ) } /.deepinwine/ " ) :
for i in os . listdir ( f " { get_home ( ) } /.deepinwine/ " ) :
for j in wine7zUse :
if os . path . exists ( f " { get_home ( ) } /.deepinwine/ { i } /bin/ { j } " ) :
wine [ f " { get_home ( ) } /.deepinwine/ { i } /bin/ { j } " ] = f " { get_home ( ) } /.deepinwine/ { i } /bin/ { j } "
canUseWine . append ( f " { get_home ( ) } /.deepinwine/ { i } /bin/ { j } " )
2023-12-03 11:12:40 +08:00
2023-06-22 13:19:55 +08:00
except :
2023-07-11 15:25:29 +08:00
traceback . print_exc ( )
2023-07-11 18:10:51 +08:00
try :
canUseWineOld = canUseWine [ : ]
for i in canUseWineOld :
2023-07-11 20:58:17 +08:00
if os . path . exists ( f " { programPath } /WineLib/usr " ) :
2023-07-11 18:10:51 +08:00
wine [ f " 使用运行器的运行库运行 { i } " ] = f " bash ' { programPath } /WineLib/run.sh ' { wine [ i ] } "
canUseWine . append ( f " 使用运行器的运行库运行 { i } " )
untipsWine . append ( f " 使用运行器的运行库运行 { i } " )
if os . path . exists ( " /opt/exagear/images " ) :
for k in os . listdir ( " /opt/exagear/images " ) :
if not os . path . isdir ( f " /opt/exagear/images/ { k } " ) :
continue
2023-07-11 18:16:12 +08:00
for i in canUseWineOld :
wine [ f " 使用Exagear容器运行库运行 { i } " ] = f " bash ' { programPath } /WineLib/run-more.sh ' ' /opt/exagear/images/ { k } ' { wine [ i ] } "
canUseWine . append ( f " 使用Exagear容器运行库运行 { i } " )
untipsWine . append ( f " 使用Exagear容器运行库运行 { i } " )
2023-07-11 18:52:18 +08:00
#if os.path.exists(f"{get_home()}/.deepinwine/debian-buster"):
#for i in canUseWineOld:
#wine[f"使用UOS Exagear容器运行库运行 {i}"] = f"bash '{programPath}/WineLib/run-more.sh' '{get_home()}/.deepinwine/debian-buster' {wine[i]}"
#canUseWine.append(f"使用UOS Exagear容器运行库运行 {i}")
#untipsWine.append(f"使用UOS Exagear容器运行库运行 {i}")
2023-07-11 18:10:51 +08:00
except :
traceback . print_exc ( )
2022-12-08 22:55:40 +08:00
except :
2023-06-22 13:19:55 +08:00
traceback . print_exc ( )
app = QtWidgets . QApplication ( sys . argv )
QtWidgets . QMessageBox . critical ( None , " 错误 " , f " 无法读取配置,无法继续 \n { traceback . format_exc ( ) } " )
sys . exit ( 1 )
CheckWine ( )
2022-12-08 22:55:40 +08:00
2022-12-05 22:21:33 +08:00
# transla.transe
2022-09-21 20:54:04 +08:00
programVersionType = " "
2022-09-13 21:27:17 +08:00
print ( wine )
2022-07-18 11:21:22 +08:00
###########################
# 程序信息
###########################
2023-11-26 09:11:26 +08:00
app = QtWidgets . QApplication ( sys . argv )
2023-11-26 14:34:08 +08:00
trans = QtCore . QTranslator ( )
2023-11-26 09:11:26 +08:00
transeObject = QtCore . QObject ( )
2023-11-26 14:34:08 +08:00
transla = QtCore . QCoreApplication . translate
2023-11-26 09:11:26 +08:00
#transeObject.tr("")
2022-12-06 09:38:01 +08:00
# 语言载入
2024-04-27 14:22:26 +08:00
if not " zh_CN " . lower ( ) in get_now_lang ( ) . lower ( ) :
2023-12-23 16:32:08 +08:00
trans . load ( f " { programPath } /LANG/deepin-wine-runner-en_US.qm " )
2022-12-06 09:38:01 +08:00
else :
2023-11-26 09:11:26 +08:00
pass
2023-11-26 14:34:08 +08:00
app . installTranslator ( trans )
2022-12-03 22:14:23 +08:00
iconPath = " {} /deepin-wine-runner.svg " . format ( programPath )
2023-12-11 12:11:23 +08:00
iconPathList = [
" {} /deepin-wine-runner.svg " . format ( programPath ) ,
]
2023-12-11 20:27:52 +08:00
2022-12-03 22:14:23 +08:00
#iconPath = "{}/Icon/Program/wine运行器.png".format(programPath)
2023-04-30 13:08:25 +08:00
programUrl = " https://gitee.com/gfdgd-xi/deep-wine-runner \n https://github.com/gfdgd-xi/deep-wine-runner \n https://gfdgd-xi.github.io "
2022-07-18 11:21:22 +08:00
information = json . loads ( readtxt ( f " { programPath } /information.json " ) )
version = information [ " Version " ]
2023-11-26 14:34:08 +08:00
goodRunSystem = QtCore . QCoreApplication . translate ( " U " , " 常见 Linux 发行版 " )
2022-07-18 11:21:22 +08:00
thankText = " "
2023-12-23 12:24:20 +08:00
lastRunCommand = " 暂未运行命令 "
2023-11-26 14:34:08 +08:00
tips = QtCore . QCoreApplication . translate ( " U " , ''' <h4>提示:</h4>
2022-11-23 21:35:01 +08:00
1 、 使用终端运行该程序 , 可以看到 wine 以及程序本身的提示和报错 ;
2 、 wine 32 位和 64 位的容器互不兼容 ;
3 、 所有的 wine 和 winetricks 均需要自行安装 ( 可以从 菜单栏 = > 程序 里面进行安装 ) ;
2022-07-18 11:21:22 +08:00
4 、 本程序支持带参数运行 wine 程序 ( 之前版本也可以 ) , 只需要按以下格式即可 :
exe路径 \' 参数 \'
2022-11-23 21:35:01 +08:00
即可 ( 单引号需要输入 ) ;
5 、 wine 容器如果没有指定 , 则会默认为 ~ / . wine ;
6 、 如果可执行文件比较大的话 , 会出现点击 “ 获取该程序运行情况 ” 出现假死的情况 , 因为正在后台读取 SHA1 , 只需要等一下即可 ( 读取速度依照您电脑处理速度 、 读写速度 、 可执行文件大小等有关 ) ;
2023-08-08 14:32:26 +08:00
7 、 如果非 X86 的用户的 UOS 专业版用户想要使用的话 , 只需要在应用商店安装一个 Wine 版本微信即可在本程序选择正确的 Wine 运行程序 ; ''' )
2024-07-17 21:37:48 +08:00
updateThingsString = QtCore . QCoreApplication . translate ( " U " , ''' ※1、优化运行器窗口大小机制
※ 2 、 Wine 安装器支持根据机器实际情况自动推荐适合的 Wine
※ 3 、 Wine 安装器支持手动导入 Wine 7 z 包并提供相应 7 z 包的网盘下载地址
※ 4 、 兼容 Deepin 终端 ( deepin 15 经典版本 , deepin - terminal - gtk )
※ 5 、 跟进 dxvk 2.4
※ 6 、 修复 deepin 23 无法使用 Mono / Gecko 安装器的问题
※ 7 、 修复 debian testing 打包时会把 / 打入 .7 z 包内导致系统死机的问题
8 、 修复虚拟机启动器入口不会调用安装的 Qemu Extra 的问题
9 、 优化高级打包器容器名称生成机制
''' )
2022-07-18 11:21:22 +08:00
for i in information [ " Thank " ] :
thankText + = f " { i } \n "
2024-06-29 10:51:16 +08:00
updateTime = " 2024年06月29日 "
2023-11-26 14:34:08 +08:00
aboutProgram = QtCore . QCoreApplication . translate ( " U " , """ <p>Wine运行器是一个能让Linux用户更加方便地运行Windows应用的程序。原版的 Wine 只能使用命令操作, 且安装过程较为繁琐, 对小白不友好。于是该运行器为了解决该痛点, 内置了对Wine图形化的支持、Wine 安装器、微型应用商店、各种Wine工具、自制的Wine程序打包器、运行库安装工具等。</p>
2023-09-02 10:16:48 +08:00
< p > 它同时还内置了基于Qemu / VirtualBox制作的 、 专供小白使用的Windows虚拟机安装工具 , 可以做到只需下载系统镜像并点击安装即可 , 无需考虑虚拟机的安装 、 创建 、 分区等操作 , 也能在非 X86 架构安装 X86 架构的 Windows 操作系统 ( 但是效率较低 , 可以运行些老系统 ) 。 < / p >
< p > 而且对于部分 Wine 应用适配者来说 , 提供了图形化的打包工具 , 以及提供了一些常用工具以及运行库的安装方式 , 以及能安装多种不同的 Wine 以测试效果 , 能极大提升适配效率 。 < / p >
< p > 且对于 Deepin23 用户做了特别优化 , 以便能在缺少 i386 运行库的情况下运行 Wine32 。 同时也为非 X86 架构用户提供了 Box86 / 64 、 Qemu User 的安装方式 < / p >
< pre > """ )
2022-11-13 10:58:36 +08:00
about = f ''' <style>
a : link , a : active { {
text - decoration : none ;
} }
< / style >
< h1 > 关于 < / h1 >
2022-12-06 09:38:01 +08:00
{ aboutProgram }
2022-07-18 11:21:22 +08:00
版本 : { version }
2022-09-19 21:30:36 +08:00
适用平台 : { goodRunSystem } ( @VersionForType @ )
2023-04-09 18:49:39 +08:00
安装包构建时间 : { information [ ' Time ' ] }
2022-07-18 11:21:22 +08:00
Qt 版本 : { QtCore . qVersion ( ) }
2022-09-20 21:53:37 +08:00
程序官网 : { programUrl }
2023-09-02 10:16:48 +08:00
< b > Wine 运行器 QQ 交流群 : 762985460 < / b >
2023-12-23 22:51:41 +08:00
< b > Wine运行器 QQ 频道 : https : / / pd . qq . com / s / edqkgeydx < / b >
2022-12-03 22:14:23 +08:00
当前程序占用体积 : @programSize @MB < / pre >
< p > 本程序依照 GPLV3 协议开源 < / p >
2022-07-18 11:21:22 +08:00
< hr >
2022-12-03 22:14:23 +08:00
< h1 > 鸣谢名单 < / h1 >
2022-07-18 11:21:22 +08:00
< pre > { thankText } < / pre >
< hr >
< h1 > 更新内容 < / h1 >
< pre > { updateThingsString }
< b > 更新时间 : { updateTime } < / b > < / pre >
< hr >
2022-07-18 15:22:00 +08:00
< h1 > 提示 < / h1 >
< pre > { tips }
< / pre >
< hr >
2022-10-22 20:05:49 +08:00
< h1 > 友谊链接 < / h1 >
2023-02-25 09:52:53 +08:00
< pre > 星火应用商店 : < a href = " https://spark-app.store/ " > https : / / spark - app . store / < / a >
Deepin 官网 : < a href = " https://www.deepin.org " > https : / / www . deepin . org < / a >
Deepin 论坛 : < a href = " https://bbs.deepin.org " > https : / / bbs . deepin . org < / a >
2023-03-19 16:20:15 +08:00
gfdgd xi : < a href = " https://gfdgd-xi.github.io " > https : / / gfdgd - xi . github . io < / a >
2022-10-22 20:05:49 +08:00
< hr >
2023-04-24 21:21:28 +08:00
< h1 > © 2020 ~ { time . strftime ( " % Y " ) } By gfdgd xi < / h1 > '''
2024-04-27 14:24:42 +08:00
defaultCommandText = " <pre> " + QtCore . QCoreApplication . translate ( " MainWindow " , " 在此可以看到wine安装应用时的终端输出内容 " ) + """
2024-01-14 10:22:41 +08:00
== == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
如果解决了你的问题 , 请不要吝啬你的star哟 !
2024-01-21 08:41:28 +08:00
也可以 < a href = ' http://update.gfdgdxi.top/Appreciate ' > 请作者喝一杯茶 < / a >
程序地址 :
2024-01-14 10:22:41 +08:00
< a href = ' https://gitee.com/gfdgd-xi/deep-wine-runner ' > https : / / gitee . com / gfdgd - xi / deep - wine - runner < / a >
< a href = ' https://github.com/gfdgd-xi/deep-wine-runner ' > https : / / github . com / gfdgd - xi / deep - wine - runner < / a >
< a href = ' https://sourceforge.net/projects/deep-wine-runner ' > https : / / sourceforge . net / projects / deep - wine - runner < / a > """
# 创建线程用于获取是否有更新
class GetUpdateToShow ( QtCore . QThread ) :
signal = QtCore . pyqtSignal ( str )
def __init__ ( self ) :
super ( ) . __init__ ( )
def run ( self ) :
global defaultCommandText
# 获取更新
url = " http://update.gfdgdxi.top/update.json "
try :
data = json . loads ( requests . get ( url ) . text )
if data [ " Version " ] != version :
# 版本号读取(防止出现高版本号提示要“升级”到低版本号的问题)
localVersionList = version . split ( " . " )
webVersionList = data [ ' Version ' ] . split ( " . " )
for i in range ( len ( localVersionList ) ) :
local = int ( localVersionList [ i ] )
web = int ( webVersionList [ i ] )
if web < local :
break
if web > local :
defaultCommandText + = f """ \n =============================================================
Wine运行器 { data [ ' Version ' ] } 发布了 ! < a href = ' http://update.gfdgdxi.top/update-wine-runner ' > 点此立即更新 < / a > """
except :
traceback . print_exc ( )
# 获取应用公告
try :
informationID = requests . get ( " http://update.gfdgdxi.top/wine-runner/info/id.json " ) . json ( ) [ " Number " ]
if not os . path . exists ( f " { get_home ( ) } /.config/deepin-wine-runner/information/ { informationID } " ) :
defaultCommandText + = f """ \n =============================================================
程序有新的公告 , < a href = ' http://update.gfdgdxi.top/information-wine-runner ' > 点此立即查看 < / a > """
except :
traceback . print_exc ( )
if lastRunCommand == " 暂未运行命令 " :
self . signal . emit ( defaultCommandText + " </pre> " )
2023-12-29 19:48:31 +08:00
offLineInformation = " "
2023-12-03 10:33:04 +08:00
if os . path . exists ( f " { programPath } /off-line.lock " ) :
title = " Wine 运行器 {} (离线模式) " . format ( version )
2023-12-29 19:48:31 +08:00
try :
offLineInformation = readtxt ( f " { programPath } /off-line.lock " )
except :
traceback . print_exc ( )
2023-12-03 10:33:04 +08:00
else :
title = " Wine 运行器 {} " . format ( version )
2023-04-24 21:21:28 +08:00
#<h1>©2020~{time.strftime("%Y")} <a href="https://gitee.com/gfdgd-xi">By gfdgd xi</h1>'''
2022-07-18 11:21:22 +08:00
updateThings = " {} 更新内容: \n {} \n 更新时间: {} " . format ( version , updateThingsString , updateTime , time . strftime ( " % Y " ) )
2022-07-29 15:35:07 +08:00
try :
2022-09-24 21:02:50 +08:00
threading . Thread ( target = requests . get , args = [ parse . unquote ( base64 . b64decode ( " aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9vcGVuL0luc3RhbGwucGhw " ) . decode ( " utf-8 " ) ) + " ?Version= " + version ] ) . start ( )
2022-07-29 15:35:07 +08:00
except :
pass
2022-11-28 10:40:59 +08:00
iconListUnBuild = json . loads ( readtxt ( f " { programPath } /IconList.json " ) ) [ 0 ]
iconList = json . loads ( readtxt ( f " { programPath } /IconList.json " ) ) [ 1 ]
2022-09-10 22:07:58 +08:00
for i in iconListUnBuild :
iconList . append ( i )
print ( iconList )
2022-12-09 22:45:51 +08:00
# Qemu Lock
try :
if os . path . exists ( " /tmp/deepin-wine-runner-lock.txt " ) :
print ( " lock " )
with open ( f " /tmp/deepin-wine-runner-lock.txt " , " r " ) as file :
setting [ " QemuUnMountHome " ] = bool ( int ( file . read ( ) ) )
else :
print ( " unlock " )
with open ( f " /tmp/deepin-wine-runner-lock.txt " , " w " ) as file :
# = bool(int(file.read()))
file . write ( str ( int ( setting [ " QemuUnMountHome " ] ) ) )
except :
traceback . print_exc ( )
2022-07-18 11:21:22 +08:00
###########################
# 窗口创建
###########################
# 读取主题
# Qt 窗口
window = QtWidgets . QMainWindow ( )
2023-08-13 21:50:29 +08:00
defaultFont = app . font ( )
2022-09-24 19:54:08 +08:00
window . setWindowTitle ( title )
2022-07-18 11:21:22 +08:00
widget = QtWidgets . QWidget ( )
window . setCentralWidget ( widget )
mainLayout = QtWidgets . QGridLayout ( )
# 权重
size = QtWidgets . QSizePolicy ( )
size . setHorizontalPolicy ( 0 )
widgetSize = QtWidgets . QSizePolicy ( )
#size.setHorizontalPolicy(0)
widgetSize . setVerticalPolicy ( 0 )
#
leftUp = QtWidgets . QWidget ( )
mainLayout . addWidget ( leftUp , 0 , 0 , 1 , 1 )
leftUpLayout = QtWidgets . QGridLayout ( )
leftUp . setLayout ( leftUpLayout )
2023-11-26 14:34:08 +08:00
fastLabel = QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 快速启动 " ) )
2022-07-18 11:21:22 +08:00
fastLabel . setStyleSheet ( " font: 30px; " )
leftUpLayout . addWidget ( fastLabel , 0 , 0 , 1 , 2 )
leftUpLayout . addWidget ( QtWidgets . QLabel ( " <hr> " ) , 1 , 0 , 1 , 2 )
2023-11-26 14:34:08 +08:00
leftUpLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 请选择容器路径: " ) ) , 2 , 0 , 1 , 1 )
2022-07-18 11:21:22 +08:00
e1 = QtWidgets . QComboBox ( )
e1 . setEditable ( True )
leftUpLayout . addWidget ( e1 , 3 , 0 , 1 , 1 )
button1 = QtWidgets . QPushButton ( " 浏览 " )
button1 . clicked . connect ( liulanbutton )
leftUpLayout . addWidget ( button1 , 3 , 1 , 1 , 1 )
2023-11-26 14:34:08 +08:00
leftUpLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 请选择要执行的程序( EXE、MSI或者命令) : " ) ) , 4 , 0 , 1 , 1 )
2022-07-18 11:21:22 +08:00
e2 = QtWidgets . QComboBox ( )
2022-09-28 21:00:53 +08:00
if setting [ " AutoPath " ] :
e2 . editTextChanged . connect ( ChangePath )
2022-07-18 11:21:22 +08:00
e2 . setEditable ( True )
leftUpLayout . addWidget ( e2 , 5 , 0 , 1 , 1 )
2023-11-26 14:34:08 +08:00
button2 = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 浏览 " ) )
2022-07-18 11:21:22 +08:00
button2 . clicked . connect ( liulanexebutton )
leftUpLayout . addWidget ( button2 , 5 , 1 , 1 , 1 )
2023-11-26 14:34:08 +08:00
leftUpLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 请选择WINE版本: " ) ) , 6 , 0 , 1 , 1 )
2022-07-18 11:21:22 +08:00
o1 = QtWidgets . QComboBox ( )
leftUpLayout . addWidget ( o1 , 7 , 0 , 1 , 1 )
# 设置空间权重
button1 . setSizePolicy ( size )
button2 . setSizePolicy ( size )
leftDown = QtWidgets . QWidget ( )
mainLayout . addWidget ( leftDown , 1 , 0 , 1 , 1 )
leftDownLayout = QtWidgets . QVBoxLayout ( )
leftDown . setLayout ( leftDownLayout )
2023-11-26 14:34:08 +08:00
highLabel = QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 高级功能 " ) )
2022-07-18 11:21:22 +08:00
highLabel . setStyleSheet ( " font: 30px; " )
leftDownLayout . addWidget ( highLabel )
leftDownLayout . addWidget ( QtWidgets . QLabel ( " <hr> " ) )
2023-11-26 14:34:08 +08:00
leftDownLayout . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 创建快捷方式( Desktop文件) : " ) ) )
2022-07-18 11:21:22 +08:00
createDesktopLink = QtWidgets . QHBoxLayout ( )
2023-11-26 14:34:08 +08:00
label_r_2 = QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 名称: " ) )
2022-07-18 11:21:22 +08:00
createDesktopLink . addWidget ( label_r_2 )
combobox1 = QtWidgets . QComboBox ( )
combobox1 . setEditable ( True )
createDesktopLink . addWidget ( combobox1 )
2023-11-26 14:34:08 +08:00
button5 = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 创建到桌面 " ) )
2022-07-18 11:21:22 +08:00
button5 . clicked . connect ( make_desktop_on_desktop )
createDesktopLink . addWidget ( button5 )
2024-06-29 11:45:02 +08:00
saveDesktopFileOnLauncher = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 创建到启动器 " ) )
2022-07-18 11:21:22 +08:00
saveDesktopFileOnLauncher . clicked . connect ( make_desktop_on_launcher )
createDesktopLink . addWidget ( saveDesktopFileOnLauncher )
leftDownLayout . addLayout ( createDesktopLink )
programManager = QtWidgets . QGridLayout ( )
leftDownLayout . addLayout ( programManager )
2023-11-26 14:34:08 +08:00
programManager . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " 程序管理: " ) ) , 0 , 0 , 1 , 1 )
getProgramIcon = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 提取图标 " ) )
2022-09-12 19:17:52 +08:00
getProgramIcon . clicked . connect ( lambda : RunWineProgram ( f " { programPath } /BeCyIconGrabber.exe ' ' { e2 . currentText ( ) } " if e2 . currentText ( ) [ : 2 ] . upper ( ) == " C: " else f " { programPath } /BeCyIconGrabber.exe ' ' z:/ { e2 . currentText ( ) } " ) )
2022-07-18 11:21:22 +08:00
programManager . addWidget ( getProgramIcon , 1 , 0 , 1 , 1 )
programManager . addWidget ( QtWidgets . QLabel ( " " * 5 ) , 1 , 1 , 1 , 1 )
2023-11-26 14:34:08 +08:00
trasButton = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 窗口透明工具 " ) )
2022-07-18 11:21:22 +08:00
trasButton . clicked . connect ( lambda : RunWineProgram ( f " { programPath } /窗体透明度设置工具.exe " ) )
programManager . addWidget ( trasButton , 1 , 2 , 1 , 1 )
2023-11-26 14:34:08 +08:00
uninstallProgram = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 卸载程序 " ) )
2022-07-18 11:21:22 +08:00
uninstallProgram . clicked . connect ( lambda : RunWineProgram ( f " { programPath } /geek.exe " ) )
programManager . addWidget ( QtWidgets . QLabel ( " " * 5 ) , 1 , 3 , 1 , 1 )
programManager . addWidget ( uninstallProgram , 1 , 4 , 1 , 1 )
2024-06-29 11:45:02 +08:00
getLoseDll = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 简易dll检测工具 " ) )
2022-11-18 22:02:56 +08:00
getLoseDll . clicked . connect ( GetLoseDll )
2024-06-29 10:51:16 +08:00
programManager . addWidget ( QtWidgets . QLabel ( " " * 5 ) , 1 , 5 , 1 , 1 )
programManager . addWidget ( getLoseDll , 1 , 6 , 1 , 1 )
programManager . addWidget ( QtWidgets . QLabel ( " " * 5 ) , 1 , 7 , 1 , 1 )
2024-06-29 11:45:02 +08:00
wineBottleReboot = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 重启指定Wine容器 " ) )
wineBottleReboot . clicked . connect ( lambda : RunWineProgram ( f " wineboot ' ' -k " ) )
programManager . addWidget ( wineBottleReboot , 1 , 8 , 1 , 1 )
2022-11-18 22:02:56 +08:00
programManager . addWidget ( QtWidgets . QLabel ( " " * 5 ) , 1 , 9 , 1 , 1 )
2022-12-08 22:37:49 +08:00
programManager . addItem ( QtWidgets . QSpacerItem ( 20 , 20 , QtWidgets . QSizePolicy . Expanding , QtWidgets . QSizePolicy . Minimum ) , 1 , 11 , 1 , 1 )
2023-11-26 14:34:08 +08:00
programManager . addWidget ( QtWidgets . QLabel ( QtCore . QCoreApplication . translate ( " U " , " WINE配置: " ) ) , 2 , 0 , 1 , 1 )
wineConfig = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 配置容器 " ) )
2022-07-18 11:21:22 +08:00
wineConfig . clicked . connect ( lambda : RunWineProgram ( " winecfg " ) )
programManager . addWidget ( wineConfig , 3 , 0 , 1 , 1 )
2023-11-26 14:34:08 +08:00
fontAppStore = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 字体商店 " ) )
2022-08-08 15:49:59 +08:00
fontAppStore . clicked . connect ( FontAppStore )
programManager . addWidget ( fontAppStore , 3 , 2 , 1 , 1 )
2023-11-26 14:34:08 +08:00
button_r_6 = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " RegShot " ) )
2022-09-24 21:02:50 +08:00
button_r_6 . clicked . connect ( lambda : RunWineProgram ( f " { programPath } /RegShot/regshot.exe " ) )
2022-08-08 15:49:59 +08:00
programManager . addWidget ( button_r_6 , 3 , 4 , 1 , 1 )
2023-11-26 14:34:08 +08:00
sparkWineSetting = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 星火wine配置 " ) )
2024-06-01 15:39:25 +08:00
sparkWineSetting . clicked . connect ( lambda : threading . Thread ( target = os . system , args = [ " bash /opt/apps/store.spark-app.spark-dwine-helper/files/deepinwine/tools/spark-dwine-helper/wine-app-launcher/wine-app-launcher.sh " ] ) . start ( ) )
2022-08-08 15:49:59 +08:00
programManager . addWidget ( sparkWineSetting , 3 , 6 , 1 , 1 )
2024-06-29 11:45:02 +08:00
wineAutoConfig = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " Wine容器自动配置工具 " ) )
2022-08-26 14:00:05 +08:00
wineAutoConfig . clicked . connect ( WineBottonAutoConfig )
programManager . addWidget ( wineAutoConfig , 3 , 8 , 1 , 1 )
2024-06-29 11:45:02 +08:00
2022-07-18 11:21:22 +08:00
# 权重
button5 . setSizePolicy ( size )
saveDesktopFileOnLauncher . setSizePolicy ( size )
label_r_2 . setSizePolicy ( size )
getProgramIcon . setSizePolicy ( size )
2022-08-08 15:49:59 +08:00
#trasButton.setSizePolicy(size)
button_r_6 . setSizePolicy ( size )
2022-07-18 11:21:22 +08:00
wineConfig . setSizePolicy ( size )
returnText = QtWidgets . QTextBrowser ( )
2024-01-14 10:22:41 +08:00
getUpdate = GetUpdateToShow ( )
getUpdate . signal . connect ( returnText . setHtml )
getUpdate . start ( )
2024-07-15 12:52:51 +08:00
unUseLnk = False
2024-01-14 10:22:41 +08:00
def ReturnTextOpenUrl ( url ) :
print ( url )
2024-07-15 12:52:51 +08:00
if unUseLnk :
return
2024-01-14 10:22:41 +08:00
if url . url ( ) == " http://update.gfdgdxi.top/update-wine-runner " :
UpdateWindow . ShowWindow ( )
elif url . url ( ) == " http://update.gfdgdxi.top/information-wine-runner " :
GetNewInformation ( )
2024-01-21 08:41:28 +08:00
elif url . url ( ) == " http://update.gfdgdxi.top/Appreciate " :
Appreciate ( )
2024-01-14 10:22:41 +08:00
else :
webbrowser . open_new_tab ( url . url ( ) )
returnText . anchorClicked . connect ( ReturnTextOpenUrl )
returnText . setOpenExternalLinks ( False )
returnText . setOpenLinks ( False )
2022-07-18 11:21:22 +08:00
returnText . setStyleSheet ( """
background - color : black ;
color : white ;
""" )
2024-01-14 10:22:41 +08:00
returnText . setHtml ( QtCore . QCoreApplication . translate ( " U " , defaultCommandText ) + " </pre> " )
2022-07-18 11:21:22 +08:00
mainLayout . setRowStretch ( 0 , 2 )
mainLayout . setRowStretch ( 1 , 1 )
mainLayout . setColumnStretch ( 0 , 2 )
mainLayout . setColumnStretch ( 1 , 1 )
mainLayout . addWidget ( returnText , 0 , 1 , 2 , 1 )
# 版权
2023-12-29 19:48:31 +08:00
if offLineInformation . replace ( " \n " , " " ) . replace ( " " , " " ) == " " :
copy = QtWidgets . QLabel ( f """ 程序版本: { version } , <b>提示: Wine 无法保证可以运行所有的 Windows 程序,如果想要运行更多 Windows 程序,可以考虑虚拟机和双系统</b><br/>
< b > 注 : 部分二进制兼容层会自动注册 binfmt ( 如原版的 Box86 / 64 、 Qemu User Static ) , 则意味着无需在 Wine 版本那里特别指定兼容层 , 直接指定 Wine 即可 < / b > < br / >
© 2020 ~ { time . strftime ( " % Y " ) } gfdgd xi """ )
else :
copy = QtWidgets . QLabel ( f """ 程序版本: { version } , <b>提示: Wine 无法保证可以运行所有的 Windows 程序,如果想要运行更多 Windows 程序,可以考虑虚拟机和双系统</b><br/>
2023-07-11 18:52:18 +08:00
< b > 注 : 部分二进制兼容层会自动注册 binfmt ( 如原版的 Box86 / 64 、 Qemu User Static ) , 则意味着无需在 Wine 版本那里特别指定兼容层 , 直接指定 Wine 即可 < / b > < br / >
2023-12-29 19:48:31 +08:00
{ offLineInformation } < br / >
2023-04-24 21:21:28 +08:00
© 2020 ~ { time . strftime ( " % Y " ) } gfdgd xi """ )
2024-06-29 11:45:02 +08:00
copy . setWordWrap ( True )
2022-07-18 11:21:22 +08:00
mainLayout . addWidget ( copy , 2 , 0 , 1 , 1 )
# 程序运行
programRun = QtWidgets . QWidget ( )
programRunLayout = QtWidgets . QHBoxLayout ( )
programRun . setLayout ( programRunLayout )
programRunLayout . addItem ( QtWidgets . QSpacerItem ( 20 , 20 , QtWidgets . QSizePolicy . Expanding , QtWidgets . QSizePolicy . Minimum ) )
2023-11-26 14:34:08 +08:00
button3 = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 运行程序 " ) )
2022-07-18 11:21:22 +08:00
button3 . clicked . connect ( runexebutton )
programRunLayout . addWidget ( button3 )
2023-11-26 14:34:08 +08:00
killProgram = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 终止程序 " ) )
2022-07-18 11:21:22 +08:00
killProgram . clicked . connect ( KillProgram )
programRunLayout . addWidget ( killProgram )
2023-11-26 14:34:08 +08:00
killBottonProgram = QtWidgets . QPushButton ( QtCore . QCoreApplication . translate ( " U " , " 终止指定容器的程序 " ) )
2022-11-06 12:49:34 +08:00
killBottonProgram . clicked . connect ( lambda : threading . Thread ( target = os . system , args = [ f " ' { programPath } /kill.sh ' ' { os . path . basename ( e1 . currentText ( ) ) } ' " ] ) . start ( ) )
programRunLayout . addWidget ( killBottonProgram )
2022-07-18 11:21:22 +08:00
mainLayout . addWidget ( programRun , 2 , 1 , 1 , 1 )
# 菜单栏
menu = window . menuBar ( )
2023-11-26 14:34:08 +08:00
programmenu = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 程序(&P) " ) )
p1 = QtWidgets . QAction ( QtGui . QIcon ( f " { programPath } /Icon/Function/wine.png " ) , QtCore . QCoreApplication . translate ( " U " , " 安装 wine(&I) " ) )
2023-12-21 22:07:27 +08:00
#installWineOnDeepin23 = QtWidgets.QAction(QtGui.QIcon(f"{programPath}/Icon/Function/wine23P.png"), QtCore.QCoreApplication.translate("U", "安装 wine(只限Deepin23 Preview)"))
#installWineOnDeepin23Alpha = QtWidgets.QAction(QtGui.QIcon(f"{programPath}/Icon/Function/wine23A.png"), QtCore.QCoreApplication.translate("U", "安装 wine(只限Deepin23 Alpha)"))
2023-11-26 14:34:08 +08:00
installWineHQOrg = QtWidgets . QAction ( QtGui . QIcon ( f " { programPath } /Icon/Function/wine.png " ) , QtCore . QCoreApplication . translate ( " U " , " 安装 WineHQ( 官方源) " ) )
installWineHQ = QtWidgets . QAction ( QtGui . QIcon ( f " { programPath } /Icon/Function/wine.png " ) , QtCore . QCoreApplication . translate ( " U " , " 安装 WineHQ( 国内清华大学镜像源) " ) )
installMoreWine = QtWidgets . QAction ( QtGui . QIcon ( f " { programPath } /Icon/Function/more-wine.png " ) , QtCore . QCoreApplication . translate ( " U " , " 安装更多 Wine( Wine 下载工具,推荐) " ) )
downloadChrootBottle = QtWidgets . QAction ( QtGui . QIcon ( f " { programPath } /Icon/Function/CHROOT.png " ) , QtCore . QCoreApplication . translate ( " U " , " 下载 Chroot 容器 " ) )
installBox86CN = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " box " ) , QtCore . QCoreApplication . translate ( " U " , " 安装 Box86/Box64 日构建(国内源) " ) )
installBox86 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " box " ) , QtCore . QCoreApplication . translate ( " U " , " 安装 Box86/Box64 日构建(国外 Github 源) " ) )
installBox86Own = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " box " ) , QtCore . QCoreApplication . translate ( " U " , " 安装 Box86/Box64( 使用自建源, 支持 riscv64) " ) )
installLat = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 安装 lat( 只限 Loongarch64 架构) " ) )
p2 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " settings " ) , QtCore . QCoreApplication . translate ( " U " , " 设置程序(&S) " ) )
enabledAll = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 强制启用所有被禁用的组件(不推荐) " ) )
setMiniFont = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 临时设置小字体 " ) )
setTinyFont = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 临时设置很小的字体 " ) )
setDefaultFont = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 临时设置默认字体 " ) )
p3 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 47 ) , QtCore . QCoreApplication . translate ( " U " , " 清空软件历史记录(&C) " ) )
cleanCache = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 47 ) , QtCore . QCoreApplication . translate ( " U " , " 清空软件缓存 " ) )
p4 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " exit " ) , QtCore . QCoreApplication . translate ( " U " , " 退出程序(&E) " ) )
2022-07-18 11:21:22 +08:00
programmenu . addAction ( p1 )
2022-08-11 21:54:20 +08:00
programmenu . addAction ( installWineHQ )
2023-07-06 22:20:33 +08:00
programmenu . addAction ( installWineHQOrg )
2022-08-20 13:35:31 +08:00
programmenu . addAction ( installMoreWine )
2022-12-03 19:34:34 +08:00
programmenu . addAction ( downloadChrootBottle )
2023-07-07 10:33:23 +08:00
programmenu . addAction ( installBox86CN )
2023-09-30 10:52:13 +08:00
programmenu . addAction ( installBox86 )
programmenu . addAction ( installBox86Own )
2023-11-11 15:00:12 +08:00
programmenu . addAction ( installLat )
2022-07-18 11:21:22 +08:00
programmenu . addSeparator ( )
programmenu . addAction ( p2 )
2023-01-06 10:50:51 +08:00
programmenu . addAction ( enabledAll )
2022-08-08 15:49:59 +08:00
programmenu . addSeparator ( )
2022-07-18 11:21:22 +08:00
programmenu . addAction ( p3 )
2022-08-08 15:49:59 +08:00
programmenu . addAction ( cleanCache )
2022-07-18 11:21:22 +08:00
programmenu . addSeparator ( )
programmenu . addAction ( p4 )
2023-08-13 21:30:15 +08:00
setDefaultFont . triggered . connect ( lambda : SetFont ( 1 ) )
setMiniFont . triggered . connect ( lambda : SetFont ( 1.2 ) )
setTinyFont . triggered . connect ( lambda : SetFont ( 1.6 ) )
2022-07-18 11:21:22 +08:00
p1 . triggered . connect ( InstallWine )
2023-12-21 22:07:27 +08:00
#installWineOnDeepin23.triggered.connect(InstallWineOnDeepin23)
#installWineOnDeepin23Alpha.triggered.connect(InstallWineOnDeepin23Alpha)
2022-08-11 21:54:20 +08:00
installWineHQ . triggered . connect ( InstallWineHQ )
2023-07-06 22:20:33 +08:00
installWineHQOrg . triggered . connect ( lambda : threading . Thread ( target = OpenTerminal , args = [ f " { programPath } /InstallNewWineHQOrg.sh " ] ) . start ( ) )
2023-11-11 15:00:12 +08:00
installLat . triggered . connect ( lambda : threading . Thread ( target = OpenTerminal , args = [ f " { programPath } /InstallLat.sh " ] ) . start ( ) )
2023-06-22 13:19:55 +08:00
def InstallMoreWine ( ) :
os . system ( f " ' { programPath } /wine/installwine ' " )
# 更新 Wine 列表
CheckWine ( )
o1 . clear ( )
if setting [ " AutoWine " ] :
o1 . addItems ( canUseWine )
else :
o1 . addItems ( wine . keys ( ) )
#installMoreWine.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"'{programPath}/wine/installwine'"]).start())
installMoreWine . triggered . connect ( InstallMoreWine )
2022-12-03 19:34:34 +08:00
downloadChrootBottle . triggered . connect ( lambda : threading . Thread ( target = os . system , args = [ f " ' { programPath } /QemuDownload.py ' " ] ) . start ( ) )
2022-07-18 11:21:22 +08:00
p2 . triggered . connect ( ProgramSetting . ShowWindow )
2023-01-06 10:50:51 +08:00
enabledAll . triggered . connect ( lambda : DisableButton ( False ) )
2023-09-01 13:52:32 +08:00
installBox86CN . triggered . connect ( lambda : OpenTerminal ( f " sudo bash ' { programPath } /InstallBox86-cn.sh ' " ) )
2023-09-30 10:52:13 +08:00
installBox86 . triggered . connect ( lambda : OpenTerminal ( f " sudo bash ' { programPath } /InstallBox86.sh ' " ) )
installBox86Own . triggered . connect ( lambda : OpenTerminal ( f " sudo bash ' { programPath } /InstallBox86-own.sh ' " ) )
2022-07-18 11:21:22 +08:00
p3 . triggered . connect ( CleanProgramHistory )
2022-08-08 15:49:59 +08:00
cleanCache . triggered . connect ( CleanProgramCache )
2022-07-18 11:21:22 +08:00
p4 . triggered . connect ( window . close )
2023-11-26 14:34:08 +08:00
wineOption = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " Wine(&W) " ) )
w1 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 打开 Wine 容器目录 " ) )
w2 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " font " ) , QtCore . QCoreApplication . translate ( " U " , " 安装常见字体 " ) )
w3 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " font " ) , QtCore . QCoreApplication . translate ( " U " , " 安装自定义字体 " ) )
w4 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 删除选择的 Wine 容器 " ) )
cleanBottonUOS = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 清理 Wine 容器(基于 Wine 适配活动脚本) " ) )
wineKeyboardLnk = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " Wine 快捷键映射 " ) )
w5 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " deb " ) , QtCore . QCoreApplication . translate ( " U " , " 打包 wine 应用(专业用户使用) " ) )
w6 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " deb " ) , QtCore . QCoreApplication . translate ( " U " , " 使用官方 Wine 适配活动的脚本进行打包 " ) )
easyPackager = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " deb " ) , QtCore . QCoreApplication . translate ( " U " , " 使用简易打包器进行打包(小白且无特殊需求建议使用这个) " ) )
getDllOnInternet = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " 1CD8_rundll32.0 " ) , QtCore . QCoreApplication . translate ( " U " , " 从互联网获取DLL " ) )
w7 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 从镜像获取DLL( 只支持官方安装镜像, DOS内核如 Windows 95 暂不支持) " ) )
updateGeek = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 从 Geek Uninstaller 官网升级程序 " ) )
deletePartIcon = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 快捷方式管理工具 " ) )
deleteDesktopIcon = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 删除所有 Wine 程序在启动器的快捷方式 " ) )
2022-07-18 11:21:22 +08:00
wineOption . addAction ( w1 )
wineOption . addAction ( w2 )
wineOption . addAction ( w3 )
wineOption . addAction ( w4 )
2022-08-11 21:54:20 +08:00
wineOption . addAction ( cleanBottonUOS )
2022-07-18 11:21:22 +08:00
wineOption . addSeparator ( )
wineOption . addAction ( w5 )
wineOption . addAction ( w6 )
2022-11-29 08:15:11 +08:00
wineOption . addAction ( easyPackager )
2022-12-09 10:28:29 +08:00
wineOption . addAction ( deletePartIcon )
2022-07-18 11:21:22 +08:00
wineOption . addSeparator ( )
2022-10-22 20:03:27 +08:00
wineOption . addAction ( wineKeyboardLnk )
wineOption . addSeparator ( )
2022-08-24 16:13:47 +08:00
wineOption . addAction ( getDllOnInternet )
2022-07-18 11:21:22 +08:00
wineOption . addAction ( w7 )
2022-07-27 22:54:40 +08:00
wineOption . addSeparator ( )
wineOption . addAction ( updateGeek )
wineOption . addSeparator ( )
2023-11-26 14:34:08 +08:00
wm1 = wineOption . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 在指定 Wine、容器安装组件 " ) )
wm1_1 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 在指定wine、指定容器安装 .net framework " ) )
wm1_2 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 在指定wine、指定容器安装 Visual Studio C++ " ) )
wm1_8 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 在指定wine、指定容器安装 Visual FoxPro " ) )
wm1_3 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 在指定wine、指定容器安装 MSXML " ) )
wm1_4 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 在指定wine、指定容器安装 gecko " ) )
wm1_5 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " mono " ) , QtCore . QCoreApplication . translate ( " U " , " 在指定wine、指定容器安装 mono " ) )
wm1_7 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 在指定wine、指定容器安装 Visual Basic Runtime " ) )
wm1_6 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 在指定wine、指定容器安装其它运行库 " ) )
2022-07-18 11:21:22 +08:00
wm1 . addAction ( wm1_1 )
wm1 . addAction ( wm1_2 )
2023-07-11 10:44:35 +08:00
wm1 . addAction ( wm1_8 )
2022-07-18 11:21:22 +08:00
wm1 . addAction ( wm1_3 )
wm1 . addAction ( wm1_4 )
wm1 . addAction ( wm1_5 )
2022-10-05 17:54:12 +08:00
wm1 . addAction ( wm1_7 )
2022-07-18 11:21:22 +08:00
wm1 . addAction ( wm1_6 )
2023-11-26 14:34:08 +08:00
wm2 = wineOption . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 在指定 Wine、容器运行基础应用 " ) )
wm2_1 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " control-center2 " ) , QtCore . QCoreApplication . translate ( " U " , " 打开指定wine、指定容器的控制面板 " ) )
wm2_2 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " web-browser " ) , QtCore . QCoreApplication . translate ( " U " , " 打开指定wine、指定容器的浏览器 " ) )
wm2_3 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " regedit " ) , QtCore . QCoreApplication . translate ( " U " , " 打开指定wine、指定容器的注册表 " ) )
wm2_4 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 打开指定wine、指定容器的任务管理器 " ) )
wm2_5 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 打开指定wine、指定容器的资源管理器 " ) )
wm2_6 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 打开指定wine、指定容器的关于 wine " ) )
2022-07-18 11:21:22 +08:00
wm2 . addAction ( wm2_1 )
wm2 . addAction ( wm2_2 )
wm2 . addAction ( wm2_3 )
wm2 . addAction ( wm2_4 )
wm2 . addAction ( wm2_5 )
wm2 . addAction ( wm2_6 )
wineOption . addSeparator ( )
2023-11-26 14:34:08 +08:00
settingRunV3Sh = wineOption . addMenu ( QtCore . QCoreApplication . translate ( " U " , " run_v3.sh 管理 " ) )
w8 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 设置 run_v3.sh 的文管为 Deepin 默认文管 " ) )
w9 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 设置 run_v3.sh 的文管为 Wine 默认文管 " ) )
w10 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 重新安装 deepin-wine-helper " ) )
w11 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " winetricks " ) , QtCore . QCoreApplication . translate ( " U " , " 使用winetricks打开指定容器 " ) )
w11WithWineLib = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " winetricks " ) , QtCore . QCoreApplication . translate ( " U " , " 使用winetricks打开指定容器( 使用Wine运行器运行库) " ) )
2023-08-05 22:30:35 +08:00
w11WithWineLib . setDisabled ( True )
2022-12-09 10:28:29 +08:00
settingRunV3Sh . addAction ( w8 )
settingRunV3Sh . addAction ( w9 )
settingRunV3Sh . addAction ( w10 )
2022-07-18 11:21:22 +08:00
wineOption . addSeparator ( )
wineOption . addAction ( w11 )
2023-08-08 14:32:26 +08:00
#wineOption.addAction(w11WithWineLib)
2022-07-18 11:21:22 +08:00
wineOption . addSeparator ( )
2023-11-26 14:34:08 +08:00
optionCheckDemo = wineOption . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 组件功能测试 " ) )
vbDemo = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 测试 Visual Basic 6 程序 " ) )
netDemo = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 测试 .net framework 程序 " ) )
netIEDemo = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 测试 .net framework + Internet Explorer 程序 " ) )
2022-11-23 13:38:50 +08:00
optionCheckDemo . addAction ( vbDemo )
optionCheckDemo . addAction ( netDemo )
optionCheckDemo . addAction ( netIEDemo )
wineOption . addSeparator ( )
2023-11-26 14:34:08 +08:00
wm3 = wineOption . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 启用/禁用功能 " ) )
ed1 = wm3 . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 启用/禁用 opengl " ) )
wm3_1 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 45 ) , QtCore . QCoreApplication . translate ( " U " , " 开启 opengl " ) )
wm3_2 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 40 ) , QtCore . QCoreApplication . translate ( " U " , " 禁用 opengl " ) )
2022-11-23 13:38:50 +08:00
ed1 . addAction ( wm3_1 )
ed1 . addAction ( wm3_2 )
2023-11-26 14:34:08 +08:00
ed2 = wm3 . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 安装/卸载 winbind " ) )
wm4_1 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 45 ) , QtCore . QCoreApplication . translate ( " U " , " 安装 winbind " ) )
wm4_2 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 40 ) , QtCore . QCoreApplication . translate ( " U " , " 卸载 winbind " ) )
2022-11-23 13:38:50 +08:00
ed2 . addAction ( wm4_1 )
ed2 . addAction ( wm4_2 )
2023-11-26 14:34:08 +08:00
dxvkMenu = wm3 . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 安装/卸载 DXVK " ) )
installDxvk = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 45 ) , QtCore . QCoreApplication . translate ( " U " , " 安装 DXVK " ) )
uninstallDxvk = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 40 ) , QtCore . QCoreApplication . translate ( " U " , " 卸载 DXVK " ) )
2022-08-08 15:49:59 +08:00
dxvkMenu . addAction ( installDxvk )
dxvkMenu . addAction ( uninstallDxvk )
2023-11-26 14:34:08 +08:00
vkd3dMenu = wm3 . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 安装/卸载 Vkd3d " ) )
installvkd3d = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 45 ) , QtCore . QCoreApplication . translate ( " U " , " 安装 Vkd3d " ) )
uninstallvkd3d = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 40 ) , QtCore . QCoreApplication . translate ( " U " , " 卸载 Vkd3d " ) )
2022-12-08 21:58:06 +08:00
vkd3dMenu . addAction ( installvkd3d )
vkd3dMenu . addAction ( uninstallvkd3d )
2022-11-20 17:48:10 +08:00
wineOption . addSeparator ( )
2022-08-11 21:54:20 +08:00
wineOption . addAction ( deleteDesktopIcon )
2022-11-20 17:48:10 +08:00
wineOption . addSeparator ( )
2023-11-26 14:34:08 +08:00
settingWineBottleCreateLink = wm3 . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 启用/禁止指定 wine 容器生成快捷方式 " ) )
enabledWineBottleCreateLink = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 45 ) , QtCore . QCoreApplication . translate ( " U " , " 允许指定 wine 容器生成快捷方式 " ) )
disbledWineBottleCreateLink = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 40 ) , QtCore . QCoreApplication . translate ( " U " , " 禁止指定 wine 容器生成快捷方式 " ) )
2022-09-28 21:55:54 +08:00
settingWineBottleCreateLink . addAction ( enabledWineBottleCreateLink )
settingWineBottleCreateLink . addAction ( disbledWineBottleCreateLink )
2023-11-26 14:34:08 +08:00
settingWineCrashDialog = wm3 . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 启用/禁用指定 wine 容器崩溃提示窗口 " ) )
disbledWineCrashDialog = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 40 ) , QtCore . QCoreApplication . translate ( " U " , " 禁用指定 wine 容器崩溃提示窗口 " ) )
enabledWineCrashDialog = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 45 ) , QtCore . QCoreApplication . translate ( " U " , " 启用指定 wine 容器崩溃提示窗口 " ) )
2022-10-02 14:52:32 +08:00
settingWineCrashDialog . addAction ( enabledWineCrashDialog )
2022-12-08 21:58:06 +08:00
settingWineCrashDialog . addAction ( disbledWineCrashDialog )
2023-11-26 14:34:08 +08:00
settingOpenProgram = wm3 . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 启用/禁止指定 wine 容器创建文件关联 " ) )
enabledOpenProgram = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 45 ) , QtCore . QCoreApplication . translate ( " U " , " 允许指定 wine 容器创建文件关联 " ) )
disbledOpenProgram = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 40 ) , QtCore . QCoreApplication . translate ( " U " , " 禁止指定 wine 容器创建文件关联 " ) )
2022-12-07 14:15:31 +08:00
settingOpenProgram . addAction ( enabledOpenProgram )
settingOpenProgram . addAction ( disbledOpenProgram )
2023-11-26 14:34:08 +08:00
settingHttpProxy = wineOption . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 设置指定 Wine 容器代理 " ) )
enabledHttpProxy = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 设置指定 wine 容器的代理 " ) )
disbledHttpProxy = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 40 ) , QtCore . QCoreApplication . translate ( " U " , " 禁用指定 wine 容器的代理 " ) )
2022-10-02 14:52:32 +08:00
settingHttpProxy . addAction ( enabledHttpProxy )
settingHttpProxy . addAction ( disbledHttpProxy )
2023-11-26 14:34:08 +08:00
dllOver = wineOption . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 函数顶替库列表 " ) )
saveDllOver = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 43 ) , QtCore . QCoreApplication . translate ( " U " , " 导出函数顶替列表 " ) )
addDllOver = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 32 ) , QtCore . QCoreApplication . translate ( " U " , " 导入函数顶替列表 " ) )
editDllOver = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 编辑函数顶替库列表 " ) )
2022-10-16 22:07:48 +08:00
dllOver . addAction ( saveDllOver )
dllOver . addAction ( addDllOver )
dllOver . addAction ( editDllOver )
2022-07-18 11:21:22 +08:00
w1 . triggered . connect ( OpenWineBotton )
w2 . triggered . connect ( InstallWineFont )
w3 . triggered . connect ( OpenWineFontPath )
w4 . triggered . connect ( DeleteWineBotton )
2022-08-11 21:54:20 +08:00
cleanBottonUOS . triggered . connect ( CleanWineBottonByUOS )
2022-07-18 11:21:22 +08:00
w5 . triggered . connect ( BuildExeDeb )
w6 . triggered . connect ( UOSPackageScript )
2022-12-06 17:31:18 +08:00
easyPackager . triggered . connect ( lambda : threading . Thread ( target = os . system , args = [ f " ' { programPath } /deepin-wine-easy-packager.py ' ' { e2 . currentText ( ) } ' " ] ) . start ( ) )
2022-10-22 20:03:27 +08:00
wineKeyboardLnk . triggered . connect ( lambda : threading . Thread ( target = os . system , args = [ f " ' { programPath } /key/key-add-gui.py ' " ] ) . start ( ) )
2022-08-24 16:13:47 +08:00
getDllOnInternet . triggered . connect ( GetDllFromInternet )
2022-07-18 11:21:22 +08:00
w7 . triggered . connect ( GetDllFromWindowsISO . ShowWindow )
2022-07-27 22:54:40 +08:00
updateGeek . triggered . connect ( lambda : os . system ( f " ' { programPath } /launch.sh ' deepin-terminal -C ' \" { programPath } /UpdateGeek.sh \" ' --keep-open " ) )
2022-07-18 11:21:22 +08:00
w8 . triggered . connect ( SetDeepinFileDialogDeepin )
w9 . triggered . connect ( SetDeepinFileDialogDefult )
w10 . triggered . connect ( SetDeepinFileDialogRecovery )
w11 . triggered . connect ( lambda : RunWinetricks ( ) )
2023-08-05 22:30:35 +08:00
w11WithWineLib . triggered . connect ( lambda : RunWinetricksWithWineLib ( ) )
2022-07-18 11:21:22 +08:00
wm1_1 . triggered . connect ( lambda : threading . Thread ( target = InstallNetFramework ) . start ( ) )
wm1_2 . triggered . connect ( lambda : threading . Thread ( target = InstallVisualStudioCPlusPlus ) . start ( ) )
2023-07-11 10:44:35 +08:00
wm1_8 . triggered . connect ( lambda : threading . Thread ( target = InstallFoxPro ) . start ( ) )
2022-07-18 11:21:22 +08:00
wm1_3 . triggered . connect ( lambda : threading . Thread ( target = InstallMSXML ) . start ( ) )
wm1_4 . triggered . connect ( lambda : threading . Thread ( target = InstallMonoGecko , args = [ " gecko " ] ) . start ( ) )
wm1_5 . triggered . connect ( lambda : threading . Thread ( target = InstallMonoGecko , args = [ " mono " ] ) . start ( ) )
2022-10-05 17:54:12 +08:00
wm1_7 . triggered . connect ( lambda : threading . Thread ( target = InstallVB ) . start ( ) )
2022-07-18 11:21:22 +08:00
wm1_6 . triggered . connect ( lambda : threading . Thread ( target = InstallOther ) . start ( ) )
wm2_1 . triggered . connect ( lambda : RunWineProgram ( " control " ) )
2022-10-16 22:07:48 +08:00
wm2_2 . triggered . connect ( lambda : RunWineProgram ( " iexplore ' ' https://gfdgd-xi.github.io " ) )
2022-07-18 11:21:22 +08:00
wm2_3 . triggered . connect ( lambda : RunWineProgram ( " regedit " ) )
wm2_4 . triggered . connect ( lambda : RunWineProgram ( " taskmgr " ) )
wm2_5 . triggered . connect ( lambda : RunWineProgram ( " explorer " ) )
wm2_6 . triggered . connect ( lambda : RunWineProgram ( " winver " ) )
wm3_1 . triggered . connect ( lambda : RunWineProgram ( f " regedit.exe ' /s ' { programPath } /EnabledOpengl.reg " ) )
wm3_2 . triggered . connect ( lambda : RunWineProgram ( f " regedit.exe ' /s ' { programPath } /DisabledOpengl.reg " ) )
wm4_1 . triggered . connect ( lambda : os . system ( f " ' { programPath } /launch.sh ' deepin-terminal -C ' pkexec apt install winbind -y ' --keep-open " ) )
wm4_2 . triggered . connect ( lambda : os . system ( f " ' { programPath } /launch.sh ' deepin-terminal -C ' pkexec apt purge winbind -y ' --keep-open " ) )
2022-08-08 15:49:59 +08:00
installDxvk . triggered . connect ( InstallDXVK )
uninstallDxvk . triggered . connect ( UninstallDXVK )
2022-12-07 16:08:41 +08:00
installvkd3d . triggered . connect ( InstallVkd3d )
uninstallvkd3d . triggered . connect ( UninstallVkd3d )
2022-11-20 17:48:10 +08:00
deletePartIcon . triggered . connect ( lambda : threading . Thread ( target = os . system , args = [ f " python3 ' { programPath } /BuildDesktop.py ' " ] ) . start ( ) )
2022-08-11 21:54:20 +08:00
deleteDesktopIcon . triggered . connect ( DeleteDesktopIcon )
2022-09-28 21:55:54 +08:00
enabledWineBottleCreateLink . triggered . connect ( lambda : RunWineProgram ( " reg ' delete ' HKEY_CURRENT_USER \ Software \ Wine \ DllOverrides ' /v winemenubuilder.exe ' /f " ) )
disbledWineBottleCreateLink . triggered . connect ( lambda : RunWineProgram ( " reg ' add ' HKEY_CURRENT_USER \ Software \ Wine \ DllOverrides ' /v winemenubuilder.exe ' /f " ) )
2022-10-02 14:52:32 +08:00
disbledWineCrashDialog . triggered . connect ( lambda : RunWineProgram ( " reg ' add ' HKEY_CURRENT_USER \ Software \ Wine \ WineDbg ' /v ShowCrashDialog /t REG_DWORD /d 00000000 ' /f " ) )
enabledWineCrashDialog . triggered . connect ( lambda : RunWineProgram ( " reg ' add ' HKEY_CURRENT_USER \ Software \ Wine \ WineDbg ' /v ShowCrashDialog /t REG_DWORD /d 00000001 ' /f " ) )
2022-12-07 14:15:31 +08:00
disbledOpenProgram . triggered . connect ( lambda : RunWineProgram ( " reg ' add ' HKEY_CURRENT_USER \ Software \ Wine \ FileOpenAssociations ' /v Enable /d N ' /f " ) )
enabledOpenProgram . triggered . connect ( lambda : RunWineProgram ( " reg ' add ' HKEY_CURRENT_USER \ Software \ Wine \ FileOpenAssociations ' /v Enable /d Y ' /f " ) )
2022-10-02 14:52:32 +08:00
enabledHttpProxy . triggered . connect ( SetHttpProxy )
disbledHttpProxy . triggered . connect ( DisbledHttpProxy )
2022-10-16 22:07:48 +08:00
saveDllOver . triggered . connect ( SaveDllList )
addDllOver . triggered . connect ( AddReg )
editDllOver . triggered . connect ( lambda : RunWineProgram ( " winecfg " ) )
2022-11-23 20:14:13 +08:00
vbDemo . triggered . connect ( lambda : RunWineProgram ( f " { programPath } /Test/vb.exe " ) )
netDemo . triggered . connect ( lambda : RunWineProgram ( f " { programPath } /Test/net.exe " ) )
netIEDemo . triggered . connect ( lambda : RunWineProgram ( f " { programPath } /Test/netandie.exe " ) )
2022-07-18 11:21:22 +08:00
2023-11-26 14:34:08 +08:00
virtualMachine = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 虚拟机(&V) " ) )
v1 = QtWidgets . QAction ( QtGui . QIcon . fromTheme ( " virtualbox " ) , QtCore . QCoreApplication . translate ( " U " , " 使用虚拟机运行 Windows 应用 " ) )
2022-07-18 11:21:22 +08:00
virtualMachine . addAction ( v1 )
v1 . triggered . connect ( RunVM )
2023-11-26 14:34:08 +08:00
checkValue = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 校验值计算(&S) " ) )
md5Value = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 32 ) , QtCore . QCoreApplication . translate ( " U " , " MD5(&M) " ) )
sha1Value = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 32 ) , QtCore . QCoreApplication . translate ( " U " , " SHA1(&M) " ) )
base64Value = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 32 ) , QtCore . QCoreApplication . translate ( " U " , " Base64(建议小文件)(&B) " ) )
sha256Value = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 32 ) , QtCore . QCoreApplication . translate ( " U " , " SHA256(&S) " ) )
sha512Value = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 32 ) , QtCore . QCoreApplication . translate ( " U " , " SHA512(&S) " ) )
2022-09-09 22:12:27 +08:00
md5Value . triggered . connect ( lambda : ValueCheck ( ) . Get ( " MD5 " ) )
sha1Value . triggered . connect ( lambda : ValueCheck ( ) . Get ( " SHA1 " ) )
base64Value . triggered . connect ( lambda : ValueCheck ( ) . Get ( " BASE64 " ) )
sha256Value . triggered . connect ( lambda : ValueCheck ( ) . Get ( " SHA256 " ) )
sha512Value . triggered . connect ( lambda : ValueCheck ( ) . Get ( " SHA512 " ) )
checkValue . addAction ( md5Value )
checkValue . addAction ( sha1Value )
checkValue . addAction ( base64Value )
checkValue . addAction ( sha256Value )
checkValue . addAction ( sha512Value )
2023-11-26 14:34:08 +08:00
safeWebsize = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 云沙箱(&C) " ) )
s1 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 9 ) , QtCore . QCoreApplication . translate ( " U " , " 360 沙箱云 " ) )
s2 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 9 ) , QtCore . QCoreApplication . translate ( " U " , " 微步云沙箱 " ) )
s3 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 9 ) , QtCore . QCoreApplication . translate ( " U " , " VIRUSTOTAL " ) )
s4 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 9 ) , QtCore . QCoreApplication . translate ( " U " , " 计算机病毒防御技术国家工程实验室 " ) )
2022-07-18 11:21:22 +08:00
safeWebsize . addAction ( s1 )
safeWebsize . addAction ( s2 )
safeWebsize . addAction ( s3 )
2023-08-06 15:58:59 +08:00
safeWebsize . addAction ( s4 )
2022-07-18 11:21:22 +08:00
s1 . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://ata.360.net/ " ) )
s2 . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://s.threatbook.cn/ " ) )
s3 . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://www.virustotal.com/ " ) )
2023-08-06 15:58:59 +08:00
s4 . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://cloud.vdnel.cn/ " ) )
2022-07-18 11:21:22 +08:00
2023-11-26 14:34:08 +08:00
log = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 日志(&L) " ) )
getDllInfo = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 查询 Dll " ) )
checkLogText = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 日志分析 " ) )
saveLogText = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 16 ) , QtCore . QCoreApplication . translate ( " U " , " 另存为日志 " ) )
2023-12-23 12:24:20 +08:00
saveLogReport = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 16 ) , QtCore . QCoreApplication . translate ( " U " , " 输出详细日志报告 " ) )
2023-11-26 14:34:08 +08:00
transLogText = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 翻译日志(翻译后日志分析功能会故障) " ) )
uploadLogText = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 上传日志 " ) )
2022-11-18 22:02:56 +08:00
getDllInfo . triggered . connect ( DllWindow . ShowWindow )
2022-11-20 17:48:10 +08:00
checkLogText . triggered . connect ( LogChecking . ShowWindow )
2022-11-25 09:40:24 +08:00
saveLogText . triggered . connect ( SaveLog )
2023-12-23 12:24:20 +08:00
saveLogReport . triggered . connect ( lambda : SaveLogReport ( o1 . currentText ( ) , wine [ o1 . currentText ( ) ] , lastRunCommand , e2 . currentText ( ) , returnText . toPlainText ( ) ) . SetWindow ( ) )
2022-12-05 22:21:33 +08:00
transLogText . triggered . connect ( TransLog )
2022-11-25 09:40:24 +08:00
uploadLogText . triggered . connect ( UploadLog )
2022-11-18 22:02:56 +08:00
log . addAction ( getDllInfo )
2023-12-23 12:24:20 +08:00
#log.addAction(checkLogText)
2022-11-25 09:40:24 +08:00
log . addAction ( saveLogText )
2023-12-23 12:24:20 +08:00
log . addAction ( saveLogReport )
#log.addAction(transLogText)
#log.addAction(uploadLogText)
2022-11-18 22:02:56 +08:00
2023-03-19 14:19:28 +08:00
actionList = [ ]
def AddLib ( install : QtWidgets . QAction , uninstall , menu , info ) :
actionList . append ( install )
actionList . append ( uninstall )
install . triggered . connect ( lambda : OpenTerminal ( f " bash ' { programPath } /InstallRuntime/ { info } ' " ) )
uninstall . triggered . connect ( lambda : OpenTerminal ( f " bash ' { programPath } /InstallRuntime/remove/ { info } ' " ) )
menu . addAction ( install )
menu . addAction ( uninstall )
2023-11-26 14:34:08 +08:00
installLib = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 应用运行库(&R) " ) )
howtouseQemuUser = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " Qemu User 使用教程(配合运行库实现在非 X86 架构运行 X86 Wine) " ) )
2023-07-10 22:35:54 +08:00
howtouseQemuUser . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://www.bilibili.com/read/cv23185651 " ) )
runnerlibinfo = QtWidgets . QAction ( " 只在运行器使用的运行库(不与其他运行库以及兼容层冲突) " )
installRunnerLib = QtWidgets . QAction ( " 安装运行库 " )
statusRunnerLib = QtWidgets . QAction ( " 当前状态:未安装 " )
removeRunnerLib = QtWidgets . QAction ( " 移除运行库 " )
runnerlibinfo . setDisabled ( True )
statusRunnerLib . setDisabled ( True )
removeRunnerLib . setDisabled ( True )
installLib . addAction ( howtouseQemuUser )
installLib . addSeparator ( )
installLib . addAction ( runnerlibinfo )
installLib . addAction ( statusRunnerLib )
installLib . addAction ( installRunnerLib )
installLib . addAction ( removeRunnerLib )
2023-07-11 20:58:17 +08:00
diyRunnerLib = installLib . addMenu ( " 定制运行库 " )
diyRunnerLib . setDisabled ( True )
2023-07-11 21:51:01 +08:00
diyRunnerLibRemoveTips = QtWidgets . QAction ( " 移除库 " )
diyRunnerLibRemoveTips . setDisabled ( True )
diyRunnerLib . addAction ( diyRunnerLibRemoveTips )
2023-07-11 10:08:14 +08:00
installRunnerLib . triggered . connect ( lambda : threading . Thread ( target = OpenTerminal , args = [ f " bash ' { programPath } /WineLib/install.sh ' " ] ) . start ( ) )
2023-07-11 10:23:56 +08:00
removeRunnerLib . triggered . connect ( lambda : threading . Thread ( target = OpenTerminal , args = [ f " bash ' { programPath } /WineLib/remove.sh ' " ] ) . start ( ) )
2023-07-11 20:58:17 +08:00
if os . path . exists ( f " { programPath } /WineLib/usr " ) :
2023-07-10 22:35:54 +08:00
installRunnerLib . setDisabled ( True )
removeRunnerLib . setEnabled ( True )
2023-07-11 20:58:17 +08:00
diyRunnerLib . setEnabled ( True )
2023-08-05 22:30:35 +08:00
w11WithWineLib . setEnabled ( True )
2023-07-10 22:35:54 +08:00
statusRunnerLib . setText ( " 当前状态:已安装 " )
2023-07-11 20:58:17 +08:00
libPathList = [ ]
2023-07-11 22:05:06 +08:00
mapLink = [ ]
def AddRunnerLib ( number , name ) :
global diyRunnerLib
2023-07-11 21:51:01 +08:00
action = QtWidgets . QAction ( f " { name } " )
2023-07-11 22:05:06 +08:00
mapLink . append ( action )
2023-07-11 22:32:28 +08:00
action . triggered . connect ( lambda : DelRunnerLib ( int ( str ( number ) ) ) )
2023-07-11 21:51:01 +08:00
diyRunnerLib . addAction ( action )
2023-07-11 22:05:06 +08:00
def DelRunnerLib ( number ) :
os . system ( f " rm -rf ' { libPathList [ number ] } ' " )
2023-07-11 22:32:28 +08:00
QtWidgets . QMessageBox . information ( window , " 提示 " , " 删除完成! " )
2023-07-11 22:05:06 +08:00
mapLink [ number ] . setDisabled ( True )
2023-07-11 20:58:17 +08:00
for libPath in [ f " { programPath } /WineLib/usr/lib " , f " { programPath } /WineLib/usr/lib64 " ] :
for i in os . listdir ( libPath ) :
if not os . path . isdir ( f " { libPath } / { i } " ) :
try :
if not os . path . getsize ( f " { libPath } / { i } " ) :
continue
except :
continue
libPathList . append ( f " { libPath } / { i } " )
2023-07-11 22:05:06 +08:00
AddRunnerLib ( len ( libPathList ) - 1 , f " { i } " )
2023-07-11 20:58:17 +08:00
else :
2023-07-11 21:07:59 +08:00
if not os . path . exists ( f " { libPath } / { i } /libc.so.6 " ) :
continue
2023-07-11 20:58:17 +08:00
libPathList . append ( f " { libPath } / { i } / " )
2023-07-11 22:05:06 +08:00
AddRunnerLib ( len ( libPathList ) - 1 , f " { i } / " )
2023-07-11 20:58:17 +08:00
print ( libPathList )
2023-03-19 14:19:28 +08:00
if os . path . exists ( f " { programPath } /InstallRuntime " ) :
2023-07-10 22:35:54 +08:00
installLib . addSeparator ( )
systemalllibinfo = QtWidgets . QAction ( " 全局运行库(与其他运行库以及部分兼容层冲突) " )
systemalllibinfo . setDisabled ( True )
installLib . addAction ( systemalllibinfo )
2023-11-26 14:34:08 +08:00
installQemuMenu = installLib . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 安装 Qemu User " ) )
installQemu = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 安装 Qemu User " ) )
removeQemu = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 卸载 Qemu User " ) )
2023-03-19 14:19:28 +08:00
installQemuMenu . addAction ( installQemu )
installQemuMenu . addAction ( removeQemu )
installQemu . triggered . connect ( lambda : OpenTerminal ( f " bash ' { programPath } /InstallQemuUser.sh ' " ) )
removeQemu . triggered . connect ( lambda : OpenTerminal ( f " bash ' { programPath } /RemoveQemuUser.sh ' " ) )
actionList = [ ]
nameList = { }
for i in os . listdir ( f " { programPath } /InstallRuntime " ) :
if i [ - 3 : ] == " .sh " :
print ( f " 检测到库 { os . path . splitext ( i ) [ 0 ] } " )
2023-11-26 14:34:08 +08:00
AddLib ( QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , f " 安装 { os . path . splitext ( i ) [ 0 ] } 运行库 " ) ) , QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , f " 卸载 { os . path . splitext ( i ) [ 0 ] } 运行库 " ) ) , installLib . addMenu ( QtCore . QCoreApplication . translate ( " U " , f " 运行库 { os . path . splitext ( i ) [ 0 ] } " ) ) , i )
2023-03-19 14:19:28 +08:00
2023-11-26 14:34:08 +08:00
qemuMenu = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 容器(&C) " ) )
unpackDeb = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 32 ) , QtCore . QCoreApplication . translate ( " U " , " 解包 deb 提取容器 " ) )
2022-12-05 22:21:33 +08:00
qemuMenu . addAction ( unpackDeb )
unpackDeb . triggered . connect ( UnPackage )
2022-12-03 21:47:05 +08:00
if len ( qemuBottleList ) > = 1 :
2023-11-26 14:34:08 +08:00
configMenu = QtWidgets . QAction ( QtGui . QIcon ( f " { programPath } /Icon/Function/CHROOT.png " ) , QtCore . QCoreApplication . translate ( " U " , " 配置指定 Chroot 容器 " ) )
2022-12-03 21:47:05 +08:00
qemuMenu . addAction ( configMenu )
configMenu . triggered . connect ( ConfigQemu )
print ( qemuBottleList )
2023-11-26 14:34:08 +08:00
videoHelp = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 视频教程(&V) " ) )
2023-12-24 09:52:01 +08:00
videoHelpAction = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " 视频教程( Bilibili) " ) )
videoHelpActionYoutube = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " 视频教程( Youtube) " ) )
2023-08-09 14:44:52 +08:00
videoHelpAction . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://space.bilibili.com/695814694/channel/collectiondetail?sid=1610353 " ) )
2023-12-24 09:52:01 +08:00
videoHelpActionYoutube . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://www.youtube.com/watch?v=qDaPBiIdGAs&list=PLoXD11L1NQAx8A1Qskgu3tUoi0nHKJcmg " ) )
2023-08-09 14:44:52 +08:00
videoHelp . addAction ( videoHelpAction )
2023-12-24 09:52:01 +08:00
videoHelp . addAction ( videoHelpActionYoutube )
2023-08-09 14:44:52 +08:00
2023-11-26 14:34:08 +08:00
help = menu . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 帮助(&H) " ) )
runStatusWebSize = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " 查询程序在 Wine 的运行情况 " ) )
h1 = help . addMenu ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " 程序官网 " ) )
h2 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 小提示 " ) )
wineRunnerHelp = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " Wine运行器和Wine打包器傻瓜式使用教程( 小白专用) By 鹤舞白沙 " ) )
h3 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 更新内容 " ) )
h4 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 鸣谢名单 " ) )
h5 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 更新这个程序 " ) )
2024-01-14 17:53:27 +08:00
appreciate = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 赞赏作者/请作者喝杯茶 " ) )
2024-06-29 11:45:02 +08:00
programInformation = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 获取程序公告 " ) )
2023-11-26 14:34:08 +08:00
h6 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 反馈这个程序的建议和问题 " ) )
h7 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 9 ) , QtCore . QCoreApplication . translate ( " U " , " 关于这个程序 " ) )
h8 = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 9 ) , QtCore . QCoreApplication . translate ( " U " , " 关于 Qt " ) )
gfdgdxiio = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " 作者个人站 " ) )
gitee = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " Gitee " ) )
github = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " Github " ) )
gitlab = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " Gitlab " ) )
2023-12-23 12:24:20 +08:00
jihu = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " Sourceforge " ) )
2022-08-24 16:13:47 +08:00
h1 . addAction ( gfdgdxiio )
h1 . addAction ( gitee )
h1 . addAction ( github )
h1 . addAction ( gitlab )
h1 . addAction ( jihu )
2022-07-18 11:21:22 +08:00
help . addSeparator ( )
2022-12-04 16:13:08 +08:00
help . addAction ( wineRunnerHelp )
2022-09-03 19:21:00 +08:00
help . addAction ( runStatusWebSize )
help . addSeparator ( )
2022-07-18 11:21:22 +08:00
help . addAction ( h2 )
help . addAction ( h3 )
help . addAction ( h4 )
help . addSeparator ( )
2023-01-24 15:31:12 +08:00
2023-11-26 14:34:08 +08:00
wikiHelp = QtWidgets . QAction ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " 程序 Wiki " ) )
2022-10-05 17:54:12 +08:00
help . addAction ( wikiHelp )
2023-11-26 14:34:08 +08:00
videoHelp = help . addMenu ( QtWidgets . QApplication . style ( ) . standardIcon ( 20 ) , QtCore . QCoreApplication . translate ( " U " , " 视频教程 " ) )
2023-08-10 18:38:07 +08:00
videoHelp . addAction ( videoHelpAction )
2022-08-24 16:13:47 +08:00
help . addSeparator ( )
2022-07-18 11:21:22 +08:00
help . addAction ( h5 )
help . addAction ( h6 )
2022-12-07 13:18:49 +08:00
help . addAction ( programInformation )
2024-01-14 17:53:27 +08:00
help . addAction ( appreciate )
2022-07-18 11:21:22 +08:00
help . addAction ( h7 )
help . addAction ( h8 )
help . addSeparator ( )
2023-11-26 14:34:08 +08:00
hm1 = help . addMenu ( QtCore . QCoreApplication . translate ( " U " , " 更多生态适配应用 " ) )
hm1_1 = QtWidgets . QAction ( QtCore . QCoreApplication . translate ( " U " , " 运行 Android 应用: UEngine 运行器 " ) )
2022-07-18 11:21:22 +08:00
hm1 . addAction ( hm1_1 )
2022-08-24 16:13:47 +08:00
gfdgdxiio . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://gfdgd-xi.github.io " ) )
gitee . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://gitee.com/gfdgd-xi/deep-wine-runner " ) )
github . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://github.com/gfdgd-xi/deep-wine-runner " ) )
gitlab . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://gitlab.com/gfdgd-xi/deep-wine-runner " ) )
2023-12-23 12:24:20 +08:00
jihu . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://sourceforge.net/projects/deep-wine-runner/ " ) )
2022-09-03 19:21:00 +08:00
runStatusWebSize . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://gfdgd-xi.github.io/wine-runner-info " ) )
2022-07-18 11:21:22 +08:00
h2 . triggered . connect ( helps )
2024-01-14 17:53:27 +08:00
appreciate . triggered . connect ( Appreciate )
2022-07-18 11:21:22 +08:00
h3 . triggered . connect ( UpdateThings )
2022-12-04 16:13:08 +08:00
wineRunnerHelp . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://bbs.deepin.org/post/246837 " ) )
2022-07-18 11:21:22 +08:00
h4 . triggered . connect ( ThankWindow )
2022-10-05 17:54:12 +08:00
wikiHelp . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://gfdgd-xi.github.io/wine-runner-wiki " ) )
2022-07-18 11:21:22 +08:00
h5 . triggered . connect ( UpdateWindow . ShowWindow )
h6 . triggered . connect ( WineRunnerBugUpload )
h7 . triggered . connect ( about_this_program )
h8 . triggered . connect ( lambda : QtWidgets . QMessageBox . aboutQt ( widget ) )
hm1_1 . triggered . connect ( lambda : webbrowser . open_new_tab ( " https://gitee.com/gfdgd-xi/uengine-runner " ) )
2022-12-07 13:18:49 +08:00
programInformation . triggered . connect ( GetNewInformation )
2022-11-16 22:57:19 +08:00
# 异同步获取信息
2022-11-18 17:18:24 +08:00
#threading.Thread(target=GetVersion).start()
GetVersion ( )
2022-07-18 11:21:22 +08:00
# 窗口设置
2024-01-14 17:53:27 +08:00
window . resize ( int ( widget . frameGeometry ( ) . width ( ) * 2 ) , int ( widget . frameGeometry ( ) . height ( ) ) )
2022-07-18 11:21:22 +08:00
widget . setLayout ( mainLayout )
2022-07-27 22:40:05 +08:00
window . setWindowIcon ( QtGui . QIcon ( f " { programPath } /deepin-wine-runner.svg " ) )
2022-07-18 11:21:22 +08:00
widget . show ( )
window . show ( )
# 控件设置
2022-07-29 15:35:07 +08:00
app . setStyle ( QtWidgets . QStyleFactory . create ( setting [ " Theme " ] ) )
2022-07-18 11:21:22 +08:00
e1 . addItems ( findExeHistory )
e2 . addItems ( wineBottonHistory )
combobox1 . addItems ( shellHistory )
2022-08-05 17:46:41 +08:00
if setting [ " AutoWine " ] :
o1 . addItems ( canUseWine )
else :
o1 . addItems ( wine . keys ( ) )
2022-08-11 21:54:20 +08:00
# 禁用被精简掉的控件
for i in [
2023-12-21 22:07:27 +08:00
[ [ p1 , installWineHQ , installWineHQOrg , installMoreWine ] , f " { programPath } /InstallWineOnDeepin23.py " ] ,
2022-08-11 21:54:20 +08:00
[ [ w5 ] , f " { programPath } /deepin-wine-packager.py " ] ,
[ [ w6 ] , f " { programPath } /deepin-wine-packager-with-script.py " ] ,
2022-08-13 17:50:21 +08:00
[ [ p1 , v1 ] , f " { programPath } /RunVM.sh " ] ,
2024-06-29 10:51:16 +08:00
[ [ getProgramIcon , uninstallProgram , updateGeek , trasButton , fontAppStore , wm1_1 , wm1_2 , wm1_3 , wm1_6 , w7 , w2 ] , f " { programPath } /geek.exe " ] ,
2022-08-11 21:54:20 +08:00
] :
if not os . path . exists ( i [ 1 ] ) :
for x in i [ 0 ] :
x . setDisabled ( True )
2024-01-31 20:54:58 +08:00
# 有些功能是 Arch Linux 不适用的,需要屏蔽
2024-07-19 22:59:46 +08:00
if not os . path . exists ( " /etc/debian_version " ) :
2024-02-01 18:35:21 +08:00
if os . path . exists ( f " { programPath } /off-line.lock " ) :
for i in [ p1 ] :
i . setDisabled ( True )
2024-01-31 20:54:58 +08:00
for i in [ installLat , installWineHQ , installWineHQOrg ,
2024-06-29 11:15:40 +08:00
installBox86CN , installBox86 , installBox86Own ] :
2024-01-31 20:54:58 +08:00
i . setDisabled ( True )
for i in actionList :
i . setDisabled ( True )
2022-08-11 21:54:20 +08:00
# 有些功能是非 X86 不适用的,需要屏蔽
if subprocess . getoutput ( " arch " ) . lower ( ) != " x86_64 " :
p1 . setDisabled ( True )
2022-09-13 21:27:17 +08:00
installMoreWine . setEnabled ( True )
2023-05-03 16:53:00 +08:00
#virtualMachine.setDisabled(True)
#v1.setDisabled(True)
2022-08-11 21:54:20 +08:00
installWineHQ . setDisabled ( True )
2023-07-06 22:20:33 +08:00
installWineHQOrg . setDisabled ( True )
2024-02-02 10:05:59 +08:00
if os . path . exists ( " /etc/arch-release " ) :
p1 . setEnabled ( True )
2022-07-18 11:21:22 +08:00
o1 . setCurrentText ( setting [ " DefultWine " ] )
e1 . setEditText ( setting [ " DefultBotton " ] )
e2 . setEditText ( " " )
combobox1 . setEditText ( " " )
if len ( sys . argv ) > 1 and sys . argv [ 1 ] :
e2 . setEditText ( sys . argv [ 1 ] )
2024-06-01 15:39:25 +08:00
if not os . path . exists ( " /opt/apps/store.spark-app.spark-dwine-helper/files/deepinwine/tools/spark-dwine-helper/wine-app-launcher/wine-app-launcher.sh " ) :
2022-07-18 11:21:22 +08:00
sparkWineSetting . setEnabled ( False )
2022-08-25 21:47:42 +08:00
if o1 . currentText ( ) == " " :
# 一个 Wine 都没有却用 Wine 的功能
# 还是要处理的,至少不会闪退
wine [ " 没有识别到任何Wine, 请在菜单栏“程序”安装Wine或安装任意Wine应用 " ] = " 没有识别到任何Wine, 请在菜单栏“程序”安装Wine或安装任意Wine应用 "
canUseWine . append ( " 没有识别到任何Wine, 请在菜单栏“程序”安装Wine或安装任意Wine应用 " )
o1 . addItem ( " 没有识别到任何Wine, 请在菜单栏“程序”安装Wine或安装任意Wine应用 " )
2023-08-13 21:30:15 +08:00
SetFont ( setting [ " FontSize " ] )
2024-01-14 10:22:41 +08:00
2024-07-14 18:48:30 +08:00
window . setCentralWidget ( widget )
# 判断是否为小屏幕,是则设置滚动条并全屏
if ( window . frameGeometry ( ) . width ( ) > app . primaryScreen ( ) . availableGeometry ( ) . size ( ) . width ( ) * 0.8 or
window . frameGeometry ( ) . height ( ) > app . primaryScreen ( ) . availableGeometry ( ) . size ( ) . height ( ) * 0.9 ) :
# 设置滚动条
areaScroll = QtWidgets . QScrollArea ( window )
areaScroll . setWidgetResizable ( True )
areaScroll . setWidget ( widget )
areaScroll . setFrameShape ( QtWidgets . QFrame . NoFrame )
window . setCentralWidget ( areaScroll )
window . showMaximized ( ) # 设置全屏
window . show ( )
2024-06-29 12:04:46 +08:00
2023-07-15 10:22:08 +08:00
# Mini 模式
# MiniMode(True)
2022-07-18 11:21:22 +08:00
sys . exit ( app . exec_ ( ) )