diff --git a/AutoConfig.py b/AutoConfig.py index 19372ff..a4e72c6 100755 --- a/AutoConfig.py +++ b/AutoConfig.py @@ -64,7 +64,7 @@ class Connect: return # 判断版本以启动对应的解释器 # 做到新旧兼容 - if "$(" in things: + if "($" in things: print("a") OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/ConfigLanguareRunner.py' '/tmp/wine-runner-auto-config.wsh' --system") # 执行脚本 @@ -86,7 +86,7 @@ class Connect: traceback.print_exc() # 判断版本以启动对应的解释器 # 做到新旧兼容 - if "$(" in things: + if "($" in things: OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/ConfigLanguareRunner.py' '{path[0]}' --system") # 执行脚本 OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/AutoShell/main.py' '{path[0]}'") diff --git a/AutoShell/command/disbledWinebottlecreatelink b/AutoShell/command/disbledWinebottlecreatelink new file mode 100755 index 0000000..1bf2fba --- /dev/null +++ b/AutoShell/command/disbledWinebottlecreatelink @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file diff --git a/AutoShell/command/disbledhttpproxy b/AutoShell/command/disbledhttpproxy new file mode 100755 index 0000000..1bf2fba --- /dev/null +++ b/AutoShell/command/disbledhttpproxy @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file diff --git a/AutoShell/command/disbledwinecrashdialog b/AutoShell/command/disbledwinecrashdialog new file mode 100755 index 0000000..1bf2fba --- /dev/null +++ b/AutoShell/command/disbledwinecrashdialog @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file diff --git a/AutoShell/command/enabledWinebottlecreatelink b/AutoShell/command/enabledWinebottlecreatelink new file mode 100755 index 0000000..1bf2fba --- /dev/null +++ b/AutoShell/command/enabledWinebottlecreatelink @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file diff --git a/AutoShell/command/enabledhttpproxy b/AutoShell/command/enabledhttpproxy new file mode 100755 index 0000000..1bf2fba --- /dev/null +++ b/AutoShell/command/enabledhttpproxy @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file diff --git a/AutoShell/command/enabledwinecrashdialog b/AutoShell/command/enabledwinecrashdialog new file mode 100755 index 0000000..1bf2fba --- /dev/null +++ b/AutoShell/command/enabledwinecrashdialog @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file diff --git a/AutoShell/command/killallwineserver b/AutoShell/command/killallwineserver new file mode 100755 index 0000000..1bf2fba --- /dev/null +++ b/AutoShell/command/killallwineserver @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file diff --git a/AutoShell/command/taskmgr b/AutoShell/command/taskmgr new file mode 100755 index 0000000..1bf2fba --- /dev/null +++ b/AutoShell/command/taskmgr @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) \ No newline at end of file diff --git a/ConfigLanguareRunner-help.json b/ConfigLanguareRunner-help.json new file mode 100644 index 0000000..42a05d3 --- /dev/null +++ b/ConfigLanguareRunner-help.json @@ -0,0 +1,41 @@ +{ + "installdll": "安装指定 dll 在指定容器\n参数数量:1\n参数介绍:dll名称或在从互联网获取DLL工具的编号,如 7012 xolehlp.dll 平台:2003 架构:64 的 7012", + "stopdll": "不允许指定 dll/exe 运行\n参数数量:1\n参数介绍:dll/exe 名称,如 example.exe", + "installfont": "安装指定字体到指定容器\n参数数量:1\n在字体商店的编号,如 5 msyhbd.ttc 的 5", + "installsparkcorefont": "安装星火应用商店的“微软核心字体”\n参数数量:0\n参数介绍:无", + "installmono": "安装最新版本的 mono 到指定容器\n参数数量:0\n参数介绍:无", + "installgecko": "安装最新版本的 gecko 到指定容器\n参数数量:0\n参数介绍:无", + "installvcpp": "安装指定的 VCPP 运行库到指定容器\n参数数量:1\n参数介绍:在安装 Visual Studio C++ 工具的编号,如 10 Visual Studio C++ 2015、2017、2019 和 2022 X64 的 10", + "installnet": "安装指定的 .net framework 运行库到指定容器\n参数数量:1\n参数介绍:在安装 .net framework 工具的编号,如 3 .net framework 4.5.1 Offline Installer 的 3", + "installmsxml": "安装指定的 MSXML 运行库到指定容器\n参数数量:1\n参数介绍:在安装 MSXML 工具的编号,如 1、MSXML 4.0 SP3 的 1", + "echo": "显示内容\n参数数量:≥1\n参数介绍:接要显示的内容", + "info": "显示提示对话框\n参数数量:2\n参数介绍:标题+显示内容", + "error": "显示错误对话框\n参数数量:2\n参数介绍:标题+显示内容", + "warning": "显示警告对话框\n参数数量:2\n参数介绍:标题+显示内容", + "exit": "退出程序\n参数数量:0\n参数介绍:无", + "bat": "执行 cmd 命令在 Wine 容器内(在 Windows 将在系统执行命令)\n参数数量:≥1\n参数介绍:接要执行的命令", + "bash": "执行 bash 命令(在 Windows 系统将执行 cmd 命令)\n参数数量:≥1\n参数介绍:接要执行的命令", + "version": "显示解释器版本(Wine 运行器版本)\n参数数量:0\n参数介绍:无", + "thank": "显示谢明列表\n参数数量:0\n参数介绍:无", + "pause": "按回车键后继续\n参数数量:0\n参数介绍:无", + "download": "使用 aria2 下载文件\n参数数量:≥1 && ≤3\n参数介绍:下载URL+保存在的文件夹+保存的文件名", + "installdxvk": "安装 dxvk 到指定容器\n参数数量:0\n参数介绍:无", + "createbotton": "在指定目录创建容器\n参数数量:0\n参数介绍:无", + "reg": "导入 .reg 文件\n参数数量:0\n参数介绍:reg 文件路径", + "enabledopengl": "开启 OpenGL\n参数数量:0\n参数介绍:无", + "disbledopengl": "关闭 OpenGL\n参数数量:0\n参数介绍:无", + "winecfg": "显示“Wine 设置”\n参数数量:0\n参数介绍:无", + "winver": "显示“关于 Wine”\n参数数量:0\n参数介绍:无", + "changeversion": "更改 Wine 容器系统版本(未实现)\n参数数量:无\n参数介绍:无", + "cat": "显示指定文件(只支持显示编码为UTF-8的文件)\n参数数量:1\n参数介绍:无", + "enabledhttpproxy": "设置指定容器代理\n参数数量:2\n参数介绍:代理服务器地址+端口", + "disbledhttpproxy": "禁用指定容器代理\n参数数量:0\n参数介绍:无", + "enabledwinecrashdialog": "启用 Wine 容器程序崩溃提示窗口\n参数数量:0\n参数介绍:无", + "disbledwinecrashdialog": "启用 Wine 容器程序崩溃提示窗口\n参数数量:0\n参数介绍:无", + "disbledWinebottlecreatelink": "禁止 Wine 容器生成快捷方式\n参数数量:0\n参数介绍:无", + "enabledWinebottlecreatelink": "允许 Wine 容器生成快捷方式\n参数数量:0\n参数介绍:无", + "killall": "杀死指定进程\n参数数量:1\n参数介绍:进程名", + "control": "打开控制面板\n参数数量:0\n参数介绍:无", + "taskmgr": "打开任务管理器\n参数数量:0\n参数介绍:无", + "killallwineserver": "杀死所有 Wine 程序\n参数数量:0\n参数介绍:无" +} \ No newline at end of file diff --git a/ConfigLanguareRunner.py b/ConfigLanguareRunner.py index 2b1c65f..f0ef5cd 100755 --- a/ConfigLanguareRunner.py +++ b/ConfigLanguareRunner.py @@ -13,6 +13,7 @@ import time import json import platform import traceback +import subprocess import PyQt5.QtWidgets as QtWidgets # 读取文本文档 def readtxt(path): @@ -25,6 +26,7 @@ programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string information = json.loads(readtxt(f"{programPath}/information.json")) version = information["Version"] thankText = "" +helpList = json.loads(readtxt(f"{programPath}/ConfigLanguareRunner-help.json")) for i in information["Thank"]: thankText += f"{i}\n" programEnv = [ @@ -97,7 +99,17 @@ class Command(): "winver", "changeversion", "stopdll", - "cat" + "cat", + "taskmgr", + "control", + "killall", + "killallwineserver", + "enabledhttpproxy", + "disbledhttpproxy", + "enabledwinecrashdialog", + "disbledwinecrashdialog", + "disbledWinebottlecreatelink", + "enabledWinebottlecreatelink" ] def __init__(self, commandString: str) -> None: @@ -321,6 +333,64 @@ class Command(): print("文件读取错误") Debug() + def Taskmgr(self): + self.command = ["bat", "taskmgr"] + return self.Bat() + + def Control(self): + self.command = ["bat", "control"] + return self.Bat() + + def Killall(self): + os.system(f"killall -9 {self.command[1]}") + + def KillallWineServer(self): + command = ["WINEPREFIX='($WINEPREFIX)'", "($WINE)", "-k"] + for i in programEnv: + for k in range(len(command)): + command[k] = command[k].replace(i[0], i[1]) + if "box86" in command[1] or "exagear" in command[1] or "box64" in command[1]: + print("不支持此 Wine") + return 1 + if os.path.exists(command[1]): + # 文件存在 + command[1] = f"{os.path.dirname(command[1])}/wineserver" + else: + # 读 which + command[1] = f"{os.path.dirname(subprocess.getoutput(f'which {command[1]}').strip())}/wineserver" + commandStr = command[0] + " " + for i in command[1:]: + commandStr += f"'{i}' " + return os.system(commandStr) + + def EnabledWineBottleCreateLink(self): + self.command = ["bat", "reg", "delete", "HKEY_CURRENT_USER\Software\Wine\DllOverrides", "/v", "winemenubuilder.exe", "/f"] + self.Bat() + + def DisbledWineBottleCreateLink(self): + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\DllOverrides", "/v", "winemenubuilder.exe", "/f"] + self.Bat() + + def DisbledWineCrashDialog(self): + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\WineDbg", "/v", "ShowCrashDialog", "/t", "REG_DWORD", "/d", "00000000", "/f"] + self.Bat() + + def EnabledWineCrashDialog(self): + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\WineDbg", "/v", "ShowCrashDialog", "/t", "REG_DWORD", "/d", "00000001", "/f"] + self.Bat() + + def EnabledHttpProxy(self): + proxyServerAddress = self.command[1] + port = self.command[2] + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyEnable", "/t", "REG_DWORD", "/d", "00000001", "/f"] + self.Bat() + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyServer", "/d", f"{proxyServerAddress}:{port}", "/f"] + self.Bat() + + def DisbledHttpProxy(self): + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyEnable", "/t", "REG_DWORD", "/d", "00000000", "/f"] + self.Bat() + # 可以运行的命令的映射关系 # 可以被使用的命令的映射 commandList = { @@ -352,11 +422,21 @@ class Command(): "winver": Winver, "changeversion": ChangeVersion, "stopdll": StopDll, - "cat": Cat + "cat": Cat, + "taskmgr": Taskmgr, + "control": Control, + "killallwineserver": KillallWineServer, + "enabledhttpproxy": EnabledHttpProxy, + "disbledhttpproxy": DisbledHttpProxy, + "enabledwinecrashdialog": EnabledWineCrashDialog, + "disbledwinecrashdialog": DisbledWineCrashDialog, + "disbledWinebottlecreatelink": DisbledWineBottleCreateLink, + "enabledWinebottlecreatelink": EnabledWineBottleCreateLink } # 参数数列表 commandInfo = { + "killall": [1], "installdll": [1], "installfont": [1], "installsparkcorefont": [0], @@ -385,7 +465,16 @@ class Command(): "winver": [0], "changeversion": [1], "stopdll": [1], - "cat": [1] + "cat": [1], + "taskmgr": [0], + "control": [0], + "killallwineserver": [0], + "enabledhttpproxy": [2], + "disbledhttpproxy": [0], + "enabledwinecrashdialog": [0], + "disbledwinecrashdialog": [0], + "disbledWinebottlecreatelink": [0], + "enabledWinebottlecreatelink": [0] } windowsUnrun = [ "createbotton", @@ -432,6 +521,13 @@ class Command(): print("此命令不支持在 Windows 上运行") programEnv[9][1] = "-5" continue + # 获取程序帮助信息 + try: + if i[1] == "--help": + print(helpList[i[0]].replace("\\n", "\n")) + continue + except: + pass # 正常命令解析 if len(i) -1 < self.commandInfo[i[0]][0]: print("参数不足") diff --git a/__pycache__/ConfigLanguareRunner.cpython-37.pyc b/__pycache__/ConfigLanguareRunner.cpython-37.pyc index affb5a6..3230c7e 100644 Binary files a/__pycache__/ConfigLanguareRunner.cpython-37.pyc and b/__pycache__/ConfigLanguareRunner.cpython-37.pyc differ diff --git a/__pycache__/InstallDll.cpython-37.pyc b/__pycache__/InstallDll.cpython-37.pyc index 31351b4..7861fb8 100644 Binary files a/__pycache__/InstallDll.cpython-37.pyc and b/__pycache__/InstallDll.cpython-37.pyc differ diff --git a/mainwindow.py b/mainwindow.py index 79151e8..24bcaac 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ################################################################################################################# # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:2.2.0 -# 更新时间:2022年09月24日 +# 版本:2.3.0 +# 更新时间:2022年10月02日 # 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序 # 基于 Python3 的 PyQt5 构建 ################################################################################################################# @@ -1825,10 +1825,11 @@ updateThingsString = '''※1、自动配置解释器支持 bash 语法(新版 7、支持通过 exe 路径自动生成 Wine 容器路径 8、支持禁用/启用 wine 容器是否生成快捷方式的功能以及启用/禁用程序崩溃提示对话框 9、支持设置 wine 容器代理 +10、自动配置脚本支持使用 --help 参数查看帮助 ''' for i in information["Thank"]: thankText += f"{i}\n" -updateTime = "2022年09月30日" +updateTime = "2022年10月02日" about = f'''

关于

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

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

diff --git a/req/__pycache__/__init__.cpython-37.pyc b/req/__pycache__/__init__.cpython-37.pyc index 68a4567..9c8368c 100644 Binary files a/req/__pycache__/__init__.cpython-37.pyc and b/req/__pycache__/__init__.cpython-37.pyc differ