This commit is contained in:
gfdgd xi 2021-08-30 17:49:12 +08:00
parent 76d3710963
commit 4b889b6056
59 changed files with 2221 additions and 244 deletions

View File

@ -1,7 +1,7 @@
# uengine 运行器 1.4.0 # uengine 运行器 1.4.0
### 介绍 ### 介绍
        新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的Uengine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。         新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。
![1.4.1](https://storage.deepin.org/thread/20210826151947783_截图_选择区域_20210826151312.png) ![1.4.1](https://storage.deepin.org/thread/20210826151947783_截图_选择区域_20210826151312.png)
测试平台UOS 家庭版deepin 20.2.2,UOS 专业版 1040 测试平台UOS 家庭版deepin 20.2.2,UOS 专业版 1040
(自己美术功底太差,图标直接用 anbox 的了) (自己美术功底太差,图标直接用 anbox 的了)
@ -115,7 +115,7 @@ pip3 uninstall ttkthemes
### 使用说明 ### 使用说明
1、需要你有使用 root 权限的能力; 1、需要你有使用 root 权限的能力;
2、需要安装 uengine 才能使用UOS建议在商店安装一个安卓应用让系统自动安装uengine及相关的依赖包; 2、需要安装 UEngine 才能使用UOS建议在商店安装一个安卓应用让系统自动安装 UEngine 及相关的依赖包;
3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准; 3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;
4、如果报错是有关产生 .deksotp 文件有关,一般可以打开程序列表运行。如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。 4、如果报错是有关产生 .deksotp 文件有关,一般可以打开程序列表运行。如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。

View File

@ -1,11 +1,11 @@
[Desktop Entry] [Desktop Entry]
Categories=System; Categories=System;
Comment=uengineanbox 程序菜单 Comment=UEngine 程序菜单
Encoding=UTF-8 Encoding=UTF-8
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
Icon=/opt/apps/uengine-runner/icon.png Icon=/opt/apps/uengine-runner/icon.png
MimeType= MimeType=
Name=uengine 程序菜单 Name=UEngine 程序菜单
StartupWMClass=uengine 程序菜单 StartupWMClass=UEngine 程序菜单
Terminal=false Terminal=false
Type=Application Type=Application

View File

@ -1,10 +1,10 @@
Package: spark-uengine-runner Package: spark-uengine-runner
Version: 1.4.1 Version: 1.4.2
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com> Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>
Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner] Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner]
Architecture: all Architecture: all
Priority: optional Priority: optional
Conflicts: com.gitee.uengine.runner.spark, spark-uengine-apk-builder Conflicts: com.gitee.uengine.runner.spark, spark-uengine-apk-builder
Depends: python3, python3-tk, python3-pip, aapt, uengine, python3-pil, python3-setuptools Depends: python3, python3-tk, python3-pip, aapt, uengine, python3-pil, python3-setuptools, deepin-terminal
Description: uengine runner for deepin and UOS Description: UEngine Runner for deepin and UOS

View File

@ -2,3 +2,4 @@
python3 -m pip install --upgrade ttkthemes python3 -m pip install --upgrade ttkthemes
python3 -m pip install --upgrade pyautogui python3 -m pip install --upgrade pyautogui
python3 -m pip install --upgrade keyboard python3 -m pip install --upgrade keyboard
python3 -m pip install --upgrade requests

View File

@ -3,10 +3,10 @@
"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.1", "Version": "1.4.2",
"System": "Linuxdeepin/UOS", "System": "Linuxdeepin/UOS",
"Tips": [ "Tips": [
" 新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的Uengine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。", "更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis",
"", "",
"安装APK点浏览按钮选中需要安装的APK然后点安装按钮", "安装APK点浏览按钮选中需要安装的APK然后点安装按钮",
"", "",
@ -14,20 +14,26 @@
"", "",
"保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可", "保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可",
"", "",
"键盘映射详细请查看uengine键盘映射主界面", "重置删除UEngine数据点击菜单栏的“UEngine”的“清空UEngine数据”输入密码重启即可",
" 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载UEngine配置了",
"", "",
"重置删除uengine数据点击菜单栏的“uengine”的“清空uengine数据”输入密码重启即可", "打开UEngine应用列表打开系统已安装的应用列表安卓界面",
" 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载uengine配置了",
"",
"打开Uengine应用列表打开系统已安装的应用列表安卓界面",
"", "",
"提示:", "提示:",
"1、需要你有使用 root 权限的能力;", "1、需要你有使用 root 权限的能力;",
"2、需要安装 uengine 才能使用;", "2、需要安装 UEngine 才能使用;",
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;", "3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
"4、如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。" "4、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁"
], ],
"Update": [ "Update": [
"V1.4.2",
"※1、添加adb破解补丁用于可以让adb连接UEngine并支持adb的部分操作;",
"2、菜单栏的项目添加以及外观优化;",
"3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
"4、把 uengine 改为 UEngine;",
"5、修改 pkexec 获取密码时显示的图标和文本;",
"6、添加了 UEngine 系统设置的快捷方式;",
"",
"V1.4.1", "V1.4.1",
"※1、初步支持键盘映射", "※1、初步支持键盘映射",
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件", "2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
@ -87,7 +93,7 @@
"暂无数据" "暂无数据"
], ],
"Use": [ "Use": [
"1、uengine相关软件包基于anbox开发", "1、UEngine相关软件包基于anbox开发",
"2、Python3", "2、Python3",
"3、tkintertkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk", "3、tkintertkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk",
"4、aapt", "4、aapt",
@ -96,9 +102,11 @@
"7、mkdir", "7、mkdir",
"8、echo", "8、echo",
"9、chmod", "9、chmod",
"10、adb",
"11、deepin 终端",
"……" "……"
], ],
"Time": "2021年08月26日", "Time": "2021年08月30日",
"Contribute": ["gfdgd xi<3025613752@qq.com>", "Contribute": ["gfdgd xi<3025613752@qq.com>",
"actionchen<917981399@qq.com>"] "actionchen<917981399@qq.com>"]
} }

2
build/opt/apps/uengine-runner/setting.json Normal file → Executable file
View File

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

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.3.3 # 版本1.4.2
# 更新时间2021年8月19 # 更新时间2021年8月30
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -374,7 +374,7 @@ def get_home():
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(programPath + "/information.json")) information = json.loads(readtxt(programPath + "/information.json"))
version = information["Version"] version = information["Version"]
title = "uengine APK 应用打包器 {}".format(version) title = "UEngine APK 应用打包器 {}".format(version)
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
########################### ###########################

View File

@ -4,7 +4,7 @@ import sys
if len(sys.argv) > 1: if len(sys.argv) > 1:
if sys.argv[1] == "--help": if sys.argv[1] == "--help":
print("帮助:") print("帮助:")
print("输入命令即可清空/重置uengine") print("输入命令即可清空/重置UEngine")
sys.exit(0) sys.exit(0)
print("参数错误") print("参数错误")
sys.exit(1) sys.exit(1)

View File

@ -2,6 +2,7 @@
######################################### #########################################
# 版本1.4.0 # 版本1.4.0
# 更新时间2021年08月26日 # 更新时间2021年08月26日
# Need: unix, python3-tk, python3-pip, pymouse, keyboard
######################################### #########################################
import os import os
import sys import sys
@ -17,17 +18,19 @@ import tkinter as tk
import tkinter.ttk as ttk import tkinter.ttk as ttk
import tkinter.messagebox as messagebox import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog import tkinter.filedialog as filedialog
import Xlib.threaded as threaded
#import pymouse.unix as pymouse
######################## ########################
# #
######################## ########################
def Inputt(key): def Inputt(key):
if key.event_type == "down": if key.event_type == "up":
global setting global setting
if setting: if setting:
Setting(key) Setting(key)
else: else:
Mouse(key) Mouse(key)
#Mouse(key)
def Open(): def Open():
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]]) path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
@ -49,9 +52,14 @@ def ReStartProgram()->"重启本应用程序":
def Mouse(key): def Mouse(key):
print(keybo)
if keybo.__contains__(key.name): if keybo.__contains__(key.name):
print(keybo[key.name]["MousePlace"]) print(keybo[key.name]["MousePlace"])
pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]) pyautogui.FAILSAFE = False
#os.system(programPath + "/mouse.py {} {}".format(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]))
#pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])
pyautogui.click(1500, 800)
#m.click(keybo[key.name]["MousePlace"][0],keybo[key.name]["MousePlace"][1])
def Setting(key): def Setting(key):
if key.event_type == 'up': if key.event_type == 'up':
@ -84,10 +92,15 @@ def ShowTips():
time.sleep(0.1) time.sleep(0.1)
ShowTips() ShowTips()
except: except:
pass traceback.print_exc()
if not close:
ShowTips()
def Closing():
close = True
window.destroy()
def Key(): def Key():
global inputs
keyboard.hook(Inputt) keyboard.hook(Inputt)
# 获取用户主目录 # 获取用户主目录
@ -96,10 +109,6 @@ def get_home()->"获取用户主目录":
# 写入文本文档 # 写入文本文档
def write_txt(path: "路径", things: "内容")->"写入文本文档": def write_txt(path: "路径", things: "内容")->"写入文本文档":
TxtDir = os.path.dirname(path)
print(TxtDir)
if not os.path.exists(TxtDir):
os.makedirs(TxtDir,exist_ok=True)
file = open(path, 'w', encoding='UTF-8') # 设置文件对象 file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本 file.write(things) # 写入文本
file.close() # 关闭文本对象 file.close() # 关闭文本对象
@ -136,6 +145,7 @@ if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home()))
# #
################### ###################
setting = False setting = False
close = False
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home()))) keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home())))
@ -175,9 +185,10 @@ settingMouseToKeyboard.configure(state=tk.DISABLED)
style = ttkthemes.ThemedStyle(window) style = ttkthemes.ThemedStyle(window)
style.set_theme("breeze") style.set_theme("breeze")
window.protocol('WM_DELETE_WINDOW', Closing)
window.resizable(0, 0) window.resizable(0, 0)
window.iconphoto(False, tk.PhotoImage(file=iconPath)) window.iconphoto(False, tk.PhotoImage(file=iconPath))
window.title("uengine 键盘映射 {}".format(version)) window.title("UEngine 键盘映射 {}".format(version))
menu.add_cascade(label="程序", menu=programMenu) menu.add_cascade(label="程序", menu=programMenu)
menu.add_cascade(label="帮助", menu=aboutMenu) menu.add_cascade(label="帮助", menu=aboutMenu)
@ -202,8 +213,15 @@ settingMouseToKeyboard.grid(row=0, column=0)
settingButton.grid(row=0, column=1) settingButton.grid(row=0, column=1)
win.pack(fill="both", expand="yes") win.pack(fill="both", expand="yes")
#threaded.lock.allocate_lock()
threading.Thread(target=Key).start() threading.Thread(target=Key).start()
threading.Thread(target=ShowTips).start() threading.Thread(target=ShowTips).start()
pyautogui.FAILSAFE = False
'''def B(key):
if key.event_type == "up":
print(pyautogui.position())
print(key.name)
pyautogui.click(1500, 800)
keyboard.hook(B)
keyboard.wait()'''
window.mainloop() window.mainloop()

