更新自动配置脚本命令

This commit is contained in:
gfdgd xi 2022-10-02 21:59:53 +08:00
parent 0e6883d927
commit f8678cea12
15 changed files with 250 additions and 8 deletions

View File

@ -64,7 +64,7 @@ class Connect:
return return
# 判断版本以启动对应的解释器 # 判断版本以启动对应的解释器
# 做到新旧兼容 # 做到新旧兼容
if "$(" in things: if "($" in things:
print("a") print("a")
OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/ConfigLanguareRunner.py' '/tmp/wine-runner-auto-config.wsh' --system") 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() 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}/ConfigLanguareRunner.py' '{path[0]}' --system")
# 执行脚本 # 执行脚本
OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/AutoShell/main.py' '{path[0]}'") OpenTerminal(f"env WINE='{wine}' WINEPREFIX='{wineprefix}' '{programPath}/AutoShell/main.py' '{path[0]}'")

View File

@ -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"))

View File

@ -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"))

View File

@ -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"))

View File

@ -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"))

View File

@ -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"))

View File

@ -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"))

View File

@ -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"))

13
AutoShell/command/taskmgr Executable file
View File

@ -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"))

View File

@ -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参数介绍无"
}

View File

@ -13,6 +13,7 @@ import time
import json import json
import platform import platform
import traceback import traceback
import subprocess
import PyQt5.QtWidgets as QtWidgets import PyQt5.QtWidgets as QtWidgets
# 读取文本文档 # 读取文本文档
def readtxt(path): 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")) information = json.loads(readtxt(f"{programPath}/information.json"))
version = information["Version"] version = information["Version"]
thankText = "" thankText = ""
helpList = json.loads(readtxt(f"{programPath}/ConfigLanguareRunner-help.json"))
for i in information["Thank"]: for i in information["Thank"]:
thankText += f"{i}\n" thankText += f"{i}\n"
programEnv = [ programEnv = [
@ -97,7 +99,17 @@ class Command():
"winver", "winver",
"changeversion", "changeversion",
"stopdll", "stopdll",
"cat" "cat",
"taskmgr",
"control",
"killall",
"killallwineserver",
"enabledhttpproxy",
"disbledhttpproxy",
"enabledwinecrashdialog",
"disbledwinecrashdialog",
"disbledWinebottlecreatelink",
"enabledWinebottlecreatelink"
] ]
def __init__(self, commandString: str) -> None: def __init__(self, commandString: str) -> None:
@ -321,6 +333,64 @@ class Command():
print("文件读取错误") print("文件读取错误")
Debug() 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 = { commandList = {
@ -352,11 +422,21 @@ class Command():
"winver": Winver, "winver": Winver,
"changeversion": ChangeVersion, "changeversion": ChangeVersion,
"stopdll": StopDll, "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 = { commandInfo = {
"killall": [1],
"installdll": [1], "installdll": [1],
"installfont": [1], "installfont": [1],
"installsparkcorefont": [0], "installsparkcorefont": [0],
@ -385,7 +465,16 @@ class Command():
"winver": [0], "winver": [0],
"changeversion": [1], "changeversion": [1],
"stopdll": [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 = [ windowsUnrun = [
"createbotton", "createbotton",
@ -432,6 +521,13 @@ class Command():
print("此命令不支持在 Windows 上运行") print("此命令不支持在 Windows 上运行")
programEnv[9][1] = "-5" programEnv[9][1] = "-5"
continue 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]: if len(i) -1 < self.commandInfo[i[0]][0]:
print("参数不足") print("参数不足")

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
################################################################################################################# #################################################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢 # 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本2.2.0 # 版本2.3.0
# 更新时间2022年09月24 # 更新时间2022年10月02日
# 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序 # 感谢:感谢 wine、deepin-wine 以及星火团队,提供了 wine、deepin-wine、spark-wine-devel 给大家使用,让我能做这个程序
# 基于 Python3 的 PyQt5 构建 # 基于 Python3 的 PyQt5 构建
################################################################################################################# #################################################################################################################
@ -1825,10 +1825,11 @@ updateThingsString = '''※1、自动配置解释器支持 bash 语法(新版
7支持通过 exe 路径自动生成 Wine 容器路径 7支持通过 exe 路径自动生成 Wine 容器路径
8支持禁用/启用 wine 容器是否生成快捷方式的功能以及启用/禁用程序崩溃提示对话框 8支持禁用/启用 wine 容器是否生成快捷方式的功能以及启用/禁用程序崩溃提示对话框
9支持设置 wine 容器代理 9支持设置 wine 容器代理
10自动配置脚本支持使用 --help 参数查看帮助
''' '''
for i in information["Thank"]: for i in information["Thank"]:
thankText += f"{i}\n" thankText += f"{i}\n"
updateTime = "2022年0930日" updateTime = "2022年10月02"
about = f'''<h1>关于</h1> about = f'''<h1>关于</h1>
<p>一个能让Linux用户更加方便运行Windows应用的程序内置了对wine图形化的支持和各种Wine工具和自制Wine程序打包器运行库安装工具等等</p> <p>一个能让Linux用户更加方便运行Windows应用的程序内置了对wine图形化的支持和各种Wine工具和自制Wine程序打包器运行库安装工具等等</p>
<p>同时也内置了基于VirtualBox制作的小白Windows虚拟机安装工具可以做到只需要用户下载系统镜像并点击安装即可无需顾及虚拟机安装创建虚拟机的分区等等</p> <p>同时也内置了基于VirtualBox制作的小白Windows虚拟机安装工具可以做到只需要用户下载系统镜像并点击安装即可无需顾及虚拟机安装创建虚拟机的分区等等</p>