mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-12-14 02:52:03 +08:00
初步多终端实现
This commit is contained in:
31
Model/__init__.py
Normal file
31
Model/__init__.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import os
|
||||
def OpenTerminal(command):
|
||||
if terminalEnd[terminal][1]:
|
||||
os.system(f"\"{terminal}\" \"{terminalEnd[terminal][0]}\" \"{command}\"")
|
||||
return
|
||||
os.system(f"\"{terminal}\" \"{terminalEnd[terminal][0]}\" {command}")
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
# 对终端的获取
|
||||
# 为什么 openkylin 只有 mate-terminal
|
||||
# 优先为深度终端
|
||||
terminal = ""
|
||||
terminalList = [
|
||||
"deepin-terminal1",
|
||||
"mate-terminal1",
|
||||
"gnome-terminal"
|
||||
]
|
||||
terminalEnd = {
|
||||
f"{programPath}/launch.sh\" \"deepin-terminal": ["-e", 0],
|
||||
"mate-terminal": ["-e", 1],
|
||||
"gnome-terminal": ["--", 0]
|
||||
}
|
||||
for i in terminalList:
|
||||
if not os.system(f"which {i}"):
|
||||
if i == "deepin-terminal":
|
||||
i = f"{programPath}/launch.sh\" \"deepin-terminal"
|
||||
terminal = i
|
||||
break
|
||||
if terminal == "":
|
||||
print("无法识别到以下的任意一个终端")
|
||||
print(" ".join(terminalList))
|
||||
exit()
|
||||
BIN
Model/__pycache__/__init__.cpython-37.pyc
Normal file
BIN
Model/__pycache__/__init__.cpython-37.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user