View File

@ -11,7 +11,6 @@
################# #################
# 引入所需的库 # 引入所需的库
################# #################
from genericpath import exists
import os import os
import sys import sys
import time import time
@ -29,7 +28,7 @@ import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog import tkinter.filedialog as filedialog
import tkinter.simpledialog as simpledialog import tkinter.simpledialog as simpledialog
from getxmlimg import getsavexml from getxmlimg import getsavexml
from tkinter.constants import TOP
# 卸载程序 # 卸载程序
def UninstallProgram(package: "apk 包名")->"卸载程序": def UninstallProgram(package: "apk 包名")->"卸载程序":
@ -552,7 +551,7 @@ def get_home()->"获取用户主目录":
# 删除所有的 uengine 应用快捷方式 # 删除所有的 uengine 应用快捷方式
def CleanAllUengineDesktopLink(): 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.mkdir("{}/.local/share/applications/uengine".format(get_home()))
@ -573,6 +572,84 @@ def OpenUengineRootData():
def OpenUengineUserData(): def OpenUengineUserData():
threading.Thread(target=os.system, args=["xdg-open ~/安卓应用文件"]).start() threading.Thread(target=os.system, args=["xdg-open ~/安卓应用文件"]).start()
# 终端显示 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.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start()
# 杀死 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="完成!")
# 使用 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()
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")))
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()
# 添加/删除 uengine 应用快捷方式 # 添加/删除 uengine 应用快捷方式
class AddNewUengineDesktopLink(): class AddNewUengineDesktopLink():
addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity
@ -591,8 +668,9 @@ class AddNewUengineDesktopLink():
saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink) saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink)
delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink) delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink)
message.title("添加/删除 uengine 图标") message.title("添加/删除 UEngine 图标")
message.resizable(0, 0) message.resizable(0, 0)
message.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height # get screen width and height
screen_width = message.winfo_screenwidth() screen_width = message.winfo_screenwidth()
screen_height = message.winfo_screenheight() screen_height = message.winfo_screenheight()
@ -636,7 +714,7 @@ class AddNewUengineDesktopLink():
def DelDesktopLink(): def DelDesktopLink():
global packageName global packageName
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())): if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
messagebox.showerror(title="错误", message="此包名对应的uengine桌面快捷方式不存在!") messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
return return
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"): if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return return
@ -680,29 +758,42 @@ programUrl = information["Url"][0]
version = information["Version"] version = information["Version"]
goodRunSystem = information["System"] goodRunSystem = information["System"]
aaptVersion = GetCommandReturn("aapt version") aaptVersion = GetCommandReturn("aapt version")
about = ''' 一个基于 Python3 的 tkinter 制作的 uengine APK 运行器 about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器在新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。
版本 {} 版本 {}
适用平台 {} 适用平台 {}
tkinter版本{}
aapt 版本 {}
程序官网 {} 程序官网 {}
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, aaptVersion,programUrl, time.strftime("%Y")) ©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
tips = "\n".join(information["Tips"]) tips = "\n".join(information["Tips"])
updateThingsString = "\n".join(information["Update"]) updateThingsString = "\n".join(information["Update"])
title = "uengine 运行器 {}".format(version) title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"] updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) 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 = "\n".join(information["Use"]) useProgram = '''1、UEngine{}
2、python3{}
3、tkinter{}
4、aapt{}
5、dpkg{}
6、mkdir{}
7、echo
8、chmod{}
9、adb{}
10、deepin 终端:{}'''.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"))
########################### ###########################
@ -752,7 +843,7 @@ def showhelp():
helpwindow=tk.Toplevel() helpwindow=tk.Toplevel()
helpwindow.resizable(0, 0) helpwindow.resizable(0, 0)
helpwindow.title("帮助") helpwindow.title("帮助")
helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height # get screen width and height
screen_width = helpwindow.winfo_screenwidth() screen_width = helpwindow.winfo_screenwidth()
@ -861,7 +952,7 @@ ComboInstallPath = ttk.Combobox(window, width=50)
ComboUninstallPath = ttk.Combobox(window, width=50) ComboUninstallPath = ttk.Combobox(window, width=50)
BtnFindApk = ttk.Button(FrmInstall, text="浏览", command=FindApk) BtnFindApk = ttk.Button(FrmInstall, text="浏览", command=FindApk)
BtnInstall = ttk.Button(FrmInstall, text="安装", command=Button3Install) BtnInstall = ttk.Button(FrmInstall, text="安装", command=Button3Install)
BtnShowUengineApp = ttk.Button(window, text="打开 uengine 应用列表", command=Button5Click) BtnShowUengineApp = ttk.Button(window, text="打开 UEngine 应用列表", command=Button5Click)
BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text="浏览", command=BtnFindUninstallApkClk) BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text="浏览", command=BtnFindUninstallApkClk)
BtnUninstall = ttk.Button(FrmUninstall, text="卸载", command=ButtonClick8) BtnUninstall = ttk.Button(FrmUninstall, text="卸载", command=ButtonClick8)
Btngeticon = ttk.Button(FrmInstall, text="保存图标", command=SaveIconToOtherPath) Btngeticon = ttk.Button(FrmInstall, text="保存图标", command=SaveIconToOtherPath)
@ -870,61 +961,91 @@ BtnSaveApk = ttk.Button(FrmInstall, text="保存apk", command=SaveInstallUengine
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") # 设置“程序”菜单栏
adb = tk.Menu(menu, tearoff=0, background="white")
uengine = tk.Menu(menu, tearoff=0, background="white") uengine = tk.Menu(menu, tearoff=0, background="white")
help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏 help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏
uengineService = tk.Menu(uengine) adbServer = tk.Menu(adb, tearoff=0, background="white")
uengineInternet = tk.Menu(uengine)
uengineIcon = tk.Menu(uengine) uengineService = tk.Menu(uengine, tearoff=0, background="white")
uengineData = tk.Menu(uengine) uengineInternet = tk.Menu(uengine, tearoff=0, background="white")
uengineIcon = tk.Menu(uengine, tearoff=0, background="white")
uengineUseAdb = tk.Menu(uengine, tearoff=0, background="white")
uengineData = tk.Menu(uengine, tearoff=0, background="white")
menu.add_cascade(label="程序", menu=programmenu) menu.add_cascade(label="程序", menu=programmenu)
menu.add_cascade(label="uengine", menu=uengine) menu.add_cascade(label="adb", menu=adb)
menu.add_cascade(label="UEngine", menu=uengine)
menu.add_cascade(label="关于", menu=help) menu.add_cascade(label="关于", menu=help)
programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory) programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
programmenu.add_separator() # 设置分界线 programmenu.add_separator() # 设置分界线
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序” programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”
uengine.add_command(label="uengine 应用打包", command=OpenUengineDebBuilder) adb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
uengine.add_command(label="uengine 键盘映射", command=KeyboardToMouse) adb.add_separator()
uengine.add_cascade(label="uengine 服务", menu=uengineService) adb.add_cascade(label="adb 服务", menu=adbServer)
uengine.add_cascade(label="uengine 网络桥接", menu=uengineInternet) adb.add_command(label="显示 adb 连接的设备", command=AdbConnectDeviceShow)
uengine.add_cascade(label="uengine 快捷方式", menu=uengineIcon) adb.add_separator()
uengine.add_cascade(label="uengine 数据", menu=uengineData) adb.add_command(label="adb 查看 UEngine 应用列表", command=AdbAndroidInstallAppList)
adb.add_command(label="adb 查看 UEngine 资源使用情况", command=AdbCPUAndRAWShowInTer)
adb.add_command(label="打开 adb 连接 UEngine 的终端", command=AdbShellShowInTer)
adb.add_separator()
adb.add_cascade(label="UEngine 使用 adb", menu=uengineUseAdb)
adbServer.add_command(label="开启 adb 服务", command=AdbStartServer)
adbServer.add_command(label="关闭 adb 服务", command=AdbStopServer)
adbServer.add_command(label="杀死 adb 进程", command=AdbKillAdbProgress)
uengine.add_command(label="UEngine 系统设置", command=UengineSettingShow)
uengine.add_command(label="UEngine 应用打包", command=OpenUengineDebBuilder)
#uengine.add_command(label="UEngine 键盘映射", command=KeyboardToMouse)
uengine.add_cascade(label="UEngine 服务", menu=uengineService)
uengine.add_cascade(label="UEngine 网络桥接", menu=uengineInternet)
uengine.add_cascade(label="UEngine 快捷方式", menu=uengineIcon)
uengine.add_cascade(label="UEngine 使用 adb", menu=uengineUseAdb)
uengine.add_cascade(label="UEngine 数据", menu=uengineData)
help.add_command(label="程序官网", command=OpenProgramURL) # 设置“程序官网”项 help.add_command(label="程序官网", command=OpenProgramURL) # 设置“程序官网”项
help.add_command(label="帮助", command=showhelp) # 设置“关于这个程序”项 help.add_command(label="帮助", command=showhelp) # 设置“关于这个程序”项
uengineService.add_command(label="启用 uengine 服务", command=StartUengine) uengineService.add_command(label="启用 UEngine 服务(需要 root", command=StartUengine)
uengineService.add_command(label="关闭 uengine 服务", command=StopUengine) uengineService.add_command(label="关闭 UEngine 服务(需要 root", command=StopUengine)
uengineService.add_command(label="重启 uengine 服务", command=UengineRestart) uengineService.add_command(label="重启 UEngine 服务(需要 root", command=UengineRestart)
uengineInternet.add_command(label="启用 uengine 网络桥接", command=UengineBridgeStart) uengineInternet.add_command(label="启用 UEngine 网络桥接(需要 root", command=UengineBridgeStart)
uengineInternet.add_command(label="关闭 uengine 网络桥接", command=UengineBridgeStop) uengineInternet.add_command(label="关闭 UEngine 网络桥接(需要 root", command=UengineBridgeStop)
uengineInternet.add_command(label="重启 uengine 网络桥接", command=UengineBridgeRestart) uengineInternet.add_command(label="重启 UEngine 网络桥接(需要 root", command=UengineBridgeRestart)
uengineInternet.add_command(label="加载 uengine 网络桥接", command=UengineBridgeReload) uengineInternet.add_command(label="加载 UEngine 网络桥接(需要 root", command=UengineBridgeReload)
uengineInternet.add_command(label="强制加载 uengine 网络桥接", command=UengineBridgeForceReload) uengineInternet.add_command(label="强制加载 UEngine 网络桥接(需要 root", command=UengineBridgeForceReload)
uengineIcon.add_command(label="发送 uengine 应用列表到桌面", command=SendUengineAndroidListForDesktop) uengineIcon.add_command(label="发送 UEngine 应用列表到桌面", command=SendUengineAndroidListForDesktop)
uengineIcon.add_command(label="发送 uengine 应用列表到启动器", command=SendUengineAndroidListForLauncher) uengineIcon.add_command(label="发送 UEngine 应用列表到启动器", command=SendUengineAndroidListForLauncher)
uengineIcon.add_separator() uengineIcon.add_separator()
uengineIcon.add_command(label="添加/删除指定的 uengine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow) uengineIcon.add_command(label="添加/删除指定的 UEngine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow)
uengineIcon.add_separator() uengineIcon.add_separator()
uengineIcon.add_command(label="清空所有 uengine 快捷方式", command=CleanAllUengineDesktopLink) uengineIcon.add_command(label="清空所有 UEngine 快捷方式", command=CleanAllUengineDesktopLink)
uengineData.add_command(label="打开 uengine 根目录", command=OpenUengineRootData) uengineUseAdb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
uengineData.add_command(label="打开 uengine 用户数据目录", command=OpenUengineUserData) uengineUseAdb.add_separator()
uengineUseAdb.add_command(label="允许此设备使用 adb 连接本 UEngine需要 root", command=UengineUseAdb)
uengineUseAdb.add_command(label="禁止任何设备使用 adb 连接本 UEngine需要 root", command=UengineDoNotUseAdb)
uengineData.add_command(label="打开 UEngine 根目录", command=OpenUengineRootData)
uengineData.add_command(label="打开 UEngine 用户数据目录", command=OpenUengineUserData)
uengineData.add_separator() uengineData.add_separator()
uengineData.add_command(label="清空 uengine 数据", command=BackUengineClean) uengineData.add_command(label="清空 UEngine 数据(需要 root", command=BackUengineClean)
menu.configure(activebackground="dodgerblue") menu.configure(activebackground="dodgerblue")
help.configure(activebackground="dodgerblue") help.configure(activebackground="dodgerblue")
adb.configure(activebackground="dodgerblue")
uengine.configure(activebackground="dodgerblue") uengine.configure(activebackground="dodgerblue")
programmenu.configure(activebackground="dodgerblue") programmenu.configure(activebackground="dodgerblue")
uengineService.configure(activebackground="dodgerblue") uengineService.configure(activebackground="dodgerblue")
uengineInternet.configure(activebackground="dodgerblue") uengineInternet.configure(activebackground="dodgerblue")
uengineIcon.configure(activebackground="dodgerblue") uengineIcon.configure(activebackground="dodgerblue")
uengineUseAdb.configure(activebackground="dodgerblue")
uengineData.configure(activebackground="dodgerblue")
# 设置控件 # 设置控件
ComboUninstallPath['value'] = fineUninstallApkHistory ComboUninstallPath['value'] = fineUninstallApkHistory

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.3.3 # 版本1.4.2
# 更新时间2021年8月19 # 更新时间2021年8月30
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -34,29 +34,42 @@ programUrl = information["Url"][0]
version = information["Version"] version = information["Version"]
goodRunSystem = information["System"] goodRunSystem = information["System"]
aaptVersion = subprocess.getoutput("aapt version") aaptVersion = subprocess.getoutput("aapt version")
about = ''' 一个基于 Python3 的 tkinter 制作的 uengine APK 运行器 about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器在新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。
版本 {} 版本 {}
适用平台 {} 适用平台 {}
tkinter版本{}
aapt 版本 {}
程序官网 {} 程序官网 {}
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, aaptVersion,programUrl, time.strftime("%Y")) ©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
tips = "\n".join(information["Tips"]) tips = "\n".join(information["Tips"])
updateThingsString = "\n".join(information["Update"]) updateThingsString = "\n".join(information["Update"])
title = "uengine 运行器 {}".format(version) title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"] updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) 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 = "\n".join(information["Use"]) useProgram = '''1、UEngine{}
2、python3{}
3、tkinter{}
4、aapt{}
5、dpkg{}
6、mkdir{}
7、echo
8、chmod{}
9、adb{}
10、deepin 终端:{}'''.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"))
# add sub window # add sub window
#添加窗口开启关闭开关,防止重复开启 #添加窗口开启关闭开关,防止重复开启

View File

@ -0,0 +1,83 @@
#!/usr/bin/env python3
#########################################
# 版本1.4.2
# 更新时间2021年08月30日
#########################################
import os
import shutil
import sys
import traceback
import ttkthemes
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
########################
#
########################
# 写入文本文档
def write_txt(path: "路径", things: "内容")->"写入文本文档":
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
# 读取文本文档
def readtxt(path: "路径")->"读取文本文档":
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
###################
# 判断是不是 root
###################
if os.geteuid() != 0:
print("不是以 root 权限运行本程序!")
root = tk.Tk()
root.overrideredirect(1)
root.withdraw()
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
sys.exit(1)
###################
#
###################
window = tk.Tk()
style = ttkthemes.ThemedStyle(window)
style.set_theme("breeze")
window.overrideredirect(1)
window.withdraw()
try:
if sys.argv[1] == "1" and messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
os.remove("/data/uengine/data/data/misc/adb/adb_keys")
messagebox.showinfo(title="提示", message="完成")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
sys.exit(2)
if sys.argv[1] == "1":
sys.exit(0)
if not messagebox.askyesno(title="提示", message='''请阅读以下提示然后确定是否继续:
1、安装后即可使用 adb 连接 UEngine;
2、重置 UEngine 或 adb 就需要重新设置该支持补丁;
3、需要 root 权限;'''):
sys.exit(0)
# 写入(需要 root
if not os.path.exists("/data/uengine/data/data/misc/adb"):
messagebox.showerror(title="错误", message="无法读取 UEngine 数据!")
sys.exit(1)
try:
things = readtxt(sys.argv[2])
adbKey = []
# 提取内容
for i in things.split('\n'):
adbKey.append(i[0: i.find(" ")])
old = ""
if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n"
write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey))
messagebox.showinfo(title="提示", message="完成")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
sys.exit(2)

View File

@ -0,0 +1 @@
/opt/apps/uengine-runner/uengine-useadb

View File

@ -1,11 +1,11 @@
[Desktop Entry] [Desktop Entry]
Categories=System; Categories=System;
Comment=uengineanbox 程序菜单 Comment=UEngine 程序菜单
Encoding=UTF-8 Encoding=UTF-8
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
Icon=/opt/apps/uengine-runner/icon.png Icon=/opt/apps/uengine-runner/icon.png
MimeType= MimeType=
Name=uengine 程序菜单 Name=UEngine 程序菜单
StartupWMClass=uengine 程序菜单 StartupWMClass=UEngine 程序菜单
Terminal=false Terminal=false
Type=Application Type=Application

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Categories=System;
Comment=UEngine 系统设置
Encoding=UTF-8
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings
Icon=/opt/apps/uengine-runner/icon.png
MimeType=
Name=UEngine 系统设置
StartupWMClass=UEngine 系统设置
Terminal=false
Type=Application

View File

@ -5,10 +5,10 @@ Categories=System;
Terminal=false Terminal=false
Exec=/usr/bin/uengine-runner -i %F Exec=/usr/bin/uengine-runner -i %F
Icon=/opt/apps/uengine-runner/icon.png Icon=/opt/apps/uengine-runner/icon.png
Name=Install APK(uengine runner) Name=Install APK(UEngine runner)
Comment=Install APK(uengine runner) Comment=Install APK(UEngine runner)
Comment[zh]=安装 APKuengine 运行器) Comment[zh]=安装 APKUEngine 运行器)
Name[zh]=安装 APKuengine 运行器) Name[zh]=安装 APKUEngine 运行器)
StartupNotify=true StartupNotify=true
Hidden=false Hidden=false
NoDisplay=true NoDisplay=true

View File

@ -5,10 +5,10 @@ Categories=System;
Terminal=false Terminal=false
Exec=/usr/bin/uengine-runner -u %F Exec=/usr/bin/uengine-runner -u %F
Icon=/opt/apps/uengine-runner/icon.png Icon=/opt/apps/uengine-runner/icon.png
Name=Uninstall APK(uengine runner) Name=Uninstall APK(UEngine runner)
Comment=Uninstall APK(uengine runner) Comment=Uninstall APK(UEngine runner)
Comment[zh]=卸载 APKuengine 运行器) Comment[zh]=卸载 APKUEngine 运行器)
Name[zh]=卸载 APKuengine 运行器) Name[zh]=卸载 APKUEngine 运行器)
StartupNotify=true StartupNotify=true
Hidden=false Hidden=false
NoDisplay=true NoDisplay=true

View File

@ -6,8 +6,8 @@ Terminal=false
Exec=/usr/bin/uengine-runner Exec=/usr/bin/uengine-runner
Icon=/opt/apps/uengine-runner/icon.png Icon=/opt/apps/uengine-runner/icon.png
Name=uengine runner Name=uengine runner
Comment=uengine runner Comment=UEngine Runner
Comment[zh]=uengine 运行器 Comment[zh]=UEngine 运行器
Name[zh]=uengine 运行器 Name[zh]=UEngine 运行器
StartupNotify=true StartupNotify=true
MimeType= MimeType=

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.env">
<message>Authentication is required to Run App</message>
<message xml:lang="zh_CN">使用对应的程序需要输入密码</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">/usr/bin/env</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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.rm">
<message>Authentication is required to Delete Files</message>
<message xml:lang="zh_CN">删除文件需要输入密码</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">/usr/bin/rm</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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://github.com/gfdgd-xi/uengine-runner/</vendor_url>
<action id="com.deepin.pkexec.uengine-bridge">
<message>Authentication is required to Setting UEngine Internet Bridge</message>
<message xml:lang="zh_CN">设置 UEngine 桥接需要输入密码</message>
<icon_name>kbox</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">/usr/bin/uengine-bridge.sh</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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.uengine-session-launch-helper">
<message>Authentication is required to Change UEngine</message>
<message xml:lang="zh_CN">设置 UEngine 需要输入密码</message>
<icon_name>kbox</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">/usr/bin/uengine-session-launch-helper</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

Binary file not shown.

View File

@ -3,10 +3,10 @@
"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.1", "Version": "1.4.2",
"System": "Linuxdeepin/UOS", "System": "Linuxdeepin/UOS",
"Tips": [ "Tips": [
" 新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的Uengine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。", "更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis",
"", "",
"安装APK点浏览按钮选中需要安装的APK然后点安装按钮", "安装APK点浏览按钮选中需要安装的APK然后点安装按钮",
"", "",
@ -14,20 +14,26 @@
"", "",
"保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可", "保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可",
"", "",
"键盘映射详细请查看uengine键盘映射主界面", "重置删除UEngine数据点击菜单栏的“UEngine”的“清空UEngine数据”输入密码重启即可",
" 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载UEngine配置了",
"", "",
"重置删除uengine数据点击菜单栏的“uengine”的“清空uengine数据”输入密码重启即可", "打开UEngine应用列表打开系统已安装的应用列表安卓界面",
" 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载uengine配置了",
"",
"打开Uengine应用列表打开系统已安装的应用列表安卓界面",
"", "",
"提示:", "提示:",
"1、需要你有使用 root 权限的能力;", "1、需要你有使用 root 权限的能力;",
"2、需要安装 uengine 才能使用;", "2、需要安装 UEngine 才能使用;",
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;", "3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
"4、如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。" "4、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁"
], ],
"Update": [ "Update": [
"V1.4.2",
"※1、添加adb破解补丁用于可以让adb连接UEngine并支持adb的部分操作;",
"2、菜单栏的项目添加以及外观优化;",
"3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
"4、把 uengine 改为 UEngine;",
"5、修改 pkexec 获取密码时显示的图标和文本;",
"6、添加了 UEngine 系统设置的快捷方式;",
"",
"V1.4.1", "V1.4.1",
"※1、初步支持键盘映射", "※1、初步支持键盘映射",
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件", "2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
@ -87,7 +93,7 @@
"暂无数据" "暂无数据"
], ],
"Use": [ "Use": [
"1、uengine相关软件包基于anbox开发", "1、UEngine相关软件包基于anbox开发",
"2、Python3", "2、Python3",
"3、tkintertkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk", "3、tkintertkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk",
"4、aapt", "4、aapt",
@ -96,9 +102,11 @@
"7、mkdir", "7、mkdir",
"8、echo", "8、echo",
"9、chmod", "9、chmod",
"10、adb",
"11、deepin 终端",
"……" "……"
], ],
"Time": "2021年08月26日", "Time": "2021年08月30日",
"Contribute": ["gfdgd xi<3025613752@qq.com>", "Contribute": ["gfdgd xi<3025613752@qq.com>",
"actionchen<917981399@qq.com>"] "actionchen<917981399@qq.com>"]
} }

195
main.py
View File

@ -11,7 +11,6 @@
################# #################
# 引入所需的库 # 引入所需的库
################# #################
from genericpath import exists
import os import os
import sys import sys
import time import time
@ -29,7 +28,7 @@ import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog import tkinter.filedialog as filedialog
import tkinter.simpledialog as simpledialog import tkinter.simpledialog as simpledialog
from getxmlimg import getsavexml from getxmlimg import getsavexml
from tkinter.constants import TOP
# 卸载程序 # 卸载程序
def UninstallProgram(package: "apk 包名")->"卸载程序": def UninstallProgram(package: "apk 包名")->"卸载程序":
@ -552,7 +551,7 @@ def get_home()->"获取用户主目录":
# 删除所有的 uengine 应用快捷方式 # 删除所有的 uengine 应用快捷方式
def CleanAllUengineDesktopLink(): 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.mkdir("{}/.local/share/applications/uengine".format(get_home()))
@ -573,6 +572,84 @@ def OpenUengineRootData():
def OpenUengineUserData(): def OpenUengineUserData():
threading.Thread(target=os.system, args=["xdg-open ~/安卓应用文件"]).start() threading.Thread(target=os.system, args=["xdg-open ~/安卓应用文件"]).start()
# 终端显示 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.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start()
# 杀死 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="完成!")
# 使用 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()
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")))
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()
# 添加/删除 uengine 应用快捷方式 # 添加/删除 uengine 应用快捷方式
class AddNewUengineDesktopLink(): class AddNewUengineDesktopLink():
addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity
@ -591,8 +668,9 @@ class AddNewUengineDesktopLink():
saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink) saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink)
delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink) delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink)
message.title("添加/删除 uengine 图标") message.title("添加/删除 UEngine 图标")
message.resizable(0, 0) message.resizable(0, 0)
message.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height # get screen width and height
screen_width = message.winfo_screenwidth() screen_width = message.winfo_screenwidth()
screen_height = message.winfo_screenheight() screen_height = message.winfo_screenheight()
@ -636,7 +714,7 @@ class AddNewUengineDesktopLink():
def DelDesktopLink(): def DelDesktopLink():
global packageName global packageName
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())): if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
messagebox.showerror(title="错误", message="此包名对应的uengine桌面快捷方式不存在!") messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
return return
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"): if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return return
@ -680,29 +758,42 @@ programUrl = information["Url"][0]
version = information["Version"] version = information["Version"]
goodRunSystem = information["System"] goodRunSystem = information["System"]
aaptVersion = GetCommandReturn("aapt version") aaptVersion = GetCommandReturn("aapt version")
about = ''' 一个基于 Python3 的 tkinter 制作的 uengine APK 运行器 about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器在新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。
版本 {} 版本 {}
适用平台 {} 适用平台 {}
tkinter版本{}
aapt 版本 {}
程序官网 {} 程序官网 {}
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, aaptVersion,programUrl, time.strftime("%Y")) ©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
tips = "\n".join(information["Tips"]) tips = "\n".join(information["Tips"])
updateThingsString = "\n".join(information["Update"]) updateThingsString = "\n".join(information["Update"])
title = "uengine 运行器 {}".format(version) title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"] updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) 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 = "\n".join(information["Use"]) 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"))
########################### ###########################
@ -752,7 +843,7 @@ def showhelp():
helpwindow=tk.Toplevel() helpwindow=tk.Toplevel()
helpwindow.resizable(0, 0) helpwindow.resizable(0, 0)
helpwindow.title("帮助") helpwindow.title("帮助")
helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height # get screen width and height
screen_width = helpwindow.winfo_screenwidth() screen_width = helpwindow.winfo_screenwidth()
@ -861,7 +952,7 @@ ComboInstallPath = ttk.Combobox(window, width=50)
ComboUninstallPath = ttk.Combobox(window, width=50) ComboUninstallPath = ttk.Combobox(window, width=50)
BtnFindApk = ttk.Button(FrmInstall, text="浏览", command=FindApk) BtnFindApk = ttk.Button(FrmInstall, text="浏览", command=FindApk)
BtnInstall = ttk.Button(FrmInstall, text="安装", command=Button3Install) BtnInstall = ttk.Button(FrmInstall, text="安装", command=Button3Install)
BtnShowUengineApp = ttk.Button(window, text="打开 uengine 应用列表", command=Button5Click) BtnShowUengineApp = ttk.Button(window, text="打开 UEngine 应用列表", command=Button5Click)
BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text="浏览", command=BtnFindUninstallApkClk) BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text="浏览", command=BtnFindUninstallApkClk)
BtnUninstall = ttk.Button(FrmUninstall, text="卸载", command=ButtonClick8) BtnUninstall = ttk.Button(FrmUninstall, text="卸载", command=ButtonClick8)
Btngeticon = ttk.Button(FrmInstall, text="保存图标", command=SaveIconToOtherPath) Btngeticon = ttk.Button(FrmInstall, text="保存图标", command=SaveIconToOtherPath)
@ -870,61 +961,91 @@ BtnSaveApk = ttk.Button(FrmInstall, text="保存apk", command=SaveInstallUengine
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") # 设置“程序”菜单栏
adb = tk.Menu(menu, tearoff=0, background="white")
uengine = tk.Menu(menu, tearoff=0, background="white") uengine = tk.Menu(menu, tearoff=0, background="white")
help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏 help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏
adbServer = tk.Menu(adb, tearoff=0, background="white")
uengineService = tk.Menu(uengine, tearoff=0, background="white") uengineService = tk.Menu(uengine, tearoff=0, background="white")
uengineInternet = tk.Menu(uengine, tearoff=0, background="white") uengineInternet = tk.Menu(uengine, tearoff=0, background="white")
uengineIcon = tk.Menu(uengine, tearoff=0, background="white") uengineIcon = tk.Menu(uengine, tearoff=0, background="white")
uengineUseAdb = tk.Menu(uengine, tearoff=0, background="white")
uengineData = tk.Menu(uengine, tearoff=0, background="white") uengineData = tk.Menu(uengine, tearoff=0, background="white")
menu.add_cascade(label="程序", menu=programmenu) menu.add_cascade(label="程序", menu=programmenu)
menu.add_cascade(label="uengine", menu=uengine) menu.add_cascade(label="adb", menu=adb)
menu.add_cascade(label="UEngine", menu=uengine)
menu.add_cascade(label="关于", menu=help) menu.add_cascade(label="关于", menu=help)
programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory) programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
programmenu.add_separator() # 设置分界线 programmenu.add_separator() # 设置分界线
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序” programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”
uengine.add_command(label="uengine 应用打包", command=OpenUengineDebBuilder) adb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
uengine.add_command(label="uengine 键盘映射", command=KeyboardToMouse) adb.add_separator()
uengine.add_cascade(label="uengine 服务", menu=uengineService) adb.add_cascade(label="adb 服务", menu=adbServer)
uengine.add_cascade(label="uengine 网络桥接", menu=uengineInternet) adb.add_command(label="显示 adb 连接的设备", command=AdbConnectDeviceShow)
uengine.add_cascade(label="uengine 快捷方式", menu=uengineIcon) adb.add_separator()
uengine.add_cascade(label="uengine 数据", menu=uengineData) adb.add_command(label="adb 查看 UEngine 应用列表", command=AdbAndroidInstallAppList)
adb.add_command(label="adb 查看 UEngine 资源使用情况", command=AdbCPUAndRAWShowInTer)
adb.add_command(label="打开 adb 连接 UEngine 的终端", command=AdbShellShowInTer)
adb.add_separator()
adb.add_cascade(label="UEngine 使用 adb", menu=uengineUseAdb)
adbServer.add_command(label="开启 adb 服务", command=AdbStartServer)
adbServer.add_command(label="关闭 adb 服务", command=AdbStopServer)
adbServer.add_command(label="杀死 adb 进程", command=AdbKillAdbProgress)
uengine.add_command(label="UEngine 系统设置", command=UengineSettingShow)
uengine.add_command(label="UEngine 应用打包", command=OpenUengineDebBuilder)
#uengine.add_command(label="UEngine 键盘映射", command=KeyboardToMouse)
uengine.add_cascade(label="UEngine 服务", menu=uengineService)
uengine.add_cascade(label="UEngine 网络桥接", menu=uengineInternet)
uengine.add_cascade(label="UEngine 快捷方式", menu=uengineIcon)
uengine.add_cascade(label="UEngine 使用 adb", menu=uengineUseAdb)
uengine.add_cascade(label="UEngine 数据", menu=uengineData)
help.add_command(label="程序官网", command=OpenProgramURL) # 设置“程序官网”项 help.add_command(label="程序官网", command=OpenProgramURL) # 设置“程序官网”项
help.add_command(label="帮助", command=showhelp) # 设置“关于这个程序”项 help.add_command(label="帮助", command=showhelp) # 设置“关于这个程序”项
uengineService.add_command(label="启用 uengine 服务", command=StartUengine) uengineService.add_command(label="启用 UEngine 服务(需要 root", command=StartUengine)
uengineService.add_command(label="关闭 uengine 服务", command=StopUengine) uengineService.add_command(label="关闭 UEngine 服务(需要 root", command=StopUengine)
uengineService.add_command(label="重启 uengine 服务", command=UengineRestart) uengineService.add_command(label="重启 UEngine 服务(需要 root", command=UengineRestart)
uengineInternet.add_command(label="启用 uengine 网络桥接", command=UengineBridgeStart) uengineInternet.add_command(label="启用 UEngine 网络桥接(需要 root", command=UengineBridgeStart)
uengineInternet.add_command(label="关闭 uengine 网络桥接", command=UengineBridgeStop) uengineInternet.add_command(label="关闭 UEngine 网络桥接(需要 root", command=UengineBridgeStop)
uengineInternet.add_command(label="重启 uengine 网络桥接", command=UengineBridgeRestart) uengineInternet.add_command(label="重启 UEngine 网络桥接(需要 root", command=UengineBridgeRestart)
uengineInternet.add_command(label="加载 uengine 网络桥接", command=UengineBridgeReload) uengineInternet.add_command(label="加载 UEngine 网络桥接(需要 root", command=UengineBridgeReload)
uengineInternet.add_command(label="强制加载 uengine 网络桥接", command=UengineBridgeForceReload) uengineInternet.add_command(label="强制加载 UEngine 网络桥接(需要 root", command=UengineBridgeForceReload)
uengineIcon.add_command(label="发送 uengine 应用列表到桌面", command=SendUengineAndroidListForDesktop) uengineIcon.add_command(label="发送 UEngine 应用列表到桌面", command=SendUengineAndroidListForDesktop)
uengineIcon.add_command(label="发送 uengine 应用列表到启动器", command=SendUengineAndroidListForLauncher) uengineIcon.add_command(label="发送 UEngine 应用列表到启动器", command=SendUengineAndroidListForLauncher)
uengineIcon.add_separator() uengineIcon.add_separator()
uengineIcon.add_command(label="添加/删除指定的 uengine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow) uengineIcon.add_command(label="添加/删除指定的 UEngine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow)
uengineIcon.add_separator() uengineIcon.add_separator()
uengineIcon.add_command(label="清空所有 uengine 快捷方式", command=CleanAllUengineDesktopLink) uengineIcon.add_command(label="清空所有 UEngine 快捷方式", command=CleanAllUengineDesktopLink)
uengineData.add_command(label="打开 uengine 根目录", command=OpenUengineRootData) uengineUseAdb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
uengineData.add_command(label="打开 uengine 用户数据目录", command=OpenUengineUserData) uengineUseAdb.add_separator()
uengineUseAdb.add_command(label="允许此设备使用 adb 连接本 UEngine需要 root", command=UengineUseAdb)
uengineUseAdb.add_command(label="禁止任何设备使用 adb 连接本 UEngine需要 root", command=UengineDoNotUseAdb)
uengineData.add_command(label="打开 UEngine 根目录", command=OpenUengineRootData)
uengineData.add_command(label="打开 UEngine 用户数据目录", command=OpenUengineUserData)
uengineData.add_separator() uengineData.add_separator()
uengineData.add_command(label="清空 uengine 数据", command=BackUengineClean) uengineData.add_command(label="清空 UEngine 数据(需要 root", command=BackUengineClean)
menu.configure(activebackground="dodgerblue") menu.configure(activebackground="dodgerblue")
help.configure(activebackground="dodgerblue") help.configure(activebackground="dodgerblue")
adb.configure(activebackground="dodgerblue")
uengine.configure(activebackground="dodgerblue") uengine.configure(activebackground="dodgerblue")
programmenu.configure(activebackground="dodgerblue") programmenu.configure(activebackground="dodgerblue")
uengineService.configure(activebackground="dodgerblue") uengineService.configure(activebackground="dodgerblue")
uengineInternet.configure(activebackground="dodgerblue") uengineInternet.configure(activebackground="dodgerblue")
uengineIcon.configure(activebackground="dodgerblue") uengineIcon.configure(activebackground="dodgerblue")
uengineUseAdb.configure(activebackground="dodgerblue")
uengineData.configure(activebackground="dodgerblue")
# 设置控件 # 设置控件
ComboUninstallPath['value'] = fineUninstallApkHistory ComboUninstallPath['value'] = fineUninstallApkHistory

