This commit is contained in:
gfdgd xi 2021-09-11 15:51:23 +08:00
parent 74831ea4c2
commit 8057f2a596
8 changed files with 226 additions and 100 deletions

Binary file not shown.

View File

@ -3,7 +3,7 @@
"https://gitee.com/gfdgd-xi/uengine-runner", "https://gitee.com/gfdgd-xi/uengine-runner",
"https://github.com/gfdgd-xi/uengine-runner" "https://github.com/gfdgd-xi/uengine-runner"
], ],
"Version": "1.4.2", "Version": "1.4.3",
"System": "Linuxdeepin/UOS", "System": "Linuxdeepin/UOS",
"Tips": [ "Tips": [
"更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis", "更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis",

245
main.py
View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi<3025613752@qq.com> # 作者gfdgd xi<3025613752@qq.com>
# 版本1.4.0 # 版本1.4.3
# 更新时间2021年8月26日 # 更新时间2021年9月11日开学了
# 感谢anbox、deepin 和 UOS # 感谢anbox、deepin 和 UOS
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
# 更新actionchen<917981399@qq.com> # 更新actionchen<917981399@qq.com>
@ -99,7 +99,7 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
try: try:
if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())): if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())):
print("Mkdir") print("Mkdir")
os.mkdir("{}/.local/share/applications/uengine/".format(get_home())) os.makedirs("{}/.local/share/applications/uengine/".format(get_home()))
print("start install apk") print("start install apk")
global findApkHistory global findApkHistory
commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path)) commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
@ -454,61 +454,19 @@ def UengineRestart()->"重启 uengine 服务":
os.system("systemctl restart uengine*") os.system("systemctl restart uengine*")
DisabledAndEnbled(False) DisabledAndEnbled(False)
# 运行命令的窗口 def ScrcpyConnectUengine():
class InstallWindow(): if os.path.exists("/snap/bin/scrcpy"):
# 显示窗口 threading.Thread(target=os.system, args=["/snap/bin/scrcpy -s '192.168.250.2:5555'"]).start()
def ShowWindows(command): return
global message if messagebox.askyesno(title="提示", message="你没有安装Scrcpy指使用Snap安装\n如果你使用了其他方法安装了Scrcpy可以输入命令“scrcpy -s '192.168.250.2:5555'”,\n是否现在要使用Snap安装Scrcpy"):
global text if not os.path.exists("/tmp/uengine-runner"):
global installTipsText os.makedirs("/tmp/uengine-runner")
global progressbar write_txt("/tmp/uengine-runner/InstallScrcpy.sh", '''#!/bin/bash
message = tk.Toplevel() sudo apt install snapd -y
message.iconphoto(False, tk.PhotoImage(file=iconPath)) sudo snap refresh
messageFrame = ttk.Frame(message) sudo snap install scrcpy''')
installTipsText = tk.StringVar() threading.Thread(target=InstallWindow.ShowWindows, args=["chmod 777 /tmp/uengine-runner/InstallScrcpy.sh -Rv && pkexec /tmp/uengine-runner/InstallScrcpy.sh"]).start()
message.title("正在操作……") return
installTipsText.set("正在操作……")
installTips = ttk.Label(messageFrame, textvariable=installTipsText)
progressbar = ttk.Progressbar(messageFrame, length=500, mode='indeterminate')
text = tk.Text(messageFrame)
text.config(background="black", foreground="white")
installTips.pack()
progressbar.pack(fill="x")
text.pack(expand='yes', fill='both')
messageFrame.pack(expand='yes', fill='both')
print("Run!")
threading.Thread(target=InstallWindow.RunCommand, args=[command]).start()
message.mainloop()
# 运行命令并显示
def RunCommand(command):
global message
global text
global progressbar
global installTipsText
InstallWindow.AddText("$>" + command + "\n")
progressbar.start()
result = subprocess.getoutput(command)
InstallWindow.AddText(result)
messagebox.showinfo(title="提示", message="操作完毕!")
installTipsText.set("操作完毕!")
message.title("操作完毕!")
progressbar.stop()
progressbar["value"] = 100
# 特意添加!
DisabledAndEnbled(False)
print("Clean!")
if messagebox.askyesno(title="提示", message="清空完毕,将会在重启后生效,是否要重启?"):
print("reboot")
os.system("reboot")
# 添加文本
def AddText(things):
global text
text.configure(state=tk.NORMAL)
text.insert("end", things)
text.configure(state=tk.DISABLED)
# 获取用户桌面目录 # 获取用户桌面目录
def get_desktop_path()->"获取用户桌面目录": def get_desktop_path()->"获取用户桌面目录":
@ -554,7 +512,7 @@ def CleanAllUengineDesktopLink():
if messagebox.askokcancel(title="提示", message="你确定要删除所有的 UEngine 应用快捷方式吗?"): if messagebox.askokcancel(title="提示", message="你确定要删除所有的 UEngine 应用快捷方式吗?"):
try: try:
shutil.rmtree("{}/.local/share/applications/uengine".format(get_home())) shutil.rmtree("{}/.local/share/applications/uengine".format(get_home()))
os.mkdir("{}/.local/share/applications/uengine".format(get_home())) os.makedirs("{}/.local/share/applications/uengine".format(get_home()))
messagebox.showinfo(title="提示", message="删除完毕!") messagebox.showinfo(title="提示", message="删除完毕!")
except: except:
traceback.print_exc() traceback.print_exc()
@ -632,6 +590,124 @@ def AdbAndroidInstallAppList():
subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list package -3"), subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list package -3"),
subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list packages -f"))) subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list packages -f")))
class AdbChangeUengineDisplaySize():
def ShowWindows():
global displayX
global displayY
global displaySize
message = tk.Toplevel()
messageFrame = ttk.Frame(message)
displaySize = tk.StringVar()
displaySize.set("当前 UEngine 屏幕分辨率:正在获取")
displaySizeLabel = ttk.Label(messageFrame, textvariable=displaySize)
input = ttk.Frame(messageFrame)
displayX = ttk.Entry(input)
displayY = ttk.Entry(input)
settingBUtton = ttk.Button(messageFrame, text="设置分辨率", command=AdbChangeUengineDisplaySize.SettingDisplaySize)
message.title("修改 UEngine 分辨率")
message.resizable(0, 0)
message.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height
screen_width = message.winfo_screenwidth()
screen_height = message.winfo_screenheight()
# calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。
winwith=570
winhigh=236
x = (screen_width/2) - (winwith/2)
y = (screen_height/2) - (winhigh/2)
message.geometry("+{}+{}".format(int(x), int(y)))
displayX.grid(row=0, column=0)
displayY.grid(row=0, column=1)
displaySizeLabel.grid(row=0, column=0)
input.grid(row=1, column=0)
settingBUtton.grid(row=2, column=0)
messageFrame.pack()
threading.Thread(target=AdbChangeUengineDisplaySize.GetUengineDisplaySize).start()
message.mainloop()
def GetUengineDisplaySize():
global displaySize
displaySize.set("当前 UEngine 屏幕分辨率:\n" + subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size"))
#displaySize.set(subprocess.getoutput("adb -s '192.168.250.2:5555' shell wm size"))
def SettingDisplaySize():
global displayX
global displayY
try:
int(displayX.get())
int(displayY.get())
except:
messagebox.showerror(title="错误", message="你输入的数值不正确!")
return
os.system("adb -s '192.168.250.2:5555' shell wm size {}x{}".format(displayX.get(), displayY.get()))
AdbChangeUengineDisplaySize.GetUengineDisplaySize()
messagebox.showinfo(title="提示", message="执行完毕!")
# 运行命令的窗口
class InstallWindow():
# 显示窗口
def ShowWindows(command):
global message
global text
global installTipsText
global progressbar
global runCommand
message = tk.Toplevel()
message.iconphoto(False, tk.PhotoImage(file=iconPath))
messageFrame = ttk.Frame(message)
installTipsText = tk.StringVar()
message.title("正在操作……")
installTipsText.set("正在操作……")
installTips = ttk.Label(messageFrame, textvariable=installTipsText)
progressbar = ttk.Progressbar(messageFrame, length=500, mode='indeterminate')
text = tk.Text(messageFrame)
text.config(background="black", foreground="white")
installTips.pack()
progressbar.pack(fill="x")
text.pack(expand='yes', fill='both')
messageFrame.pack(expand='yes', fill='both')
print("Run!")
threading.Thread(target=InstallWindow.RunCommand, args=[command]).start()
message.mainloop()
# 运行命令并显示
def RunCommand(command):
global message
global text
global progressbar
global installTipsText
InstallWindow.AddText("$>" + command + "\n")
progressbar.start()
result = subprocess.getoutput(command)
InstallWindow.AddText(result)
messagebox.showinfo(title="提示", message="操作完毕!")
installTipsText.set("操作完毕!")
message.title("操作完毕!")
progressbar.stop()
progressbar["value"] = 100
# 特意添加!
DisabledAndEnbled(False)
if command == "pkexec rm -rfv /data/uengine":
print("Clean!")
if messagebox.askyesno(title="提示", message="清空完毕,将会在重启后生效,是否要重启?"):
print("reboot")
os.system("reboot")
# 添加文本
def AddText(things):
global text
text.configure(state=tk.NORMAL)
text.insert("end", things)
text.configure(state=tk.DISABLED)
class ShowTextTipsWindow(): class ShowTextTipsWindow():
def ShowWindow(things): def ShowWindow(things):
message = tk.Toplevel() message = tk.Toplevel()
@ -749,6 +825,27 @@ class AddNewUengineDesktopLink():
activityName.set(GetApkActivityName(path)) activityName.set(GetApkActivityName(path))
write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
def UseProgram():
global useProgram
useProgram = '''1、UEngine{}
2python3{}
3tkinter{}
4aapt{}
5dpkg{}
6mkdir{}
7echo
8chmod{}
9adb{}
10deepin 终端{}'''.format(subprocess.getoutput("uengine version"),
subprocess.getoutput("python3 --version"),
tk.TkVersion,
subprocess.getoutput("aapt version"),
subprocess.getoutput("dpkg --version"),
subprocess.getoutput("mkdir --version"),
subprocess.getoutput("chmod --version"),
subprocess.getoutput("adb version"),
subprocess.getoutput("deepin-terminal -v"))
########################### ###########################
# 程序信息 # 程序信息
########################### ###########################
@ -776,33 +873,16 @@ iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = programPath + "/UengineAndroidProgramList.desktop" desktop = programPath + "/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop" desktopName = "UengineAndroidProgramList.desktop"
contribute = "\n".join(information["Contribute"]) contribute = "\n".join(information["Contribute"])
useProgram = '''1、UEngine{} useProgram = ""
2python3{} threading.Thread(target=UseProgram).start()
3tkinter{}
4aapt{}
5dpkg{}
6mkdir{}
7echo
8chmod{}
9adb{}
10deepin 终端{}'''.format(subprocess.getoutput("uengine version"),
subprocess.getoutput("python3 --version"),
tk.TkVersion,
subprocess.getoutput("aapt version"),
subprocess.getoutput("dpkg --version"),
subprocess.getoutput("mkdir --version"),
subprocess.getoutput("chmod --version"),
subprocess.getoutput("adb version"),
subprocess.getoutput("deepin-terminal -v"))
########################### ###########################
# 加载配置 # 加载配置
########################### ###########################
if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())): if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())):
os.mkdir("{}/.local/share/applications/uengine/".format(get_home())) os.makedirs("{}/.local/share/applications/uengine/".format(get_home()))
if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹 if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
os.mkdir(get_home() + "/.config/uengine-runner") # 创建配置文件夹 os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkHistory.json"): # 如果没有配置文件 if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkHistory.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", json.dumps({})) # 创建配置文件 write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", json.dumps({})) # 创建配置文件
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkNameHistory.json"): # 如果没有配置文件 if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkNameHistory.json"): # 如果没有配置文件
@ -885,6 +965,9 @@ def showhelp():
def ChgAbout(): def ChgAbout():
HelpStr.set(about) HelpStr.set(about)
def ChgDep(): def ChgDep():
if useProgram == "":
BtnZujian.configure(state=tk.DISABLED)
return
HelpStr.set(useProgram) HelpStr.set(useProgram)
def ChgCon(): def ChgCon():
HelpStr.set(contribute) HelpStr.set(contribute)
@ -987,9 +1070,11 @@ adb.add_separator()
adb.add_cascade(label="adb 服务", menu=adbServer) adb.add_cascade(label="adb 服务", menu=adbServer)
adb.add_command(label="显示 adb 连接的设备", command=AdbConnectDeviceShow) adb.add_command(label="显示 adb 连接的设备", command=AdbConnectDeviceShow)
adb.add_separator() adb.add_separator()
adb.add_command(label="adb 修改 UEngine 分辨率", command=AdbChangeUengineDisplaySize.ShowWindows)
adb.add_command(label="adb 查看 UEngine 应用列表", command=AdbAndroidInstallAppList) adb.add_command(label="adb 查看 UEngine 应用列表", command=AdbAndroidInstallAppList)
adb.add_command(label="adb 查看 UEngine 资源使用情况", command=AdbCPUAndRAWShowInTer) adb.add_command(label="adb 查看 UEngine 资源使用情况", command=AdbCPUAndRAWShowInTer)
adb.add_command(label="打开 adb 连接 UEngine 的终端", command=AdbShellShowInTer) adb.add_command(label="打开 adb 连接 UEngine 的终端", command=AdbShellShowInTer)
adb.add_command(label="使用 Scrcpy 连接 UEngine只支持使用snap安装的Scrcpy", command=ScrcpyConnectUengine)
adb.add_separator() adb.add_separator()
adb.add_cascade(label="UEngine 使用 adb", menu=uengineUseAdb) adb.add_cascade(label="UEngine 使用 adb", menu=uengineUseAdb)

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>gfdgd xi</vendor>
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
<action id="com.deepin.pkexec.installscrcpy">
<message>Authentication is required to Install Scrcpy</message>
<message xml:lang="zh_CN">安装 Scrcpy 需要输入密码</message>
<icon_name>preferences-system</icon_name>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/tmp/uengine-runner/InstallScrcpy.sh</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

