uengine-runner/main.py

1290 lines
59 KiB
Python
Raw Normal View History

2021-05-29 22:54:59 +08:00
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
2021-08-08 22:02:43 +08:00
# 作者gfdgd xi<3025613752@qq.com>
2021-12-12 11:28:22 +08:00
# 版本1.5.3
# 更新时间2021年12月12日DDUC11了
2021-07-11 14:45:11 +08:00
# 感谢anbox、deepin 和 UOS
2021-05-29 22:54:59 +08:00
# 基于 Python3 的 tkinter 构建
2021-09-20 21:58:32 +08:00
# 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>
2021-05-29 22:54:59 +08:00
###########################################################################################
#################
# 引入所需的库
#################
import os
import sys
import time
import json
import shutil
2021-06-06 11:54:38 +08:00
import zipfile
2021-05-29 22:54:59 +08:00
import traceback
import threading
2021-08-08 22:02:43 +08:00
import ttkthemes
2021-05-29 22:54:59 +08:00
import webbrowser
import subprocess
2021-09-26 20:16:29 +08:00
import PIL.Image as Image
import PIL.ImageTk as ImageTk
2021-05-29 22:54:59 +08:00
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog
2021-08-18 21:54:28 +08:00
import tkinter.simpledialog as simpledialog
from getxmlimg import getsavexml
2021-08-30 17:49:12 +08:00
2021-05-29 22:54:59 +08:00
2021-07-11 14:45:11 +08:00
# 卸载程序
def UninstallProgram(package: "apk 包名")->"卸载程序":
try:
2021-12-12 12:33:21 +08:00
global fineUninstallApkHistory
2021-07-11 14:45:11 +08:00
Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package))
2021-12-12 12:33:21 +08:00
print(Return)
2021-07-11 14:45:11 +08:00
if os.path.exists("{}/.local/share/applications/{}.desktop".format(get_home(), package)):
os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package))
if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)):
os.remove("{}/{}.desktop".format(get_desktop_path(), package))
2021-09-26 20:16:29 +08:00
findApkHistory.append(ComboInstallPath.get())
ComboInstallPath['value'] = findApkHistory
write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
messagebox.showinfo(message="操作执行完毕!", title="提示")
DisabledAndEnbled(False)
2021-07-11 14:45:11 +08:00
return Return
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
2021-09-26 20:16:29 +08:00
DisabledAndEnbled(False)
2021-05-29 22:54:59 +08:00
2021-08-19 14:08:05 +08:00
# 卸载文本框的浏览按钮事件
2021-09-26 20:16:29 +08:00
#def BtnFindUninstallApkClk():
# path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApk.json"))["path"])
# if path != "" and path != "()":
# try:
# ComboUninstallPath.set(path)
# write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
# except:
# pass
2021-05-29 22:54:59 +08:00
2021-08-19 14:08:05 +08:00
# 卸载按钮事件
2021-07-02 20:05:01 +08:00
def ButtonClick8():
2021-09-26 20:16:29 +08:00
if ComboInstallPath.get() is "":
2021-07-02 20:38:34 +08:00
messagebox.showerror(title="提示", message="信息没有填写完整,无法继续卸载 APK")
return
2021-07-02 20:05:01 +08:00
DisabledAndEnbled(True)
2021-09-26 20:16:29 +08:00
if os.path.exists(ComboInstallPath.get()):
path = GetApkPackageName(ComboInstallPath.get())
2021-07-02 20:05:01 +08:00
else:
2021-09-26 20:16:29 +08:00
path = ComboInstallPath.get()
threading.Thread(target=UninstallProgram, args=[path]).start()
2021-05-29 22:54:59 +08:00
2021-07-11 14:45:11 +08:00
# 浏览窗口
temppath=""
2021-07-11 14:45:11 +08:00
def FindApk()->"浏览窗口":
2021-05-29 22:54:59 +08:00
path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApk.json"))["path"])
global temppath
temppath = path
print("apk path is find:" + path)
2021-05-29 22:54:59 +08:00
if path != "" and path != "()":
try:
ComboInstallPath.set(path)
2021-05-29 22:54:59 +08:00
write_txt(get_home() + "/.config/uengine-runner/FindApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
except:
pass
2021-08-19 14:08:05 +08:00
# 安装按钮事件
2021-05-29 22:54:59 +08:00
def Button3Install():
2021-10-03 20:34:07 +08:00
if ComboInstallPath.get() is "" or not os.path.exists(ComboInstallPath.get()):
messagebox.showerror(title="提示", message="信息没有填写完整或错误,无法继续安装 APK")
2021-05-29 22:54:59 +08:00
return
DisabledAndEnbled(True)
threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start()
2021-05-29 22:54:59 +08:00
2021-07-11 14:45:11 +08:00
# 安装应用
def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
try:
2021-08-15 21:46:48 +08:00
if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())):
print("Mkdir")
2021-09-11 15:51:23 +08:00
os.makedirs("{}/.local/share/applications/uengine/".format(get_home()))
print("start install apk")
2021-07-11 14:45:11 +08:00
global findApkHistory
print("start install apk12")
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path))
tempstr1 = iconSavePath
print("start install apk1")
iconSaveDir = os.path.dirname(iconSavePath)
if not os.path.exists(iconSaveDir):
2021-12-12 11:28:22 +08:00
os.makedirs(iconSaveDir,exist_ok=True)
2021-07-11 14:45:11 +08:00
SaveApkIcon(path, iconSavePath)
print("start install apk2")
2021-07-11 14:45:11 +08:00
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
"{}/{}.desktop".format(get_desktop_path(), GetApkPackageName(path)))
print("start install apk3")
2021-07-11 14:45:11 +08:00
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
2021-08-15 21:46:48 +08:00
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path)))
2021-12-12 11:28:22 +08:00
commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
print(commandReturn)
print("\nprint install complete")
2021-07-11 14:45:11 +08:00
if quit:
print(commandReturn)
return
messagebox.showinfo(title="提示", message="操作完成!")
findApkHistory.append(ComboInstallPath.get())
ComboInstallPath['value'] = findApkHistory
2021-07-11 14:45:11 +08:00
write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
2021-05-29 22:54:59 +08:00
DisabledAndEnbled(False)
2021-07-11 14:45:11 +08:00
# 禁用或启动所有控件
def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控件":
2021-05-29 22:54:59 +08:00
userChoose = {True: tk.DISABLED, False: tk.NORMAL}
a = userChoose[choose]
ComboInstallPath.configure(state=a)
2021-09-26 20:16:29 +08:00
#ComboUninstallPath.configure(state=a)
BtnFindApk.configure(state=a)
BtnInstall.configure(state=a)
BtnShowUengineApp.configure(state=a)
2021-09-26 20:16:29 +08:00
#BtnUninstallApkBrowser.configure(state=a)
BtnUninstall.configure(state=a)
2021-08-08 22:02:43 +08:00
Btngeticon.configure(state=a)
2021-08-18 21:54:28 +08:00
BtnSaveApk.configure(state=a)
2021-09-26 20:16:29 +08:00
BtnApkInformation.configure(state=a)
LabApkPath.configure(state=a)
2021-05-29 22:54:59 +08:00
# 需引入 subprocess
2021-07-11 14:45:11 +08:00
# 运行系统命令并获取返回值
def GetCommandReturn(cmd: "命令")->"运行系统命令并获取返回值":
2021-05-29 22:54:59 +08:00
# cmd 是要获取输出的命令
return subprocess.getoutput(cmd)
def GetSystemVersion():
systemInformation = readtxt("/etc/os-release")
for systemInformation in systemInformation.split('\n'):
if "PRETTY_NAME=" in systemInformation:
return systemInformation.replace("PRETTY_NAME=", "").replace('"', '')
2021-08-19 14:08:05 +08:00
# 打开所有窗口事件
2021-05-29 22:54:59 +08:00
def Button5Click():
threading.Thread(target=OpenUengineProgramList).start()
2021-07-11 14:45:11 +08:00
# 打开“uengine 所有程序列表”
def OpenUengineProgramList()->"打开“uengine 所有程序列表”":
os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity")
2021-05-29 22:54:59 +08:00
# 显示“提示”窗口
2021-07-11 14:45:11 +08:00
def helps()->"显示“提示”窗口":
2021-05-29 22:54:59 +08:00
global tips
messagebox.showinfo(title="提示", message=tips)
# 显示更新内容窗口
2021-07-11 14:45:11 +08:00
def UpdateThings()->"显示更新内容窗口":
2021-05-29 22:54:59 +08:00
messagebox.showinfo(title="更新内容", message=updateThings)
# 打开程序官网
2021-07-11 14:45:11 +08:00
def OpenProgramURL()->"打开程序官网":
2021-05-29 22:54:59 +08:00
webbrowser.open_new_tab(programUrl)
# 重启本应用程序
2021-07-11 14:45:11 +08:00
def ReStartProgram()->"重启本应用程序":
2021-05-29 22:54:59 +08:00
python = sys.executable
os.execl(python, python, * sys.argv)
2021-07-11 14:45:11 +08:00
# 清理历史记录
def CleanProgramHistory()->"清理历史记录":
2021-05-29 22:54:59 +08:00
try:
if messagebox.askokcancel(title="警告", message="删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。"):
shutil.rmtree(get_home() + "/.config/uengine-runner")
ReStartProgram()
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
# 获取用户主目录
2021-07-11 14:45:11 +08:00
def get_home()->"获取用户主目录":
2021-05-29 22:54:59 +08:00
return os.path.expanduser('~')
2021-09-20 17:10:05 +08:00
# 获取当前语言
def get_now_lang()->"获取当前语言":
return os.getenv('LANG')
2021-07-11 14:45:11 +08:00
# 发送“启动 uengine 所有程序”的 .desktop 文件到桌面
def SendUengineAndroidListForDesktop()->"发送“启动 uengine 所有程序”的 .desktop 文件到桌面":
2021-05-29 22:54:59 +08:00
global desktop
global desktopName
DisabledAndEnbled(True)
try:
if os.path.exists("{}/{}".format(get_desktop_path(), desktopName)):
if not messagebox.askokcancel(title="提示", message="桌面已经存在快捷方式,你确定要覆盖吗?"):
DisabledAndEnbled(False)
return
shutil.copy(desktop, get_desktop_path())
messagebox.showinfo(title="提示", message="发送成功!")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
DisabledAndEnbled(False)
# 获取用户桌面目录
2021-07-11 14:45:11 +08:00
def get_desktop_path()->"获取用户桌面目录":
2021-05-29 22:54:59 +08:00
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 # 返回目录
2021-07-11 14:45:11 +08:00
# 发送“启动 uengine 所有程序”的 .desktop 文件到启动器
def SendUengineAndroidListForLauncher()->"发送“启动 uengine 所有程序”的 .desktop 文件到启动器":
2021-05-29 22:54:59 +08:00
DisabledAndEnbled(True)
try:
if os.path.exists("{}/.local/share/applications/{}".format(get_home(), desktopName)):
if not messagebox.askokcancel(title="提示", message="启动器已经存在快捷方式,你确定要覆盖吗?"):
DisabledAndEnbled(False)
return
if not os.path.exists("{}/.local/share/applications/".format(get_home())):
os.makedirs("{}/.local/share/applications/".format(get_home()))
shutil.copy(desktop, "{}/.local/share/applications/{}".format(get_home(), desktopName))
os.system("chmod 755 {}/.local/share/applications/{}".format(get_home(), desktopName))
messagebox.showinfo(title="提示", message="发送成功!")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
DisabledAndEnbled(False)
# 数组转字典
2021-07-11 14:45:11 +08:00
def ListToDictionary(list: "需要转换的数组")->"数组转字典":
2021-05-29 22:54:59 +08:00
dictionary = {}
for i in range(len(list)):
dictionary[i] = list[i]
return dictionary
# 读取文本文档
2021-07-11 14:45:11 +08:00
def readtxt(path: "路径")->"读取文本文档":
2021-05-29 22:54:59 +08:00
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
# 写入文本文档
2021-07-11 14:45:11 +08:00
def write_txt(path: "路径", things: "内容")->"写入文本文档":
TxtDir = os.path.dirname(path)
print(TxtDir)
if not os.path.exists(TxtDir):
os.makedirs(TxtDir,exist_ok=True)
2021-05-29 22:54:59 +08:00
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
2021-07-11 14:45:11 +08:00
# 获取 aapt 的所有信息
def GetApkInformation(apkFilePath: "apk 所在路径")->"获取 aapt 的所有信息":
2021-06-06 11:54:38 +08:00
return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath))
2021-07-11 14:45:11 +08:00
# 获取 apk Activity
def GetApkActivityName(apkFilePath: "apk 所在路径")->"获取 apk Activity":
2021-06-06 11:54:38 +08:00
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "launchable-activity" in line:
line = line[0: line.index("label='")]
line = line.replace("launchable-activity: ", "")
line = line.replace("'", "")
line = line.replace(" ", "")
line = line.replace("name=", "")
line = line.replace("label=", "")
line = line.replace("icon=", "")
return line
2021-07-11 14:45:11 +08:00
# 获取 apk 包名
def GetApkPackageName(apkFilePath: "apk 所在路径")->"获取 apk 包名":
2021-06-06 11:54:38 +08:00
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "package:" in line:
line = line[0: line.index("versionCode='")]
line = line.replace("package:", "")
line = line.replace("name=", "")
line = line.replace("'", "")
line = line.replace(" ", "")
return line
2021-11-28 16:11:01 +08:00
def InstallRootUengineImage():
if not os.path.exists:
os.mkdir("/tmp/uengine-runner")
write_txt("/tmp/uengine-runner/install.sh", "sudo dpkg -i /tmp/uengine-runner/u*.deb\nsudo apt install -f")
threading.Thread(target=os.system, args=["deepin-terminal -C \"wget -P '/tmp/uengine-runner' 'https://hub.fastgit.org/gfdgd-xi/uengine-runner/releases/download/U1.1.14/uengine-android-image_1.1.14_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'\""]).start()
def BuildRootUengineImage():
threading.Thread(target=os.system, args=["deepin-terminal -C \"bash '{}'\"".format(programPath + "/root-uengine.sh")]).start()
def ReinstallUengineImage():
threading.Thread(target=os.system, args=["deepin-terminal -e ''pkexec apt reinstall uengine-android-image"]).start()
2021-07-11 14:45:11 +08:00
# 生成 uengine 启动文件到桌面
def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径")->"生成 uengine 启动文件到桌面":
things = '''[Desktop Entry]
2021-06-06 11:54:38 +08:00
Categories=app;
Encoding=UTF-8
Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={}
2021-06-06 11:54:38 +08:00
GenericName={}
Icon={}
MimeType=
Name={}
StartupWMClass={}
Terminal=false
Type=Application
'''.format(packageName, activityName, showName, iconPath, showName, showName)
write_txt(savePath, things)
2021-07-11 14:45:11 +08:00
# 获取软件的中文名称
def GetApkChineseLabel(apkFilePath)->"获取软件的中文名称":
2021-06-06 11:54:38 +08:00
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "application-label:" in line:
line = line.replace("application-label:", "")
line = line.replace("'", "")
return line
2021-08-19 14:08:05 +08:00
# 保存apk图标
def SaveApkIcon(apkFilePath, iconSavePath)->"保存 apk 文件的图标":
2021-08-12 15:12:13 +08:00
try:
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "application:" in line:
xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'","")
if xmlpath.endswith('.xml'):
xmlsave = getsavexml()
print(xmlpath)
xmlsave.savexml(apkFilePath,xmlpath,iconSavePath)
else:
zip = zipfile.ZipFile(apkFilePath)
iconData = zip.read(xmlpath)
with open(iconSavePath, 'w+b') as saveIconFile:
saveIconFile.write(iconData)
except:
traceback.print_exc()
print("Error, show defult icon")
shutil.copy(programPath + "/defult.png", iconSavePath)
def saveicon():
global temppath
global tempstr1
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(temppath))
print(iconSavePath+"iconpaths")
SaveApkIcon(temppath, iconSavePath)
2021-08-26 15:24:26 +08:00
def KeyboardToMouse():
threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-keyboard".format(programPath)]).start()
2021-08-19 14:08:05 +08:00
# 用户自行保存APK
2021-08-08 22:02:43 +08:00
def SaveIconToOtherPath():
apkPath = ComboInstallPath.get()
if apkPath == "":
messagebox.showerror(title="错误", message="你没有选择 apk 文件")
return
path = filedialog.asksaveasfilename(title="保存图标", filetypes=[("PNG 图片", "*.png"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApkIcon.json"))["path"])
if not path == "":
try:
SaveApkIcon(apkPath, path)
except:
traceback.print_exc()
messagebox.showerror(title="错误", message="本程序不支持保存该 apk 的图标")
return
write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
findApkHistory.append(ComboInstallPath.get())
ComboInstallPath['value'] = findApkHistory
write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
messagebox.showinfo(title="提示", message="保存成功!")
2021-08-19 14:08:05 +08:00
# 清空 uengine 数据
2021-08-15 21:46:48 +08:00
def BackUengineClean()->"清空 uengine 数据":
print("Choose")
if messagebox.askokcancel(title="警告", message="清空后数据将会完全丢失,确定要继续吗?"):
DisabledAndEnbled(True)
try:
if os.path.exists("{}/.local/share/applications/uengine/".format(get_home())):
shutil.rmtree("{}/.local/share/applications/uengine/".format(get_home()))
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
InstallWindow.ShowWindows("pkexec rm -rfv /data/uengine")
return
print("Choose False")
2021-08-19 14:08:05 +08:00
# 启用 uengine 网络桥接
def UengineBridgeStart()->"启用 uengine 网络桥接":
2021-08-15 21:46:48 +08:00
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh start")
DisabledAndEnbled(False)
2021-08-19 14:08:05 +08:00
# 关闭 uengine 网络桥接
def UengineBridgeStop()->"关闭 uengine 网络桥接":
2021-08-15 21:46:48 +08:00
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh stop")
DisabledAndEnbled(False)
2021-08-19 14:08:05 +08:00
# 重启 uengine 网络桥接
def UengineBridgeRestart()->"重启 uengine 网络桥接":
2021-08-15 21:46:48 +08:00
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh restart")
DisabledAndEnbled(False)
2021-08-19 14:08:05 +08:00
# 加载 uengine 网络桥接
def UengineBridgeReload()->"加载 uengine 网络桥接":
2021-08-15 21:46:48 +08:00
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh reload")
DisabledAndEnbled(False)
2021-08-19 14:08:05 +08:00
# 强制加载 uengine 网络桥接
def UengineBridgeForceReload()->"强制加载 uengine 网络桥接":
2021-08-15 21:46:48 +08:00
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh force-reload")
DisabledAndEnbled(False)
2021-08-19 14:08:05 +08:00
# 启用 uengine 服务
def StartUengine()->"启用 uengine 服务":
DisabledAndEnbled(True)
os.system("systemctl enable uengine-container uengine-session && systemctl start uengine-container uengine-session")
DisabledAndEnbled(False)
2021-08-19 14:08:05 +08:00
# 关闭 uengine 服务
def StopUengine()->"关闭 uengine 服务":
DisabledAndEnbled(True)
os.system("systemctl disable uengine-container uengine-session")
DisabledAndEnbled(False)
2021-08-19 14:08:05 +08:00
# 重启 uengine 服务
def UengineRestart()->"重启 uengine 服务":
DisabledAndEnbled(True)
os.system("systemctl restart uengine*")
DisabledAndEnbled(False)
2021-09-11 15:51:23 +08:00
def ScrcpyConnectUengine():
if os.path.exists("/snap/bin/scrcpy"):
threading.Thread(target=os.system, args=["/snap/bin/scrcpy -s '192.168.250.2:5555'"]).start()
return
if messagebox.askyesno(title="提示", message="你没有安装Scrcpy指使用Snap安装\n如果你使用了其他方法安装了Scrcpy可以输入命令“scrcpy -s '192.168.250.2:5555'”,\n是否现在要使用Snap安装Scrcpy"):
if not os.path.exists("/tmp/uengine-runner"):
os.makedirs("/tmp/uengine-runner")
write_txt("/tmp/uengine-runner/InstallScrcpy.sh", '''#!/bin/bash
sudo apt install snapd -y
sudo snap refresh
sudo snap install scrcpy''')
threading.Thread(target=InstallWindow.ShowWindows, args=["chmod 777 /tmp/uengine-runner/InstallScrcpy.sh -Rv && pkexec /tmp/uengine-runner/InstallScrcpy.sh"]).start()
return
2021-06-06 11:54:38 +08:00
# 获取用户桌面目录
2021-07-11 14:45:11 +08:00
def get_desktop_path()->"获取用户桌面目录":
2021-06-06 11:54:38 +08:00
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 # 返回目录
2021-08-19 14:08:05 +08:00
# 提取已安装程序的apk
2021-08-18 21:54:28 +08:00
def SaveInstallUengineApp():
while True:
result = simpledialog.askstring(title="输入apk包名", prompt="请输入要获取的apk包名以便进行下一步操作")
if result == "" or result == None:
return
if os.path.exists("/data/uengine/data/data/app/{}-1".format(result)):
break
messagebox.showerror(title="错误", message="路径不存在,请重试!")
path = filedialog.asksaveasfilename(title="保存apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApk.json"))["path"])
if path == "" or path == ():
return
try:
shutil.copy("/data/uengine/data/data/app/{}-1/base.apk".format(result), path)
write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": os.path.dirname(path)}))
messagebox.showinfo(title="提示", message="提取完成!")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
2021-10-03 20:34:07 +08:00
def UengineCheckCpu():
english = GetCommandReturn("uengine check-features")
2021-10-05 18:16:50 +08:00
messagebox.showinfo(title="提示", message="{}".format(english))
2021-10-03 20:34:07 +08:00
2021-06-06 11:54:38 +08:00
# 获取用户主目录
2021-07-11 14:45:11 +08:00
def get_home()->"获取用户主目录":
2021-06-06 11:54:38 +08:00
return os.path.expanduser('~')
2021-07-11 14:45:11 +08:00
2021-08-19 14:08:05 +08:00
# 删除所有的 uengine 应用快捷方式
2021-08-18 21:54:28 +08:00
def CleanAllUengineDesktopLink():
2021-08-30 17:49:12 +08:00
if messagebox.askokcancel(title="提示", message="你确定要删除所有的 UEngine 应用快捷方式吗?"):
2021-08-18 21:54:28 +08:00
try:
shutil.rmtree("{}/.local/share/applications/uengine".format(get_home()))
2021-09-11 15:51:23 +08:00
os.makedirs("{}/.local/share/applications/uengine".format(get_home()))
2021-08-18 21:54:28 +08:00
messagebox.showinfo(title="提示", message="删除完毕!")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
2021-08-19 14:08:05 +08:00
# 打开 uengine 应用打包器
def OpenUengineDebBuilder():
threading.Thread(target=os.system, args=[programPath + "/uengine-apk-builder"]).start()
# 打开 uengine 根目录
def OpenUengineRootData():
threading.Thread(target=os.system, args=["xdg-open /data/uengine/data/data"]).start()
# 打开 uengine 用户数据目录
def OpenUengineUserData():
threading.Thread(target=os.system, args=["xdg-open ~/安卓应用文件"]).start()
2021-08-30 17:49:12 +08:00
# 终端显示 adb 命令行
def AdbShellShowInTer():
os.system("adb connect 192.168.250.2:5555")
threading.Thread(target=os.system, args=["deepin-terminal -w ~ -e 'adb -s 192.168.250.2:5555 shell'"]).start()
# 终端显示 adb top
def AdbCPUAndRAWShowInTer():
os.system("adb connect 192.168.250.2:5555")
threading.Thread(target=os.system, args=["deepin-terminal -w ~ -e 'adb -s 192.168.250.2:5555 shell top'"]).start()
def UengineSettingShow():
threading.Thread(target=os.system, args=["/usr/bin/uengine launch --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start()
2021-08-30 17:49:12 +08:00
# 杀死 adb 进程
def AdbKillAdbProgress():
os.system("killall adb")
messagebox.showinfo(title="提示", message="完成!")
# 关闭 adb 服务
def AdbStopServer():
os.system("adb kill-server")
messagebox.showinfo(title="提示", message="完成!")
# 开启 adb 服务
def AdbStartServer():
os.system("adb start-server")
messagebox.showinfo(title="提示", message="完成!")
2021-10-05 18:16:50 +08:00
def ReinstallUengine():
threading.Thread(target=os.system, args=["deepin-terminal -C 'pkexec apt reinstall uengine uengine-android-image uengine-modules-dkms -y && notify-send -i uengine \"安装完毕!\"'"]).start()
def DelUengineCheck():
if not os.path.exists("/usr/share/uengine/uengine-check-runnable.sh"):
messagebox.showinfo(title="提示", message="本功能已经被删除,无法重复删除!")
return
if messagebox.askokcancel(title="警告", message="删除后将无法使用本软件恢复\n如果需要恢复本功能,请重新安装 UEngine"):
threading.Thread(target=InstallWindow.ShowWindows, args=["pkexec rm -v /usr/share/uengine/uengine-check-runnable.sh"]).start()
2021-08-30 17:49:12 +08:00
# 使用 adb 连接 uengine
def UengineConnectAdb():
messagebox.showinfo(title="提示", message=subprocess.getoutput("adb connect 192.168.250.2:5555"))
# 允许用户使用 adb
def UengineUseAdb():
# 因为需要 root所以需要开二号程序
os.system("adb start-server") # 保证有生成文件
os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath, "{}/.android/adbkey.pub".format(get_home()))) # 写入配置
if messagebox.askyesno(title="提示", message="是否要连接到 UEngine"):
UengineConnectAdb()
def UengineDoNotUseAdb():
# 因为需要 root所以需要开二号程序
if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
messagebox.showinfo(title="提示", message="你的 uengine 在设置前已经禁用 adb 连接,无需重复设置")
return
threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 1".format(programPath)]).start()
2021-10-05 18:16:50 +08:00
def UengineRunnerBugUpload():
threading.Thread(target=os.system, args=[programPath + "/uengine-runner-update-bug"]).start()
2021-08-30 17:49:12 +08:00
def AdbConnectDeviceShow():
ShowTextTipsWindow.ShowWindow(subprocess.getoutput("adb devices -l"))
def AdbAndroidInstallAppList():
ShowTextTipsWindow.ShowWindow('''系统应用:
{}
第三方应用
{}
全部应用以及apk所在路径
{}'''.format(subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list packages -s"),
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")))
2021-09-26 20:16:29 +08:00
def GetApkVersion(apkFilePath):
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "package:" in line:
if "compileSdkVersion='" in line:
line = line.replace(line[line.index("compileSdkVersion='"): -1], "")
if "platform" in line:
line = line.replace(line[line.index("platform"): -1], "")
line = line.replace(line[0: line.index("versionName='")], "")
line = line.replace("versionName='", "")
line = line.replace("'", "")
line = line.replace(" ", "")
return line
class ApkInformation():
def ShowWindows():
global fullInformation
global path
global tab1
path = ComboInstallPath.get()
message = tk.Toplevel()
tab = ttk.Notebook(message)
tab1 = ttk.Frame(message)
tab2 = ttk.Frame(message)
fullInformation = tk.Text(tab2)
tab.add(tab1, text="简化版")
tab.add(tab2, text="完整版")
fullInformation.pack(expand="yes", fill="both")
tab.pack(expand="yes", fill="both")
threading.Thread(target=ApkInformation.GetInformation).start()
message.mainloop()
def GetInformation():
# 获取详细信息
fullInformation.configure(state=tk.NORMAL)
fullInformation.insert("1.0", GetApkInformation(path))
fullInformation.configure(state=tk.DISABLED)
# 获取图标
SaveApkIcon(path, "/tmp/uengine-runner-android-app-icon.png")
# 读取图标
image = Image.open("/tmp/uengine-runner-android-app-icon.png")
if image.size[0] + image.size[1] <= 512:
ttk.Label(tab1, image=ImageTk.PhotoImage(image)).pack()
else:
ttk.Label(tab1, image=ImageTk.PhotoImage(image.resize((256, 256), Image.ANTIALIAS))).pack()
2021-09-26 20:16:29 +08:00
info = '''包名:{}
中文名{}
Activity{}
版本{}'''.format(GetApkPackageName(path), GetApkChineseLabel(path), GetApkActivityName(path), GetApkVersion(path))
ttk.Label(tab1, text=info).pack()
2021-09-11 15:51:23 +08:00
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)
2021-08-30 17:49:12 +08:00
class ShowTextTipsWindow():
def ShowWindow(things):
message = tk.Toplevel()
message.title("提示")
message.iconphoto(False, tk.PhotoImage(file=iconPath))
text = tk.Text(message)
quitButton = ttk.Button(message, text="确定", command=message.destroy)
text.insert("end", things)
text.configure(state=tk.DISABLED)
text.pack(fill="both", expand="yes")
quitButton.pack()
message.mainloop()
2021-08-19 14:08:05 +08:00
# 添加/删除 uengine 应用快捷方式
2021-08-18 21:54:28 +08:00
class AddNewUengineDesktopLink():
addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity
注意如果是要删除只要输入包名即可'''
def ShowWindow():
global activityName
global packageName
message = tk.Toplevel()
tipsLabel = ttk.Label(message, text=AddNewUengineDesktopLink.addTips)
packageName = ttk.Combobox(message, width=30)
activityName = ttk.Combobox(message, width=30)
findApk = ttk.Button(message, text="浏览", command=AddNewUengineDesktopLink.FindApk)
controlFrame = ttk.Frame(message)
2021-08-19 14:08:05 +08:00
testOpen = ttk.Button(controlFrame, text="打开", command=AddNewUengineDesktopLink.TestOpen)
2021-08-18 21:54:28 +08:00
saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink)
delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink)
2021-08-30 17:49:12 +08:00
message.title("添加/删除 UEngine 图标")
2021-08-18 21:54:28 +08:00
message.resizable(0, 0)
2021-08-30 17:49:12 +08:00
message.iconphoto(False, tk.PhotoImage(file=iconPath))
2021-08-18 21:54:28 +08:00
# 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)))
packageName["value"] = findApkNameHistory
activityName["value"] = findApkActivityHistory
tipsLabel.grid(row=0, column=0, columnspan=3)
packageName.grid(row=1, column=0)
activityName.grid(row=1, column=1)
findApk.grid(row=1, column=2)
controlFrame.grid(row=2, column=0, columnspan=3)
2021-08-19 14:08:05 +08:00
testOpen.grid(row=0, column=0)
saveButton.grid(row=0, column=1)
delButton.grid(row=0, column=2)
2021-08-18 21:54:28 +08:00
message.mainloop()
2021-08-19 14:08:05 +08:00
# 添加快捷方式
2021-08-18 21:54:28 +08:00
def SaveDesktopLink():
2021-12-12 11:28:22 +08:00
try:
if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"):
return
if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())):
os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home()))
global activityName
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get())
shutil.copy(programPath + "/defult.png", iconSavePath)
BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
"{}/{}.desktop".format(get_desktop_path(), packageName.get()))
AddNewUengineDesktopLink.SaveHistory()
messagebox.showinfo(title="提示", message="创建完毕!")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
2021-08-18 21:54:28 +08:00
2021-08-19 14:08:05 +08:00
# 删除快捷方式
2021-08-18 21:54:28 +08:00
def DelDesktopLink():
try:
2021-12-12 11:28:22 +08:00
global packageName
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
return
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return
try:
os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
AddNewUengineDesktopLink.SaveHistory()
messagebox.showinfo(title="提示", message="已删除")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
2021-08-18 21:54:28 +08:00
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
2021-08-19 14:08:05 +08:00
# 保存历史记录
2021-08-18 21:54:28 +08:00
def SaveHistory():
findApkNameHistory.append(packageName.get())
findApkActivityHistory.append(activityName.get())
packageName['value'] = findApkNameHistory
activityName['value'] = findApkActivityHistory
write_txt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json", str(json.dumps(ListToDictionary(findApkNameHistory)))) # 将历史记录的数组转换为字典并写入
write_txt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json", str(json.dumps(ListToDictionary(findApkActivityHistory)))) # 将历史记录的数组转换为字典并写入
2021-08-19 14:08:05 +08:00
# 打开测试
2021-08-19 08:49:50 +08:00
def TestOpen():
threading.Thread(target=os.system, args=["/usr/bin/uengine launch --package={} --component={}".format(packageName.get(), activityName.get())]).start()
2021-08-19 08:49:50 +08:00
AddNewUengineDesktopLink.SaveHistory()
2021-08-19 14:08:05 +08:00
# 浏览文件
2021-08-18 21:54:28 +08:00
def FindApk():
path = filedialog.askopenfilename(title="选择apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkName.json"))["path"])
if path == "" or path == ():
return
packageName.set(GetApkPackageName(path))
activityName.set(str(GetApkActivityName(path)))
2021-08-18 21:54:28 +08:00
write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
2021-09-11 15:51:23 +08:00
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"))
2021-05-29 22:54:59 +08:00
###########################
# 程序信息
###########################
2021-09-20 17:10:05 +08:00
lang = get_now_lang()
2021-08-19 14:08:05 +08:00
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(programPath + "/information.json"))
2021-09-20 17:10:05 +08:00
langFile = json.loads(readtxt(programPath + "/Language.json"))
if not lang in langFile.keys():
lang = "en_US.UTF-8"
2021-08-19 14:08:05 +08:00
programUrl = information["Url"][0]
version = information["Version"]
goodRunSystem = information["System"]
2021-07-11 14:45:11 +08:00
aaptVersion = GetCommandReturn("aapt version")
SystemVersion = GetSystemVersion()
2021-08-30 17:49:12 +08:00
about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器在新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。
版本 {}
适用平台 {}
Tk 版本 :{}
程序官网 {}
2021-11-28 20:47:52 +08:00
系统版本 : {}
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y"))
2021-08-19 14:08:05 +08:00
tips = "\n".join(information["Tips"])
updateThingsString = "\n".join(information["Update"])
2021-09-20 17:10:05 +08:00
title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version)
2021-08-19 14:08:05 +08:00
updateTime = information["Time"]
2021-05-29 22:54:59 +08:00
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
2021-06-06 11:54:38 +08:00
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
2021-08-26 15:24:26 +08:00
desktop = programPath + "/UengineAndroidProgramList.desktop"
2021-05-29 22:54:59 +08:00
desktopName = "UengineAndroidProgramList.desktop"
2021-08-19 14:08:05 +08:00
contribute = "\n".join(information["Contribute"])
2021-09-11 15:51:23 +08:00
useProgram = ""
threading.Thread(target=UseProgram).start()
2021-05-29 22:54:59 +08:00
###########################
# 加载配置
###########################
2021-08-15 21:46:48 +08:00
if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())):
2021-09-11 15:51:23 +08:00
os.makedirs("{}/.local/share/applications/uengine/".format(get_home()))
2021-05-29 22:54:59 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
2021-09-11 15:51:23 +08:00
os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹
2021-05-29 22:54:59 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkHistory.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", json.dumps({})) # 创建配置文件
2021-08-18 21:54:28 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkNameHistory.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json", json.dumps({})) # 创建配置文件
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json", json.dumps({})) # 创建配置文件
2021-06-06 11:54:38 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json", json.dumps({})) # 创建配置文件
2021-08-18 21:54:28 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkName.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
2021-05-29 22:54:59 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApk.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
2021-06-06 11:54:38 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/FindUninstallApk.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
2021-08-08 22:02:43 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApkIcon.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
2021-08-18 21:54:28 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApk.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
2021-05-29 22:54:59 +08:00
###########################
# 设置变量
###########################
findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkHistory.json")).values())
2021-06-06 11:54:38 +08:00
fineUninstallApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json")).values())
2021-08-18 21:54:28 +08:00
findApkNameHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json")).values())
findApkActivityHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json")).values())
2021-06-06 11:54:38 +08:00
# add sub window
#添加窗口开启关闭开关,防止重复开启
windowflag = "close"
def showhelp():
2021-08-08 22:02:43 +08:00
#define window and frame and button label
#
global windowflag
if windowflag == "close":
helpwindow=tk.Toplevel()
helpwindow.resizable(0, 0)
helpwindow.title("帮助")
2021-08-30 17:49:12 +08:00
helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height
screen_width = helpwindow.winfo_screenwidth()
screen_height = helpwindow.winfo_screenheight()
# calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。
2021-08-15 21:46:48 +08:00
winwith=550
winhigh=700
x = (screen_width/2) - (winwith/2)
y = (screen_height/2) - (winhigh/2)
2021-08-15 21:46:48 +08:00
helpwindow.geometry("550x700"+"+{:.0f}+{:.0f}".format(x, y))
style = ttkthemes.ThemedStyle(helpwindow)
style.set_theme("breeze")
Frmroot=ttk.Frame(helpwindow)
FrmMenu = ttk.Frame(Frmroot)
FrmText = ttk.Frame(Frmroot)
LabFrmText=ttk.LabelFrame(FrmText,text="帮助",height=800,borderwidth=3)
HelpStr = tk.StringVar()
HelpStr.set(tips)
2021-08-15 21:46:48 +08:00
LabText = ttk.Label(LabFrmText, textvariable=HelpStr,width=55)
LabText.config(wraplength=350)
def on_closing():
global windowflag
windowflag = "close"
print(windowflag)
helpwindow.destroy()
2021-08-08 22:02:43 +08:00
# define button func
def ChgLog():
HelpStr.set(updateThingsString)
def ChgAbout():
HelpStr.set(about)
def ChgDep():
2021-09-11 15:51:23 +08:00
if useProgram == "":
BtnZujian.configure(state=tk.DISABLED)
return
HelpStr.set(useProgram)
2021-08-08 22:02:43 +08:00
def ChgCon():
HelpStr.set(contribute)
def ChgTips():
HelpStr.set(tips)
LabText.config(wraplength=350)
BtnReadme = ttk.Button(FrmMenu, text="使用说明",width=14,command=ChgTips)
BtnLog = ttk.Button(FrmMenu, text="更新内容",width=14,command=ChgLog)
BtnZujian = ttk.Button(FrmMenu, text="程序依赖的组件",width=14,command=ChgDep)
2021-08-08 22:02:43 +08:00
BtnGongxian = ttk.Button(FrmMenu, text="有贡献的开发者",width=14,command=ChgCon)
BtnAbout = ttk.Button(FrmMenu, text="关于",width=14,command=ChgAbout)
2021-08-08 22:02:43 +08:00
#layout
FrmMenu.grid(row=0,column=0,sticky=tk.NW)
BtnReadme.grid(row=0,column=0,sticky=tk.NW,padx=3)
BtnLog.grid(row=1,column=0,sticky=tk.NW,padx=3)
BtnZujian.grid(row=2,column=0,sticky=tk.NW,padx=3)
2021-08-08 22:02:43 +08:00
BtnGongxian.grid(row=3,column=0,sticky=tk.NW,padx=3)
BtnAbout.grid(row=4,column=0,sticky=tk.NW,padx=3)
FrmText.grid(row=0,column=1,sticky=tk.NW)
LabFrmText.grid(row=0,column=0,sticky=tk.NW,padx=3,pady=3)
LabText.grid(row=0,column=0,sticky=tk.NW)
Frmroot.pack()
windowflag = "open"
print(windowflag)
#helpwindow.mainloop()
helpwindow.protocol("WM_DELETE_WINDOW", on_closing)
2021-05-29 22:54:59 +08:00
###########################
# 窗口创建
###########################
2021-07-11 14:45:11 +08:00
win = tk.Tk() # 创建窗口
2021-07-11 14:45:11 +08:00
# 设置窗口
2021-05-30 13:04:46 +08:00
style = ttkthemes.ThemedStyle(win)
style.set_theme("breeze")
2021-05-30 13:04:46 +08:00
window = ttk.Frame(win)
win.title(title)
win.resizable(0, 0)
win.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height
screen_width = win.winfo_screenwidth()
screen_height = win.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)
win.geometry(""+"+{:.0f}+{:.0f}".format(x, y))
2021-07-11 14:45:11 +08:00
# 创建控件
FrmInstall = ttk.Frame(window)
2021-09-26 20:16:29 +08:00
#FrmUninstall = ttk.Frame(window)
2021-09-20 17:10:05 +08:00
LabApkPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabApkPath"])
2021-09-26 20:16:29 +08:00
#LabUninstallPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabUninstallPath"])
ComboInstallPath = ttk.Combobox(window, width=50)
2021-09-26 20:16:29 +08:00
#ComboUninstallPath = ttk.Combobox(window, width=50)
2021-09-20 17:10:05 +08:00
BtnFindApk = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnFindApk"], command=FindApk)
BtnInstall = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnInstall"], command=Button3Install)
BtnShowUengineApp = ttk.Button(window, text=langFile[lang]["Main"]["MainWindow"]["BtnShowUengineApp"], command=Button5Click)
2021-09-26 20:16:29 +08:00
#BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstallApkBrowser"], command=BtnFindUninstallApkClk)
BtnUninstall = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstall"], command=ButtonClick8)
2021-09-20 17:10:05 +08:00
Btngeticon = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["Btngeticon"], command=SaveIconToOtherPath)
BtnSaveApk = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnSaveApk"], command=SaveInstallUengineApp)
2021-09-26 20:16:29 +08:00
BtnApkInformation = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnApkInformation"], command=ApkInformation.ShowWindows)
2021-07-11 14:45:11 +08:00
# 设置菜单栏
menu = tk.Menu(window, background="white")
2021-05-30 13:04:46 +08:00
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
2021-08-30 17:49:12 +08:00
adb = tk.Menu(menu, tearoff=0, background="white")
2021-05-30 13:04:46 +08:00
uengine = tk.Menu(menu, tearoff=0, background="white")
help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏
2021-08-30 17:49:12 +08:00
adbServer = tk.Menu(adb, tearoff=0, background="white")
2021-08-27 09:18:31 +08:00
uengineService = tk.Menu(uengine, tearoff=0, background="white")
uengineInternet = tk.Menu(uengine, tearoff=0, background="white")
uengineIcon = tk.Menu(uengine, tearoff=0, background="white")
2021-08-30 17:49:12 +08:00
uengineUseAdb = tk.Menu(uengine, tearoff=0, background="white")
2021-08-27 09:18:31 +08:00
uengineData = tk.Menu(uengine, tearoff=0, background="white")
2021-11-28 16:11:01 +08:00
uengineRoot = tk.Menu(uengine, tearoff=0, background="white")
2021-08-18 21:54:28 +08:00
2021-09-20 17:10:05 +08:00
menu.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Name"], menu=programmenu)
menu.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Name"], menu=adb)
menu.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Name"], menu=uengine)
menu.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Name"], menu=help)
2021-09-20 17:10:05 +08:00
programmenu.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][0], command=CleanProgramHistory)
2021-05-29 22:54:59 +08:00
programmenu.add_separator() # 设置分界线
2021-09-20 17:10:05 +08:00
programmenu.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][0]["Menu"][1], command=window.quit) # 设置“退出程序”
2021-09-20 17:10:05 +08:00
adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][0], command=UengineConnectAdb)
2021-08-30 17:49:12 +08:00
adb.add_separator()
2021-09-20 17:10:05 +08:00
adb.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Name"], menu=adbServer)
adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][2], command=AdbConnectDeviceShow)
2021-08-30 17:49:12 +08:00
adb.add_separator()
2021-09-20 17:10:05 +08:00
adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][3], command=AdbChangeUengineDisplaySize.ShowWindows)
adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][4], command=AdbAndroidInstallAppList)
adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][5], command=AdbCPUAndRAWShowInTer)
adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][6], command=AdbShellShowInTer)
adb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][7], command=ScrcpyConnectUengine)
2021-08-30 17:49:12 +08:00
adb.add_separator()
2021-09-20 17:10:05 +08:00
adb.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Name"], menu=uengineUseAdb)
adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][0], command=AdbStartServer)
adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][1], command=AdbStopServer)
adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2], command=AdbKillAdbProgress)
2021-10-05 18:16:50 +08:00
#uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][0], command=UengineSettingShow)
2021-09-20 17:10:05 +08:00
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][1], command=OpenUengineDebBuilder)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][7], command=KeyboardToMouse)
2021-10-03 20:34:07 +08:00
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][8], command=UengineCheckCpu)
2021-09-20 17:10:05 +08:00
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Name"], menu=uengineService)
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Name"], menu=uengineInternet)
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Name"], menu=uengineIcon)
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][5]["Name"], menu=uengineUseAdb)
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Name"], menu=uengineData)
2021-10-05 18:16:50 +08:00
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][9], command=DelUengineCheck)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][10], command=ReinstallUengine)
2021-11-28 16:11:01 +08:00
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Name"], menu=uengineRoot)
2021-09-20 17:10:05 +08:00
help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][0], command=OpenProgramURL) # 设置“程序官网”项
2021-10-05 18:16:50 +08:00
help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][2], command=UengineRunnerBugUpload) # 设置“程序官网”项
2021-09-20 17:10:05 +08:00
help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][1], command=showhelp) # 设置“关于这个程序”项
uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][0], command=StartUengine)
2021-09-26 20:16:29 +08:00
uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][1], command=StopUengine)
uengineService.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Menu"][2], command=UengineRestart)
2021-09-20 17:10:05 +08:00
uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][0], command=UengineBridgeStart)
uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][1], command=UengineBridgeStop)
uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][2], command=UengineBridgeRestart)
uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][3], command=UengineBridgeReload)
uengineInternet.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Menu"][4], command=UengineBridgeForceReload)
uengineIcon.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][0], command=SendUengineAndroidListForDesktop)
uengineIcon.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][1], command=SendUengineAndroidListForLauncher)
2021-08-18 21:54:28 +08:00
uengineIcon.add_separator()
2021-09-20 17:10:05 +08:00
uengineIcon.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][2], command=AddNewUengineDesktopLink.ShowWindow)
2021-08-18 21:54:28 +08:00
uengineIcon.add_separator()
2021-09-20 17:10:05 +08:00
uengineIcon.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Menu"][3], command=CleanAllUengineDesktopLink)
2021-08-30 17:49:12 +08:00
2021-09-20 17:10:05 +08:00
uengineUseAdb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][0], command=UengineConnectAdb)
2021-08-30 17:49:12 +08:00
uengineUseAdb.add_separator()
2021-09-20 17:10:05 +08:00
uengineUseAdb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][1], command=UengineUseAdb)
uengineUseAdb.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][8]["Menu"][2], command=UengineDoNotUseAdb)
2021-08-18 21:54:28 +08:00
2021-09-20 17:10:05 +08:00
uengineData.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][0], command=OpenUengineRootData)
uengineData.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][1], command=OpenUengineUserData)
2021-08-19 14:08:05 +08:00
uengineData.add_separator()
2021-09-20 17:10:05 +08:00
uengineData.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][6]["Menu"][2], command=BackUengineClean)
2021-08-19 14:08:05 +08:00
2021-11-28 16:11:01 +08:00
uengineRoot.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][0], command=InstallRootUengineImage)
uengineRoot.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][1], command=BuildRootUengineImage)
uengineRoot.add_separator()
uengineRoot.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Menu"][2], command=ReinstallUengineImage)
menu.configure(activebackground="dodgerblue")
help.configure(activebackground="dodgerblue")
2021-08-30 17:49:12 +08:00
adb.configure(activebackground="dodgerblue")
uengine.configure(activebackground="dodgerblue")
programmenu.configure(activebackground="dodgerblue")
2021-08-18 21:54:28 +08:00
uengineService.configure(activebackground="dodgerblue")
uengineInternet.configure(activebackground="dodgerblue")
uengineIcon.configure(activebackground="dodgerblue")
2021-08-30 17:49:12 +08:00
uengineUseAdb.configure(activebackground="dodgerblue")
uengineData.configure(activebackground="dodgerblue")
2021-05-29 22:54:59 +08:00
# 设置控件
2021-09-26 20:16:29 +08:00
#ComboUninstallPath['value'] = fineUninstallApkHistory
ComboInstallPath['value'] = findApkHistory
2021-08-15 21:46:48 +08:00
try:
if sys.argv[1] == "-i":
ComboInstallPath.set(sys.argv[2])
print("Install Path: " + sys.argv[2])
elif sys.argv[1] == "-u":
2021-09-26 20:16:29 +08:00
#ComboUninstallPath.set(sys.argv[2])
ComboInstallPath.set(sys.argv[2])
2021-08-15 21:46:48 +08:00
print("Unstall Path: " + sys.argv[2])
else:
print("Command Format Error")
except:
print("Not Command Or Command Format Error")
2021-07-11 14:45:11 +08:00
# 显示控件
2021-05-30 13:04:46 +08:00
win.config(menu=menu) # 显示菜单栏
2021-09-26 20:16:29 +08:00
LabApkPath.grid(row=0, column=0,sticky= tk.W,padx=3)
ComboInstallPath.grid(row=1, column=0,padx=3)
2021-09-26 20:16:29 +08:00
FrmInstall.grid(row=0, column=1,padx=3, rowspan=3)
BtnFindApk.grid(row=0, column=0)
BtnInstall.grid(row=0, column=1)
2021-09-26 20:16:29 +08:00
BtnUninstall.grid(row=1, column=0)
2021-09-26 20:16:29 +08:00
BtnShowUengineApp.grid(row=2, column=0,sticky= tk.W,padx=3,pady=2)
2021-09-26 20:16:29 +08:00
BtnApkInformation.grid(row=2, column=1,sticky= tk.W,padx=3,pady=2)
Btngeticon.grid(row=1, column=1,sticky= tk.W,padx=3,pady=2)
BtnSaveApk.grid(row=2, column=0,sticky= tk.W,padx=3,pady=2)
2021-05-30 13:04:46 +08:00
window.pack()
win.mainloop()