View File

@ -1,11 +1,11 @@
Package: com.gitee.uengine.runner.spark Package: com.gitee.uengine.runner.spark
Source: spark-uengine-runner Source: com.gitee.uengine.runner.spark
Version: 1.4.1 Version: 1.4.2
Architecture: all Architecture: all
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com> Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>
Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, adb, python3-pil, python3-setuptools, uengine Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, adb, python3-pil, python3-setuptools, uengine, deepin-terminal
Section: utils Section: utils
Priority: optional Priority: optional
Conflicts: spark-uengine-runner, spark-uengine-apk-builder Conflicts: spark-uengine-runner, spark-uengine-apk-builder
Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner] Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner]
Description: uengine runner for deepin and UOS Description: UEngine Runner for deepin and UOS

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
# 使用 pip 安装所需库 # 使用 pip 安装所需库
python3 -m pip install --upgrade ttkthemes python3 -m pip install --upgrade ttkthemes
python3 -m pip install --upgrade requests
python3 -m pip install --upgrade pyautogui python3 -m pip install --upgrade pyautogui
python3 -m pip install --upgrade keyboard python3 -m pip install --upgrade keyboard
# 建立软链接 # 建立软链接
@ -11,3 +12,4 @@ ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install /usr/
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean /usr/bin/uengine-clean ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean /usr/bin/uengine-clean
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about /usr/bin/uengine-runner-about ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about /usr/bin/uengine-runner-about
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard /usr/bin/uengine-keyboard ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard /usr/bin/uengine-keyboard
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb /usr/bin/uengine-useadb