View File

@ -1,6 +1,6 @@
{ {
"Package": "com.gitee.uengine.runner.spark", "Package": "com.gitee.uengine.runner.spark",
"Update": true, "Update": true,
"Version": "1.4.2", "Version": "1.4.3",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
} }

View File

@ -1,7 +1,7 @@
{ {
"Package": "spark-uengine-runner", "Package": "spark-uengine-runner",
"Update": true, "Update": true,
"Version": "1.4.2", "Version": "1.4.3",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
} }

View File

@ -187,6 +187,7 @@ def DisabledAndEnbled(choose):
userChoose = {True: tk.DISABLED, False: tk.NORMAL} userChoose = {True: tk.DISABLED, False: tk.NORMAL}
a = userChoose[choose] a = userChoose[choose]
combobox1.configure(state=a) combobox1.configure(state=a)
check.configure(state=a)
button2.configure(state=a) button2.configure(state=a)
button3.configure(state=a) button3.configure(state=a)
@ -256,6 +257,7 @@ def GetApkActivityName(apkFilePath):
return line return line
def GetApkPackageName(apkFilePath): def GetApkPackageName(apkFilePath):
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
info = GetApkInformation(apkFilePath) info = GetApkInformation(apkFilePath)
for line in info.split('\n'): for line in info.split('\n'):
if "package:" in line: if "package:" in line:
@ -264,7 +266,10 @@ def GetApkPackageName(apkFilePath):
line = line.replace("name=", "") line = line.replace("name=", "")
line = line.replace("'", "") line = line.replace("'", "")
line = line.replace(" ", "") line = line.replace(" ", "")
return line # 此较为特殊,因为需要判断用户是否要添加前缀
if qianZhui.get() == True:
return "uengine-dc-{}".format(line).lower()
return line.lower()
def GetApkVersion(apkFilePath): def GetApkVersion(apkFilePath):
info = GetApkInformation(apkFilePath) info = GetApkInformation(apkFilePath)
@ -381,7 +386,7 @@ iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
# 加载配置 # 加载配置
########################### ###########################
if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹 if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
os.mkdir(get_home() + "/.config/uengine-runner") # 创建配置文件夹 os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json"): # 如果没有配置文件 if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", json.dumps({})) # 创建配置文件 write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", json.dumps({})) # 创建配置文件
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuild.json"): # 如果没有配置文件 if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuild.json"): # 如果没有配置文件
@ -396,34 +401,40 @@ findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/F
# 窗口创建 # 窗口创建
########################### ###########################
win = tk.Tk() win = tk.Tk()
qianZhui = tk.BooleanVar()
window = ttk.Frame(win) window = ttk.Frame(win)
style = ttkthemes.ThemedStyle(win)
style.set_theme("breeze")
win.attributes('-alpha', 0.5)
win.title(title)
win.resizable(0, 0)
win.iconphoto(False, tk.PhotoImage(file=iconPath))
frame2 = ttk.Frame(window) frame2 = ttk.Frame(window)
label1 = ttk.Label(window, text="要打包的 apk 路径:") label1 = ttk.Label(window, text="要打包的 apk 路径:")
combobox1 = ttk.Combobox(window, width=100) combobox1 = ttk.Combobox(window, width=100)
button2 = ttk.Button(window, text="浏览", command=FindApk) button2 = ttk.Button(window, text="浏览", command=FindApk)
button3 = ttk.Button(frame2, text="打包", command=BuildDeb) button3 = ttk.Button(frame2, text="打包", command=BuildDeb)
check = ttk.Checkbutton(frame2, variable=qianZhui,text="使用前缀“uengine-dc”")
textbox1 = tk.Text(window, width=100) textbox1 = tk.Text(window, width=100)
menu = tk.Menu(window, background="white") # 设置菜单栏 menu = tk.Menu(window, background="white") # 设置菜单栏
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏 programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
menu.add_cascade(label="程序", menu=programmenu) menu.add_cascade(label="程序", menu=programmenu)
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项 programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项
# 设置控件 # 设置控件
combobox1['value'] = findApkHistory combobox1['value'] = findApkHistory
textbox1.configure(state=tk.DISABLED) textbox1.configure(state=tk.DISABLED)
textbox1.config(foreground='white', background='black') textbox1.config(foreground='white', background='black')
# 设置窗口
style = ttkthemes.ThemedStyle(win)
style.set_theme("breeze")
win.attributes('-alpha', 0.5)
win.title(title)
win.resizable(0, 0)
win.iconphoto(False, tk.PhotoImage(file=iconPath))
# #
win.config(menu=menu) # 显示菜单栏 win.config(menu=menu) # 显示菜单栏
label1.grid(row=2, column=0) label1.grid(row=2, column=0)
combobox1.grid(row=2, column=1) combobox1.grid(row=2, column=1)
#button1.grid(column=0, row=0)
button2.grid(row=2, column=2) button2.grid(row=2, column=2)
button3.grid(row=0, column=0) button3.grid(row=0, column=1)
check.grid(row=0, column=0)
frame2.grid(row=3, columnspa=3) frame2.grid(row=3, columnspa=3)
textbox1.grid(row=4, columnspa=3) textbox1.grid(row=4, columnspa=3)
window.pack() window.pack()

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.4.2 # 版本1.4.3
# 更新时间2021年8月30 # 更新时间2021年9月11
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -11,6 +11,7 @@
# 引入所需的库 # 引入所需的库
################# #################
import os import os
import threading
import time import time
import json import json
import ttkthemes import ttkthemes
@ -52,7 +53,16 @@ iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop" desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop" desktopName = "UengineAndroidProgramList.desktop"
contribute = "\n".join(information["Contribute"]) contribute = "\n".join(information["Contribute"])
useProgram = '''1、UEngine{} useProgram = ""
threading.Thread(target=useProgram).start()
# add sub window
#添加窗口开启关闭开关,防止重复开启
windowflag = "close"
def UseProgram():
global useProgram
useProgram = '''1、UEngine{}
2、python3{} 2、python3{}
3、tkinter{} 3、tkinter{}
4、aapt{} 4、aapt{}
@ -71,10 +81,6 @@ useProgram = '''1、UEngine{}
subprocess.getoutput("adb version"), subprocess.getoutput("adb version"),
subprocess.getoutput("deepin-terminal -v")) subprocess.getoutput("deepin-terminal -v"))
# add sub window
#添加窗口开启关闭开关,防止重复开启
windowflag = "close"
def showhelp(): def showhelp():
#define window and frame and button label #define window and frame and button label
@ -127,6 +133,9 @@ def showhelp():
def ChgAbout(): def ChgAbout():
HelpStr.set(about) HelpStr.set(about)
def ChgDep(): def ChgDep():
if useProgram == "":
BtnZujian.configure(state=tk.DISABLED)
return
HelpStr.set(useProgram) HelpStr.set(useProgram)
def ChgCon(): def ChgCon():
HelpStr.set(contribute) HelpStr.set(contribute)