View File

@ -1,11 +1,11 @@
[Desktop Entry] [Desktop Entry]
Categories=System; Categories=System;
Comment=uengineanbox 程序菜单 Comment=UEngineanbox 程序菜单
Encoding=UTF-8 Encoding=UTF-8
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
MimeType= MimeType=
Name=uengine 程序菜单 Name=UEngine 程序菜单
StartupWMClass=uengine 程序菜单 StartupWMClass=UEngine 程序菜单
Terminal=false Terminal=false
Type=Application Type=Application

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Categories=System;
Comment=UEngine 系统设置
Encoding=UTF-8
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
MimeType=
Name=UEngine 系统设置
StartupWMClass=UEngine 系统设置
Terminal=false
Type=Application

View File

@ -6,9 +6,9 @@ Terminal=false
Exec=/usr/bin/uengine-runner -i %F Exec=/usr/bin/uengine-runner -i %F
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
Name=Install APK(uengine runner) Name=Install APK(uengine runner)
Comment=Install APK(uengine runner) Comment=Install APK(UEngine runner)
Comment[zh]=安装 APKuengine 运行器) Comment[zh]=安装 APKUEngine 运行器)
Name[zh]=安装 APKuengine 运行器) Name[zh]=安装 APKUEngine 运行器)
StartupNotify=true StartupNotify=true
Hidden=false Hidden=false
NoDisplay=true NoDisplay=true

View File

@ -5,10 +5,10 @@ Categories=System;
Terminal=false Terminal=false
Exec=/usr/bin/uengine-runner -u %F Exec=/usr/bin/uengine-runner -u %F
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
Name=Uninstall APK(uengine runner) Name=Uninstall APK(UEngine runner)
Comment=Uninstall APK(uengine runner) Comment=Uninstall APK(UEngine runner)
Comment[zh]=卸载 APKuengine 运行器) Comment[zh]=卸载 APKUEngine 运行器)
Name[zh]=卸载 APKuengine 运行器) Name[zh]=卸载 APKUEngine 运行器)
StartupNotify=true StartupNotify=true
Hidden=false Hidden=false
NoDisplay=true NoDisplay=true

View File

@ -6,8 +6,8 @@ Terminal=false
Exec=/usr/bin/uengine-runner Exec=/usr/bin/uengine-runner
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
Name=uengine runner Name=uengine runner
Comment=uengine runner Comment=UEngine Runner
Comment[zh]=uengine 运行器 Comment[zh]=UEngine 运行器
Name[zh]=uengine 运行器 Name[zh]=UEngine 运行器
StartupNotify=true StartupNotify=true
MimeType= MimeType=

View File

@ -1,11 +1,11 @@
[Desktop Entry] [Desktop Entry]
Categories=System; Categories=System;
Comment=uengineanbox 程序菜单 Comment=UEngine 程序菜单
Encoding=UTF-8 Encoding=UTF-8
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
MimeType= MimeType=
Name=uengine 程序菜单 Name=UEngine 程序菜单
StartupWMClass=uengine 程序菜单 StartupWMClass=UEngine 程序菜单
Terminal=false Terminal=false
Type=Application Type=Application

View File

@ -3,10 +3,10 @@
"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.1", "Version": "1.4.2",
"System": "Linuxdeepin/UOS", "System": "Linuxdeepin/UOS",
"Tips": [ "Tips": [
" 新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的Uengine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。", "更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis",
"", "",
"安装APK点浏览按钮选中需要安装的APK然后点安装按钮", "安装APK点浏览按钮选中需要安装的APK然后点安装按钮",
"", "",
@ -14,20 +14,26 @@
"", "",
"保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可", "保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可",
"", "",
"键盘映射详细请查看uengine键盘映射主界面", "重置删除UEngine数据点击菜单栏的“UEngine”的“清空UEngine数据”输入密码重启即可",
" 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载UEngine配置了",
"", "",
"重置删除uengine数据点击菜单栏的“uengine”的“清空uengine数据”输入密码重启即可", "打开UEngine应用列表打开系统已安装的应用列表安卓界面",
" 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载uengine配置了",
"",
"打开Uengine应用列表打开系统已安装的应用列表安卓界面",
"", "",
"提示:", "提示:",
"1、需要你有使用 root 权限的能力;", "1、需要你有使用 root 权限的能力;",
"2、需要安装 uengine 才能使用;", "2、需要安装 UEngine 才能使用;",
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;", "3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
"4、如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。" "4、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁"
], ],
"Update": [ "Update": [
"V1.4.2",
"※1、添加adb破解补丁用于可以让adb连接UEngine并支持adb的部分操作;",
"2、菜单栏的项目添加以及外观优化;",
"3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
"4、把 uengine 改为 UEngine;",
"5、修改 pkexec 获取密码时显示的图标和文本;",
"6、添加了 UEngine 系统设置的快捷方式;",
"",
"V1.4.1", "V1.4.1",
"※1、初步支持键盘映射", "※1、初步支持键盘映射",
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件", "2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
@ -87,7 +93,7 @@
"暂无数据" "暂无数据"
], ],
"Use": [ "Use": [
"1、uengine相关软件包基于anbox开发", "1、UEngine相关软件包基于anbox开发",
"2、Python3", "2、Python3",
"3、tkintertkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk", "3、tkintertkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk",
"4、aapt", "4、aapt",
@ -96,9 +102,11 @@
"7、mkdir", "7、mkdir",
"8、echo", "8、echo",
"9、chmod", "9、chmod",
"10、adb",
"11、deepin 终端",
"……" "……"
], ],
"Time": "2021年08月26日", "Time": "2021年08月30日",
"Contribute": ["gfdgd xi<3025613752@qq.com>", "Contribute": ["gfdgd xi<3025613752@qq.com>",
"actionchen<917981399@qq.com>"] "actionchen<917981399@qq.com>"]
} }

File diff suppressed because it is too large Load Diff

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.1", "Version": "1.4.2",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
} }

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.3.3 # 版本1.4.2
# 更新时间2021年8月19 # 更新时间2021年8月30
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -374,7 +374,7 @@ def get_home():
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(programPath + "/information.json")) information = json.loads(readtxt(programPath + "/information.json"))
version = information["Version"] version = information["Version"]
title = "uengine APK 应用打包器 {}".format(version) title = "UEngine APK 应用打包器 {}".format(version)
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
########################### ###########################

View File

@ -4,7 +4,7 @@ import sys
if len(sys.argv) > 1: if len(sys.argv) > 1:
if sys.argv[1] == "--help": if sys.argv[1] == "--help":
print("帮助:") print("帮助:")
print("输入命令即可清空/重置uengine") print("输入命令即可清空/重置UEngine")
sys.exit(0) sys.exit(0)
print("参数错误") print("参数错误")
sys.exit(1) sys.exit(1)

View File

@ -2,6 +2,7 @@
######################################### #########################################
# 版本1.4.0 # 版本1.4.0
# 更新时间2021年08月26日 # 更新时间2021年08月26日
# Need: unix, python3-tk, python3-pip, pymouse, keyboard
######################################### #########################################
import os import os
import sys import sys
@ -17,17 +18,19 @@ import tkinter as tk
import tkinter.ttk as ttk import tkinter.ttk as ttk
import tkinter.messagebox as messagebox import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog import tkinter.filedialog as filedialog
import Xlib.threaded as threaded
#import pymouse.unix as pymouse
######################## ########################
# #
######################## ########################
def Inputt(key): def Inputt(key):
if key.event_type == "down": if key.event_type == "up":
global setting global setting
if setting: if setting:
Setting(key) Setting(key)
else: else:
Mouse(key) Mouse(key)
#Mouse(key)
def Open(): def Open():
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]]) path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
@ -49,9 +52,14 @@ def ReStartProgram()->"重启本应用程序":
def Mouse(key): def Mouse(key):
print(keybo)
if keybo.__contains__(key.name): if keybo.__contains__(key.name):
print(keybo[key.name]["MousePlace"]) print(keybo[key.name]["MousePlace"])
pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]) pyautogui.FAILSAFE = False
#os.system(programPath + "/mouse.py {} {}".format(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]))
#pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])
pyautogui.click(1500, 800)
#m.click(keybo[key.name]["MousePlace"][0],keybo[key.name]["MousePlace"][1])
def Setting(key): def Setting(key):
if key.event_type == 'up': if key.event_type == 'up':
@ -84,10 +92,15 @@ def ShowTips():
time.sleep(0.1) time.sleep(0.1)
ShowTips() ShowTips()
except: except:
pass traceback.print_exc()
if not close:
ShowTips()
def Closing():
close = True
window.destroy()
def Key(): def Key():
global inputs
keyboard.hook(Inputt) keyboard.hook(Inputt)
# 获取用户主目录 # 获取用户主目录
@ -96,10 +109,6 @@ def get_home()->"获取用户主目录":
# 写入文本文档 # 写入文本文档
def write_txt(path: "路径", things: "内容")->"写入文本文档": def write_txt(path: "路径", things: "内容")->"写入文本文档":
TxtDir = os.path.dirname(path)
print(TxtDir)
if not os.path.exists(TxtDir):
os.makedirs(TxtDir,exist_ok=True)
file = open(path, 'w', encoding='UTF-8') # 设置文件对象 file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本 file.write(things) # 写入文本
file.close() # 关闭文本对象 file.close() # 关闭文本对象
@ -136,6 +145,7 @@ if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home()))
# #
################### ###################
setting = False setting = False
close = False
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home()))) keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home())))
@ -175,9 +185,10 @@ settingMouseToKeyboard.configure(state=tk.DISABLED)
style = ttkthemes.ThemedStyle(window) style = ttkthemes.ThemedStyle(window)
style.set_theme("breeze") style.set_theme("breeze")
window.protocol('WM_DELETE_WINDOW', Closing)
window.resizable(0, 0) window.resizable(0, 0)
window.iconphoto(False, tk.PhotoImage(file=iconPath)) window.iconphoto(False, tk.PhotoImage(file=iconPath))
window.title("uengine 键盘映射 {}".format(version)) window.title("UEngine 键盘映射 {}".format(version))
menu.add_cascade(label="程序", menu=programMenu) menu.add_cascade(label="程序", menu=programMenu)
menu.add_cascade(label="帮助", menu=aboutMenu) menu.add_cascade(label="帮助", menu=aboutMenu)
@ -202,8 +213,15 @@ settingMouseToKeyboard.grid(row=0, column=0)
settingButton.grid(row=0, column=1) settingButton.grid(row=0, column=1)
win.pack(fill="both", expand="yes") win.pack(fill="both", expand="yes")
#threaded.lock.allocate_lock()
threading.Thread(target=Key).start() threading.Thread(target=Key).start()
threading.Thread(target=ShowTips).start() threading.Thread(target=ShowTips).start()
pyautogui.FAILSAFE = False
'''def B(key):
if key.event_type == "up":
print(pyautogui.position())
print(key.name)
pyautogui.click(1500, 800)
keyboard.hook(B)
keyboard.wait()'''
window.mainloop() window.mainloop()

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.3.3 # 版本1.4.2
# 更新时间2021年8月19 # 更新时间2021年8月30
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -34,29 +34,42 @@ programUrl = information["Url"][0]
version = information["Version"] version = information["Version"]
goodRunSystem = information["System"] goodRunSystem = information["System"]
aaptVersion = subprocess.getoutput("aapt version") aaptVersion = subprocess.getoutput("aapt version")
about = ''' 一个基于 Python3 的 tkinter 制作的 uengine APK 运行器 about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器在新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。
版本 {} 版本 {}
适用平台 {} 适用平台 {}
tkinter版本{}
aapt 版本 {}
程序官网 {} 程序官网 {}
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, aaptVersion,programUrl, time.strftime("%Y")) ©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
tips = "\n".join(information["Tips"]) tips = "\n".join(information["Tips"])
updateThingsString = "\n".join(information["Update"]) updateThingsString = "\n".join(information["Update"])
title = "uengine 运行器 {}".format(version) title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"] updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) 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 = "\n".join(information["Use"]) useProgram = '''1、UEngine{}
2、python3{}
3、tkinter{}
4、aapt{}
5、dpkg{}
6、mkdir{}
7、echo
8、chmod{}
9、adb{}
10、deepin 终端:{}'''.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"))
# add sub window # add sub window
#添加窗口开启关闭开关,防止重复开启 #添加窗口开启关闭开关,防止重复开启

View File

@ -0,0 +1,83 @@
#!/usr/bin/env python3
#########################################
# 版本1.4.2
# 更新时间2021年08月30日
#########################################
import os
import shutil
import sys
import traceback
import ttkthemes
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
########################
#
########################
# 写入文本文档
def write_txt(path: "路径", things: "内容")->"写入文本文档":
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
# 读取文本文档
def readtxt(path: "路径")->"读取文本文档":
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
###################
# 判断是不是 root
###################
if os.geteuid() != 0:
print("不是以 root 权限运行本程序!")
root = tk.Tk()
root.overrideredirect(1)
root.withdraw()
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
sys.exit(1)
###################
#
###################
window = tk.Tk()
style = ttkthemes.ThemedStyle(window)
style.set_theme("breeze")
window.overrideredirect(1)
window.withdraw()
try:
if sys.argv[1] == "1" and messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
os.remove("/data/uengine/data/data/misc/adb/adb_keys")
messagebox.showinfo(title="提示", message="完成")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
sys.exit(2)
if sys.argv[1] == "1":
sys.exit(0)
if not messagebox.askyesno(title="提示", message='''请阅读以下提示然后确定是否继续:
1、安装后即可使用 adb 连接 UEngine;
2、重置 UEngine 或 adb 就需要重新设置该支持补丁;
3、需要 root 权限;'''):
sys.exit(0)
# 写入(需要 root
if not os.path.exists("/data/uengine/data/data/misc/adb"):
messagebox.showerror(title="错误", message="无法读取 UEngine 数据!")
sys.exit(1)
try:
things = readtxt(sys.argv[2])
adbKey = []
# 提取内容
for i in things.split('\n'):
adbKey.append(i[0: i.find(" ")])
old = ""
if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n"
write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey))
messagebox.showinfo(title="提示", message="完成")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
sys.exit(2)

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.env">
<message>Authentication is required to Run App</message>
<message xml:lang="zh_CN">使用对应的程序需要输入密码</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">/usr/bin/env</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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.rm">
<message>Authentication is required to Delete Files</message>
<message xml:lang="zh_CN">删除文件需要输入密码</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">/usr/bin/rm</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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://github.com/gfdgd-xi/uengine-runner/</vendor_url>
<action id="com.deepin.pkexec.uengine-bridge">
<message>Authentication is required to Setting UEngine Internet Bridge</message>
<message xml:lang="zh_CN">设置 UEngine 桥接需要输入密码</message>
<icon_name>kbox</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">/usr/bin/uengine-bridge.sh</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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.uengine-session-launch-helper">
<message>Authentication is required to Change UEngine</message>
<message xml:lang="zh_CN">设置 UEngine 需要输入密码</message>
<icon_name>kbox</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">/usr/bin/uengine-session-launch-helper</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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.env">
<message>Authentication is required to Run App</message>
<message xml:lang="zh_CN">使用对应的程序需要输入密码</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">/usr/bin/env</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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.rm">
<message>Authentication is required to Delete Files</message>
<message xml:lang="zh_CN">删除文件需要输入密码</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">/usr/bin/rm</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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://github.com/gfdgd-xi/uengine-runner/</vendor_url>
<action id="com.deepin.pkexec.uengine-bridge">
<message>Authentication is required to Setting UEngine Internet Bridge</message>
<message xml:lang="zh_CN">设置 UEngine 桥接需要输入密码</message>
<icon_name>kbox</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">/usr/bin/uengine-bridge.sh</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

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.uengine-session-launch-helper">
<message>Authentication is required to Change UEngine</message>
<message xml:lang="zh_CN">设置 UEngine 需要输入密码</message>
<icon_name>kbox</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">/usr/bin/uengine-session-launch-helper</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

2
setting-new.json Normal file → Executable file
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.1", "Version": "1.4.2",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
} }

2
setting.json Normal file → Executable file
View File

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

Binary file not shown.

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.3.3 # 版本1.4.2
# 更新时间2021年8月19 # 更新时间2021年8月30
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -374,7 +374,7 @@ def get_home():
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(programPath + "/information.json")) information = json.loads(readtxt(programPath + "/information.json"))
version = information["Version"] version = information["Version"]
title = "uengine APK 应用打包器 {}".format(version) title = "UEngine APK 应用打包器 {}".format(version)
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
########################### ###########################

View File

@ -4,7 +4,7 @@ import sys
if len(sys.argv) > 1: if len(sys.argv) > 1:
if sys.argv[1] == "--help": if sys.argv[1] == "--help":
print("帮助:") print("帮助:")
print("输入命令即可清空/重置uengine") print("输入命令即可清空/重置UEngine")
sys.exit(0) sys.exit(0)
print("参数错误") print("参数错误")
sys.exit(1) sys.exit(1)

View File

@ -2,15 +2,15 @@
Categories=system;Utility; Categories=system;Utility;
Encoding=UTF-8 Encoding=UTF-8
Exec=uengine-runner -ci %F Exec=uengine-runner -ci %F
GenericName=APK 安装uengine GenericName=APK Install(UEngine)
GenericName[zh_CN]=APK 安装(uengine GenericName[zh_CN]=APK 安装(UEngine
Icon=/opt/apps/uengine-runner/icon.png Icon=/opt/apps/uengine-runner/icon.png
MimeType=application/apk; MimeType=application/apk;
Name=APK 安装uengine Name=APK Install(UEngine)
Name[zh_CN]=APK 安装(uengine Name[zh_CN]=APK 安装(UEngine
NoDisplay=true NoDisplay=true
OnlyShowIn=Unity; OnlyShowIn=Unity;
StartupNotify=false StartupNotify=false
StartupWMClass=APK 安装(uengine StartupWMClass=APK 安装(UEngine
Terminal=false Terminal=false
Type=Application Type=Application

View File

@ -2,6 +2,7 @@
######################################### #########################################
# 版本1.4.0 # 版本1.4.0
# 更新时间2021年08月26日 # 更新时间2021年08月26日
# Need: unix, python3-tk, python3-pip, pymouse, keyboard
######################################### #########################################
import os import os
import sys import sys
@ -17,17 +18,19 @@ import tkinter as tk
import tkinter.ttk as ttk import tkinter.ttk as ttk
import tkinter.messagebox as messagebox import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog import tkinter.filedialog as filedialog
import Xlib.threaded as threaded
#import pymouse.unix as pymouse
######################## ########################
# #
######################## ########################
def Inputt(key): def Inputt(key):
if key.event_type == "down": if key.event_type == "up":
global setting global setting
if setting: if setting:
Setting(key) Setting(key)
else: else:
Mouse(key) Mouse(key)
#Mouse(key)
def Open(): def Open():
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]]) path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
@ -49,9 +52,14 @@ def ReStartProgram()->"重启本应用程序":
def Mouse(key): def Mouse(key):
print(keybo)
if keybo.__contains__(key.name): if keybo.__contains__(key.name):
print(keybo[key.name]["MousePlace"]) print(keybo[key.name]["MousePlace"])
pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]) pyautogui.FAILSAFE = False
#os.system(programPath + "/mouse.py {} {}".format(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]))
#pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])
pyautogui.click(1500, 800)
#m.click(keybo[key.name]["MousePlace"][0],keybo[key.name]["MousePlace"][1])
def Setting(key): def Setting(key):
if key.event_type == 'up': if key.event_type == 'up':
@ -84,10 +92,15 @@ def ShowTips():
time.sleep(0.1) time.sleep(0.1)
ShowTips() ShowTips()
except: except:
pass traceback.print_exc()
if not close:
ShowTips()
def Closing():
close = True
window.destroy()
def Key(): def Key():
global inputs
keyboard.hook(Inputt) keyboard.hook(Inputt)
# 获取用户主目录 # 获取用户主目录
@ -96,10 +109,6 @@ def get_home()->"获取用户主目录":
# 写入文本文档 # 写入文本文档
def write_txt(path: "路径", things: "内容")->"写入文本文档": def write_txt(path: "路径", things: "内容")->"写入文本文档":
TxtDir = os.path.dirname(path)
print(TxtDir)
if not os.path.exists(TxtDir):
os.makedirs(TxtDir,exist_ok=True)
file = open(path, 'w', encoding='UTF-8') # 设置文件对象 file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本 file.write(things) # 写入文本
file.close() # 关闭文本对象 file.close() # 关闭文本对象
@ -136,6 +145,7 @@ if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home()))
# #
################### ###################
setting = False setting = False
close = False
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home()))) keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home())))
@ -175,9 +185,10 @@ settingMouseToKeyboard.configure(state=tk.DISABLED)
style = ttkthemes.ThemedStyle(window) style = ttkthemes.ThemedStyle(window)
style.set_theme("breeze") style.set_theme("breeze")
window.protocol('WM_DELETE_WINDOW', Closing)
window.resizable(0, 0) window.resizable(0, 0)
window.iconphoto(False, tk.PhotoImage(file=iconPath)) window.iconphoto(False, tk.PhotoImage(file=iconPath))
window.title("uengine 键盘映射 {}".format(version)) window.title("UEngine 键盘映射 {}".format(version))
menu.add_cascade(label="程序", menu=programMenu) menu.add_cascade(label="程序", menu=programMenu)
menu.add_cascade(label="帮助", menu=aboutMenu) menu.add_cascade(label="帮助", menu=aboutMenu)
@ -202,8 +213,15 @@ settingMouseToKeyboard.grid(row=0, column=0)
settingButton.grid(row=0, column=1) settingButton.grid(row=0, column=1)
win.pack(fill="both", expand="yes") win.pack(fill="both", expand="yes")
#threaded.lock.allocate_lock()
threading.Thread(target=Key).start() threading.Thread(target=Key).start()
threading.Thread(target=ShowTips).start() threading.Thread(target=ShowTips).start()
pyautogui.FAILSAFE = False
'''def B(key):
if key.event_type == "up":
print(pyautogui.position())
print(key.name)
pyautogui.click(1500, 800)
keyboard.hook(B)
keyboard.wait()'''
window.mainloop() window.mainloop()

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.3.3 # 版本1.4.2
# 更新时间2021年8月19 # 更新时间2021年8月30
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -34,29 +34,42 @@ programUrl = information["Url"][0]
version = information["Version"] version = information["Version"]
goodRunSystem = information["System"] goodRunSystem = information["System"]
aaptVersion = subprocess.getoutput("aapt version") aaptVersion = subprocess.getoutput("aapt version")
about = ''' 一个基于 Python3 的 tkinter 制作的 uengine APK 运行器 about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器在新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。
版本 {} 版本 {}
适用平台 {} 适用平台 {}
tkinter版本{}
aapt 版本 {}
程序官网 {} 程序官网 {}
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, aaptVersion,programUrl, time.strftime("%Y")) ©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
tips = "\n".join(information["Tips"]) tips = "\n".join(information["Tips"])
updateThingsString = "\n".join(information["Update"]) updateThingsString = "\n".join(information["Update"])
title = "uengine 运行器 {}".format(version) title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"] updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) 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 = "\n".join(information["Use"]) useProgram = '''1、UEngine{}
2、python3{}
3、tkinter{}
4、aapt{}
5、dpkg{}
6、mkdir{}
7、echo
8、chmod{}
9、adb{}
10、deepin 终端:{}'''.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"))
# add sub window # add sub window
#添加窗口开启关闭开关,防止重复开启 #添加窗口开启关闭开关,防止重复开启

83
uengine-useadb Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env python3
#########################################
# 版本1.4.2
# 更新时间2021年08月30日
#########################################
import os
import shutil
import sys
import traceback
import ttkthemes
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
########################
#
########################
# 写入文本文档
def write_txt(path: "路径", things: "内容")->"写入文本文档":
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
# 读取文本文档
def readtxt(path: "路径")->"读取文本文档":
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
###################
# 判断是不是 root
###################
if os.geteuid() != 0:
print("不是以 root 权限运行本程序!")
root = tk.Tk()
root.overrideredirect(1)
root.withdraw()
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
sys.exit(1)
###################
#
###################
window = tk.Tk()
style = ttkthemes.ThemedStyle(window)
style.set_theme("breeze")
window.overrideredirect(1)
window.withdraw()
try:
if sys.argv[1] == "1" and messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
os.remove("/data/uengine/data/data/misc/adb/adb_keys")
messagebox.showinfo(title="提示", message="完成")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
sys.exit(2)
if sys.argv[1] == "1":
sys.exit(0)
if not messagebox.askyesno(title="提示", message='''请阅读以下提示然后确定是否继续:
1、安装后即可使用 adb 连接 UEngine;
2、重置 UEngine 或 adb 就需要重新设置该支持补丁;
3、需要 root 权限;'''):
sys.exit(0)
# 写入(需要 root
if not os.path.exists("/data/uengine/data/data/misc/adb"):
messagebox.showerror(title="错误", message="无法读取 UEngine 数据!")
sys.exit(1)
try:
things = readtxt(sys.argv[2])
adbKey = []
# 提取内容
for i in things.split('\n'):
adbKey.append(i[0: i.find(" ")])
old = ""
if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n"
write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey))
messagebox.showinfo(title="提示", message="完成")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
sys.exit(2)

0
update-console.py Normal file → Executable file
View File