diff --git a/README.md b/README.md
index 429378b..4feda06 100755
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# 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)
(测试平台:UOS 家庭版,deepin 20.2.2,UOS 专业版 1040)
(自己美术功底太差,图标直接用 anbox 的了)
@@ -115,7 +115,7 @@ pip3 uninstall ttkthemes
### 使用说明
1、需要你有使用 root 权限的能力;
-2、需要安装 uengine 才能使用,UOS建议在商店安装一个安卓应用,让系统自动安装uengine及相关的依赖包;
+2、需要安装 UEngine 才能使用,UOS建议在商店安装一个安卓应用,让系统自动安装 UEngine 及相关的依赖包;
3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;
4、如果报错是有关产生 .deksotp 文件有关,一般可以打开程序列表运行。如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。
diff --git a/UengineAndroidProgramList.desktop b/UengineAndroidProgramList.desktop
index 1b126d3..a8821d7 100755
--- a/UengineAndroidProgramList.desktop
+++ b/UengineAndroidProgramList.desktop
@@ -1,11 +1,11 @@
[Desktop Entry]
Categories=System;
-Comment=uengine(anbox) 程序菜单
+Comment=UEngine 程序菜单
Encoding=UTF-8
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
Icon=/opt/apps/uengine-runner/icon.png
MimeType=
-Name=uengine 程序菜单
-StartupWMClass=uengine 程序菜单
+Name=UEngine 程序菜单
+StartupWMClass=UEngine 程序菜单
Terminal=false
Type=Application
diff --git a/build/DEBIAN/control b/build/DEBIAN/control
index d64a41b..87dea6d 100644
--- a/build/DEBIAN/control
+++ b/build/DEBIAN/control
@@ -1,10 +1,10 @@
Package: spark-uengine-runner
-Version: 1.4.1
+Version: 1.4.2
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]
Architecture: all
Priority: optional
Conflicts: com.gitee.uengine.runner.spark, spark-uengine-apk-builder
-Depends: python3, python3-tk, python3-pip, aapt, uengine, python3-pil, python3-setuptools
-Description: uengine runner for deepin and UOS
+Depends: python3, python3-tk, python3-pip, aapt, uengine, python3-pil, python3-setuptools, deepin-terminal
+Description: UEngine Runner for deepin and UOS
diff --git a/build/DEBIAN/postinst b/build/DEBIAN/postinst
index 2c7120e..cd4e620 100755
--- a/build/DEBIAN/postinst
+++ b/build/DEBIAN/postinst
@@ -2,3 +2,4 @@
python3 -m pip install --upgrade ttkthemes
python3 -m pip install --upgrade pyautogui
python3 -m pip install --upgrade keyboard
+python3 -m pip install --upgrade requests
diff --git a/build/opt/apps/uengine-runner/information.json b/build/opt/apps/uengine-runner/information.json
index c8211b6..29fd2b9 100755
--- a/build/opt/apps/uengine-runner/information.json
+++ b/build/opt/apps/uengine-runner/information.json
@@ -3,10 +3,10 @@
"https://gitee.com/gfdgd-xi/uengine-runner",
"https://github.com/gfdgd-xi/uengine-runner"
],
- "Version": "1.4.1",
+ "Version": "1.4.2",
"System": "Linux(deepin/UOS)",
"Tips": [
- " 新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的Uengine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。",
+ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis",
"",
"安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮",
"",
@@ -14,20 +14,26 @@
"",
"保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可",
"",
- "键盘映射:详细请查看uengine键盘映射主界面",
+ "重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可",
+ " 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了",
"",
- "重置(删除)uengine数据:点击菜单栏的“uengine”的“清空uengine数据”,输入密码重启即可",
- " 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载uengine配置了",
- "",
- "打开Uengine应用列表:打开系统已安装的应用列表(安卓界面)",
+ "打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)",
"",
"提示:",
"1、需要你有使用 root 权限的能力;",
- "2、需要安装 uengine 才能使用;",
+ "2、需要安装 UEngine 才能使用;",
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
- "4、如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。"
+ "4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
],
"Update": [
+ "V1.4.2:",
+ "※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;",
+ "2、菜单栏的项目添加以及外观优化;",
+ "3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
+ "4、把 uengine 改为 UEngine;",
+ "5、修改 pkexec 获取密码时显示的图标和文本;",
+ "6、添加了 UEngine 系统设置的快捷方式;",
+ "",
"V1.4.1:",
"※1、初步支持键盘映射",
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
@@ -87,7 +93,7 @@
"暂无数据"
],
"Use": [
- "1、uengine相关软件包(基于anbox开发)",
+ "1、UEngine相关软件包(基于anbox开发)",
"2、Python3",
"3、tkinter(tkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk)",
"4、aapt",
@@ -96,9 +102,11 @@
"7、mkdir",
"8、echo",
"9、chmod",
+ "10、adb",
+ "11、deepin 终端",
"……"
],
- "Time": "2021年08月26日",
+ "Time": "2021年08月30日",
"Contribute": ["gfdgd xi<3025613752@qq.com>",
"actionchen<917981399@qq.com>"]
}
\ No newline at end of file
diff --git a/build/opt/apps/uengine-runner/setting.json b/build/opt/apps/uengine-runner/setting.json
old mode 100644
new mode 100755
index 68321b4..eb69668
--- a/build/opt/apps/uengine-runner/setting.json
+++ b/build/opt/apps/uengine-runner/setting.json
@@ -1,7 +1,7 @@
{
"Package": "spark-uengine-runner",
"Update": true,
- "Version": "1.4.1",
+ "Version": "1.4.2",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
}
\ No newline at end of file
diff --git a/build/opt/apps/uengine-runner/uengine-apk-builder b/build/opt/apps/uengine-runner/uengine-apk-builder
index 6d2f12d..fbaf1ba 100755
--- a/build/opt/apps/uengine-runner/uengine-apk-builder
+++ b/build/opt/apps/uengine-runner/uengine-apk-builder
@@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi
-# 版本:1.3.3
-# 更新时间:2021年8月19日
+# 版本:1.4.2
+# 更新时间:2021年8月30日
# 感谢:anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建
###########################################################################################
@@ -374,7 +374,7 @@ def get_home():
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(programPath + "/information.json"))
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])
###########################
diff --git a/build/opt/apps/uengine-runner/uengine-clean b/build/opt/apps/uengine-runner/uengine-clean
index 019257b..98543e0 100755
--- a/build/opt/apps/uengine-runner/uengine-clean
+++ b/build/opt/apps/uengine-runner/uengine-clean
@@ -4,7 +4,7 @@ import sys
if len(sys.argv) > 1:
if sys.argv[1] == "--help":
print("帮助:")
- print("输入命令即可清空/重置uengine")
+ print("输入命令即可清空/重置UEngine")
sys.exit(0)
print("参数错误")
sys.exit(1)
diff --git a/build/opt/apps/uengine-runner/uengine-keyboard b/build/opt/apps/uengine-runner/uengine-keyboard
index ecf048e..39e6899 100755
--- a/build/opt/apps/uengine-runner/uengine-keyboard
+++ b/build/opt/apps/uengine-runner/uengine-keyboard
@@ -2,6 +2,7 @@
#########################################
# 版本:1.4.0
# 更新时间:2021年08月26日
+# Need: unix, python3-tk, python3-pip, pymouse, keyboard
#########################################
import os
import sys
@@ -17,17 +18,19 @@ import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog
-
+import Xlib.threaded as threaded
+#import pymouse.unix as pymouse
########################
#
########################
def Inputt(key):
- if key.event_type == "down":
+ if key.event_type == "up":
global setting
if setting:
Setting(key)
else:
Mouse(key)
+ #Mouse(key)
def Open():
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
@@ -49,9 +52,14 @@ def ReStartProgram()->"重启本应用程序":
def Mouse(key):
+ print(keybo)
if keybo.__contains__(key.name):
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):
if key.event_type == 'up':
@@ -84,10 +92,15 @@ def ShowTips():
time.sleep(0.1)
ShowTips()
except:
- pass
+ traceback.print_exc()
+ if not close:
+ ShowTips()
+
+def Closing():
+ close = True
+ window.destroy()
def Key():
- global inputs
keyboard.hook(Inputt)
# 获取用户主目录
@@ -95,11 +108,7 @@ def get_home()->"获取用户主目录":
return os.path.expanduser('~')
# 写入文本文档
-def write_txt(path: "路径", things: "内容")->"写入文本文档":
- TxtDir = os.path.dirname(path)
- print(TxtDir)
- if not os.path.exists(TxtDir):
- os.makedirs(TxtDir,exist_ok=True)
+def write_txt(path: "路径", things: "内容")->"写入文本文档":
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
@@ -136,6 +145,7 @@ if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home()))
#
###################
setting = False
+close = False
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
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.set_theme("breeze")
+window.protocol('WM_DELETE_WINDOW', Closing)
window.resizable(0, 0)
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=aboutMenu)
@@ -202,8 +213,15 @@ settingMouseToKeyboard.grid(row=0, column=0)
settingButton.grid(row=0, column=1)
win.pack(fill="both", expand="yes")
-
+#threaded.lock.allocate_lock()
threading.Thread(target=Key).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()
\ No newline at end of file
diff --git a/build/opt/apps/uengine-runner/uengine-runner b/build/opt/apps/uengine-runner/uengine-runner
index 5f490f5..4245609 100755
--- a/build/opt/apps/uengine-runner/uengine-runner
+++ b/build/opt/apps/uengine-runner/uengine-runner
@@ -11,7 +11,6 @@
#################
# 引入所需的库
#################
-from genericpath import exists
import os
import sys
import time
@@ -29,7 +28,7 @@ import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog
import tkinter.simpledialog as simpledialog
from getxmlimg import getsavexml
-from tkinter.constants import TOP
+
# 卸载程序
def UninstallProgram(package: "apk 包名")->"卸载程序":
@@ -552,7 +551,7 @@ def get_home()->"获取用户主目录":
# 删除所有的 uengine 应用快捷方式
def CleanAllUengineDesktopLink():
- if messagebox.askokcancel(title="提示", message="你确定要删除所有的 uengine 应用快捷方式吗?"):
+ if messagebox.askokcancel(title="提示", message="你确定要删除所有的 UEngine 应用快捷方式吗?"):
try:
shutil.rmtree("{}/.local/share/applications/uengine".format(get_home()))
os.mkdir("{}/.local/share/applications/uengine".format(get_home()))
@@ -573,6 +572,84 @@ def OpenUengineRootData():
def OpenUengineUserData():
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 应用快捷方式
class AddNewUengineDesktopLink():
addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity
@@ -591,8 +668,9 @@ class AddNewUengineDesktopLink():
saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink)
delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink)
- message.title("添加/删除 uengine 图标")
+ message.title("添加/删除 UEngine 图标")
message.resizable(0, 0)
+ message.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height
screen_width = message.winfo_screenwidth()
screen_height = message.winfo_screenheight()
@@ -636,7 +714,7 @@ class AddNewUengineDesktopLink():
def DelDesktopLink():
global packageName
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
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return
@@ -680,29 +758,42 @@ programUrl = information["Url"][0]
version = information["Version"]
goodRunSystem = information["System"]
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"])
updateThingsString = "\n".join(information["Update"])
-title = "uengine 运行器 {}".format(version)
+title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = programPath + "/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop"
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.resizable(0, 0)
helpwindow.title("帮助")
-
+ helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height
screen_width = helpwindow.winfo_screenwidth()
@@ -861,7 +952,7 @@ ComboInstallPath = ttk.Combobox(window, width=50)
ComboUninstallPath = ttk.Combobox(window, width=50)
BtnFindApk = ttk.Button(FrmInstall, text="浏览", command=FindApk)
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)
BtnUninstall = ttk.Button(FrmUninstall, text="卸载", command=ButtonClick8)
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")
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
+adb = tk.Menu(menu, tearoff=0, background="white")
uengine = tk.Menu(menu, tearoff=0, background="white")
help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏
-uengineService = tk.Menu(uengine)
-uengineInternet = tk.Menu(uengine)
-uengineIcon = tk.Menu(uengine)
-uengineData = tk.Menu(uengine)
+adbServer = tk.Menu(adb, tearoff=0, background="white")
+
+uengineService = tk.Menu(uengine, tearoff=0, background="white")
+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="uengine", menu=uengine)
+menu.add_cascade(label="adb", menu=adb)
+menu.add_cascade(label="UEngine", menu=uengine)
menu.add_cascade(label="关于", menu=help)
programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
programmenu.add_separator() # 设置分界线
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”
-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 数据", menu=uengineData)
+adb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
+adb.add_separator()
+adb.add_cascade(label="adb 服务", menu=adbServer)
+adb.add_command(label="显示 adb 连接的设备", command=AdbConnectDeviceShow)
+adb.add_separator()
+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=showhelp) # 设置“关于这个程序”项
-uengineService.add_command(label="启用 uengine 服务", command=StartUengine)
-uengineService.add_command(label="关闭 uengine 服务", command=StopUengine)
-uengineService.add_command(label="重启 uengine 服务", command=UengineRestart)
+uengineService.add_command(label="启用 UEngine 服务(需要 root)", command=StartUengine)
+uengineService.add_command(label="关闭 UEngine 服务(需要 root)", command=StopUengine)
+uengineService.add_command(label="重启 UEngine 服务(需要 root)", command=UengineRestart)
-uengineInternet.add_command(label="启用 uengine 网络桥接", command=UengineBridgeStart)
-uengineInternet.add_command(label="关闭 uengine 网络桥接", command=UengineBridgeStop)
-uengineInternet.add_command(label="重启 uengine 网络桥接", command=UengineBridgeRestart)
-uengineInternet.add_command(label="加载 uengine 网络桥接", command=UengineBridgeReload)
-uengineInternet.add_command(label="强制加载 uengine 网络桥接", command=UengineBridgeForceReload)
+uengineInternet.add_command(label="启用 UEngine 网络桥接(需要 root)", command=UengineBridgeStart)
+uengineInternet.add_command(label="关闭 UEngine 网络桥接(需要 root)", command=UengineBridgeStop)
+uengineInternet.add_command(label="重启 UEngine 网络桥接(需要 root)", command=UengineBridgeRestart)
+uengineInternet.add_command(label="加载 UEngine 网络桥接(需要 root)", command=UengineBridgeReload)
+uengineInternet.add_command(label="强制加载 UEngine 网络桥接(需要 root)", command=UengineBridgeForceReload)
-uengineIcon.add_command(label="发送 uengine 应用列表到桌面", command=SendUengineAndroidListForDesktop)
-uengineIcon.add_command(label="发送 uengine 应用列表到启动器", command=SendUengineAndroidListForLauncher)
+uengineIcon.add_command(label="发送 UEngine 应用列表到桌面", command=SendUengineAndroidListForDesktop)
+uengineIcon.add_command(label="发送 UEngine 应用列表到启动器", command=SendUengineAndroidListForLauncher)
uengineIcon.add_separator()
-uengineIcon.add_command(label="添加/删除指定的 uengine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow)
+uengineIcon.add_command(label="添加/删除指定的 UEngine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow)
uengineIcon.add_separator()
-uengineIcon.add_command(label="清空所有 uengine 快捷方式", command=CleanAllUengineDesktopLink)
+uengineIcon.add_command(label="清空所有 UEngine 快捷方式", command=CleanAllUengineDesktopLink)
-uengineData.add_command(label="打开 uengine 根目录", command=OpenUengineRootData)
-uengineData.add_command(label="打开 uengine 用户数据目录", command=OpenUengineUserData)
+uengineUseAdb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
+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_command(label="清空 uengine 数据", command=BackUengineClean)
+uengineData.add_command(label="清空 UEngine 数据(需要 root)", command=BackUengineClean)
menu.configure(activebackground="dodgerblue")
help.configure(activebackground="dodgerblue")
+adb.configure(activebackground="dodgerblue")
uengine.configure(activebackground="dodgerblue")
programmenu.configure(activebackground="dodgerblue")
uengineService.configure(activebackground="dodgerblue")
uengineInternet.configure(activebackground="dodgerblue")
uengineIcon.configure(activebackground="dodgerblue")
+uengineUseAdb.configure(activebackground="dodgerblue")
+uengineData.configure(activebackground="dodgerblue")
# 设置控件
ComboUninstallPath['value'] = fineUninstallApkHistory
diff --git a/build/opt/apps/uengine-runner/uengine-runner-about b/build/opt/apps/uengine-runner/uengine-runner-about
index 4c09eb2..c4330e7 100755
--- a/build/opt/apps/uengine-runner/uengine-runner-about
+++ b/build/opt/apps/uengine-runner/uengine-runner-about
@@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi
-# 版本:1.3.3
-# 更新时间:2021年8月19日
+# 版本:1.4.2
+# 更新时间:2021年8月30日
# 感谢:anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建
###########################################################################################
@@ -34,29 +34,42 @@ programUrl = information["Url"][0]
version = information["Version"]
goodRunSystem = information["System"]
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"])
updateThingsString = "\n".join(information["Update"])
-title = "uengine 运行器 {}".format(version)
+title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop"
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
#添加窗口开启关闭开关,防止重复开启
diff --git a/build/opt/apps/uengine-runner/uengine-useadb b/build/opt/apps/uengine-runner/uengine-useadb
new file mode 100755
index 0000000..09b078d
--- /dev/null
+++ b/build/opt/apps/uengine-runner/uengine-useadb
@@ -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)
\ No newline at end of file
diff --git a/build/usr/bin/uengine-useadb b/build/usr/bin/uengine-useadb
new file mode 120000
index 0000000..4e19a15
--- /dev/null
+++ b/build/usr/bin/uengine-useadb
@@ -0,0 +1 @@
+/opt/apps/uengine-runner/uengine-useadb
\ No newline at end of file
diff --git a/build/usr/share/applications/UengineAndroidProgramList.desktop b/build/usr/share/applications/UengineAndroidProgramList.desktop
index 1b126d3..a8821d7 100644
--- a/build/usr/share/applications/UengineAndroidProgramList.desktop
+++ b/build/usr/share/applications/UengineAndroidProgramList.desktop
@@ -1,11 +1,11 @@
[Desktop Entry]
Categories=System;
-Comment=uengine(anbox) 程序菜单
+Comment=UEngine 程序菜单
Encoding=UTF-8
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
Icon=/opt/apps/uengine-runner/icon.png
MimeType=
-Name=uengine 程序菜单
-StartupWMClass=uengine 程序菜单
+Name=UEngine 程序菜单
+StartupWMClass=UEngine 程序菜单
Terminal=false
Type=Application
diff --git a/build/usr/share/applications/UengineAndroidSetting.desktop b/build/usr/share/applications/UengineAndroidSetting.desktop
new file mode 100644
index 0000000..3a02be8
--- /dev/null
+++ b/build/usr/share/applications/UengineAndroidSetting.desktop
@@ -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
diff --git a/build/usr/share/applications/spark-uengine-install.desktop b/build/usr/share/applications/spark-uengine-install.desktop
index 574d0d8..6107ff1 100644
--- a/build/usr/share/applications/spark-uengine-install.desktop
+++ b/build/usr/share/applications/spark-uengine-install.desktop
@@ -5,10 +5,10 @@ Categories=System;
Terminal=false
Exec=/usr/bin/uengine-runner -i %F
Icon=/opt/apps/uengine-runner/icon.png
-Name=Install APK(uengine runner)
-Comment=Install APK(uengine runner)
-Comment[zh]=安装 APK(uengine 运行器)
-Name[zh]=安装 APK(uengine 运行器)
+Name=Install APK(UEngine runner)
+Comment=Install APK(UEngine runner)
+Comment[zh]=安装 APK(UEngine 运行器)
+Name[zh]=安装 APK(UEngine 运行器)
StartupNotify=true
Hidden=false
NoDisplay=true
diff --git a/build/usr/share/applications/spark-uengine-uninstall.desktop b/build/usr/share/applications/spark-uengine-uninstall.desktop
index 35eaabc..c5e1c4c 100644
--- a/build/usr/share/applications/spark-uengine-uninstall.desktop
+++ b/build/usr/share/applications/spark-uengine-uninstall.desktop
@@ -5,10 +5,10 @@ Categories=System;
Terminal=false
Exec=/usr/bin/uengine-runner -u %F
Icon=/opt/apps/uengine-runner/icon.png
-Name=Uninstall APK(uengine runner)
-Comment=Uninstall APK(uengine runner)
-Comment[zh]=卸载 APK(uengine 运行器)
-Name[zh]=卸载 APK(uengine 运行器)
+Name=Uninstall APK(UEngine runner)
+Comment=Uninstall APK(UEngine runner)
+Comment[zh]=卸载 APK(UEngine 运行器)
+Name[zh]=卸载 APK(UEngine 运行器)
StartupNotify=true
Hidden=false
NoDisplay=true
diff --git a/build/usr/share/applications/uengine-runner.desktop b/build/usr/share/applications/uengine-runner.desktop
index 054df75..12eec5f 100755
--- a/build/usr/share/applications/uengine-runner.desktop
+++ b/build/usr/share/applications/uengine-runner.desktop
@@ -6,8 +6,8 @@ Terminal=false
Exec=/usr/bin/uengine-runner
Icon=/opt/apps/uengine-runner/icon.png
Name=uengine runner
-Comment=uengine runner
-Comment[zh]=uengine 运行器
-Name[zh]=uengine 运行器
+Comment=UEngine Runner
+Comment[zh]=UEngine 运行器
+Name[zh]=UEngine 运行器
StartupNotify=true
MimeType=
\ No newline at end of file
diff --git a/build/usr/share/polkit-1/actions/com.deepin.pkexec.env.policy b/build/usr/share/polkit-1/actions/com.deepin.pkexec.env.policy
new file mode 100644
index 0000000..c0a942a
--- /dev/null
+++ b/build/usr/share/polkit-1/actions/com.deepin.pkexec.env.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Run App
+ 使用对应的程序需要输入密码
+ preferences-system
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/env
+ true
+
+
+
\ No newline at end of file
diff --git a/build/usr/share/polkit-1/actions/com.deepin.pkexec.rm.policy b/build/usr/share/polkit-1/actions/com.deepin.pkexec.rm.policy
new file mode 100644
index 0000000..9b65bb5
--- /dev/null
+++ b/build/usr/share/polkit-1/actions/com.deepin.pkexec.rm.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Delete Files
+ 删除文件需要输入密码
+ preferences-system
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/rm
+ true
+
+
+
\ No newline at end of file
diff --git a/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy b/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy
new file mode 100644
index 0000000..7c0ca86
--- /dev/null
+++ b/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://github.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Setting UEngine Internet Bridge
+ 设置 UEngine 桥接需要输入密码
+ kbox
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/uengine-bridge.sh
+ true
+
+
+
\ No newline at end of file
diff --git a/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy b/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy
new file mode 100644
index 0000000..70d8f15
--- /dev/null
+++ b/build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Change UEngine
+ 设置 UEngine 需要输入密码
+ kbox
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/uengine-session-launch-helper
+ true
+
+
+
\ No newline at end of file
diff --git a/com.gitee.uengine.runner.spark.deb b/com.gitee.uengine.runner.spark.deb
index fbcf67d..2cc1112 100755
Binary files a/com.gitee.uengine.runner.spark.deb and b/com.gitee.uengine.runner.spark.deb differ
diff --git a/information.json b/information.json
index c8211b6..29fd2b9 100755
--- a/information.json
+++ b/information.json
@@ -3,10 +3,10 @@
"https://gitee.com/gfdgd-xi/uengine-runner",
"https://github.com/gfdgd-xi/uengine-runner"
],
- "Version": "1.4.1",
+ "Version": "1.4.2",
"System": "Linux(deepin/UOS)",
"Tips": [
- " 新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的Uengine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。",
+ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis",
"",
"安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮",
"",
@@ -14,20 +14,26 @@
"",
"保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可",
"",
- "键盘映射:详细请查看uengine键盘映射主界面",
+ "重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可",
+ " 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了",
"",
- "重置(删除)uengine数据:点击菜单栏的“uengine”的“清空uengine数据”,输入密码重启即可",
- " 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载uengine配置了",
- "",
- "打开Uengine应用列表:打开系统已安装的应用列表(安卓界面)",
+ "打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)",
"",
"提示:",
"1、需要你有使用 root 权限的能力;",
- "2、需要安装 uengine 才能使用;",
+ "2、需要安装 UEngine 才能使用;",
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
- "4、如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。"
+ "4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
],
"Update": [
+ "V1.4.2:",
+ "※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;",
+ "2、菜单栏的项目添加以及外观优化;",
+ "3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
+ "4、把 uengine 改为 UEngine;",
+ "5、修改 pkexec 获取密码时显示的图标和文本;",
+ "6、添加了 UEngine 系统设置的快捷方式;",
+ "",
"V1.4.1:",
"※1、初步支持键盘映射",
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
@@ -87,7 +93,7 @@
"暂无数据"
],
"Use": [
- "1、uengine相关软件包(基于anbox开发)",
+ "1、UEngine相关软件包(基于anbox开发)",
"2、Python3",
"3、tkinter(tkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk)",
"4、aapt",
@@ -96,9 +102,11 @@
"7、mkdir",
"8、echo",
"9、chmod",
+ "10、adb",
+ "11、deepin 终端",
"……"
],
- "Time": "2021年08月26日",
+ "Time": "2021年08月30日",
"Contribute": ["gfdgd xi<3025613752@qq.com>",
"actionchen<917981399@qq.com>"]
}
\ No newline at end of file
diff --git a/main.py b/main.py
index 1df5daf..4245609 100755
--- a/main.py
+++ b/main.py
@@ -11,7 +11,6 @@
#################
# 引入所需的库
#################
-from genericpath import exists
import os
import sys
import time
@@ -29,7 +28,7 @@ import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog
import tkinter.simpledialog as simpledialog
from getxmlimg import getsavexml
-from tkinter.constants import TOP
+
# 卸载程序
def UninstallProgram(package: "apk 包名")->"卸载程序":
@@ -552,7 +551,7 @@ def get_home()->"获取用户主目录":
# 删除所有的 uengine 应用快捷方式
def CleanAllUengineDesktopLink():
- if messagebox.askokcancel(title="提示", message="你确定要删除所有的 uengine 应用快捷方式吗?"):
+ if messagebox.askokcancel(title="提示", message="你确定要删除所有的 UEngine 应用快捷方式吗?"):
try:
shutil.rmtree("{}/.local/share/applications/uengine".format(get_home()))
os.mkdir("{}/.local/share/applications/uengine".format(get_home()))
@@ -573,6 +572,84 @@ def OpenUengineRootData():
def OpenUengineUserData():
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 应用快捷方式
class AddNewUengineDesktopLink():
addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity
@@ -591,8 +668,9 @@ class AddNewUengineDesktopLink():
saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink)
delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink)
- message.title("添加/删除 uengine 图标")
+ message.title("添加/删除 UEngine 图标")
message.resizable(0, 0)
+ message.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height
screen_width = message.winfo_screenwidth()
screen_height = message.winfo_screenheight()
@@ -636,7 +714,7 @@ class AddNewUengineDesktopLink():
def DelDesktopLink():
global packageName
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
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return
@@ -680,29 +758,42 @@ programUrl = information["Url"][0]
version = information["Version"]
goodRunSystem = information["System"]
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"])
updateThingsString = "\n".join(information["Update"])
-title = "uengine 运行器 {}".format(version)
+title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = programPath + "/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop"
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.resizable(0, 0)
helpwindow.title("帮助")
-
+ helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
# get screen width and height
screen_width = helpwindow.winfo_screenwidth()
@@ -861,7 +952,7 @@ ComboInstallPath = ttk.Combobox(window, width=50)
ComboUninstallPath = ttk.Combobox(window, width=50)
BtnFindApk = ttk.Button(FrmInstall, text="浏览", command=FindApk)
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)
BtnUninstall = ttk.Button(FrmUninstall, text="卸载", command=ButtonClick8)
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")
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
+adb = tk.Menu(menu, tearoff=0, background="white")
uengine = 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")
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="uengine", menu=uengine)
+menu.add_cascade(label="adb", menu=adb)
+menu.add_cascade(label="UEngine", menu=uengine)
menu.add_cascade(label="关于", menu=help)
programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
programmenu.add_separator() # 设置分界线
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”
-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 数据", menu=uengineData)
+adb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
+adb.add_separator()
+adb.add_cascade(label="adb 服务", menu=adbServer)
+adb.add_command(label="显示 adb 连接的设备", command=AdbConnectDeviceShow)
+adb.add_separator()
+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=showhelp) # 设置“关于这个程序”项
-uengineService.add_command(label="启用 uengine 服务", command=StartUengine)
-uengineService.add_command(label="关闭 uengine 服务", command=StopUengine)
-uengineService.add_command(label="重启 uengine 服务", command=UengineRestart)
+uengineService.add_command(label="启用 UEngine 服务(需要 root)", command=StartUengine)
+uengineService.add_command(label="关闭 UEngine 服务(需要 root)", command=StopUengine)
+uengineService.add_command(label="重启 UEngine 服务(需要 root)", command=UengineRestart)
-uengineInternet.add_command(label="启用 uengine 网络桥接", command=UengineBridgeStart)
-uengineInternet.add_command(label="关闭 uengine 网络桥接", command=UengineBridgeStop)
-uengineInternet.add_command(label="重启 uengine 网络桥接", command=UengineBridgeRestart)
-uengineInternet.add_command(label="加载 uengine 网络桥接", command=UengineBridgeReload)
-uengineInternet.add_command(label="强制加载 uengine 网络桥接", command=UengineBridgeForceReload)
+uengineInternet.add_command(label="启用 UEngine 网络桥接(需要 root)", command=UengineBridgeStart)
+uengineInternet.add_command(label="关闭 UEngine 网络桥接(需要 root)", command=UengineBridgeStop)
+uengineInternet.add_command(label="重启 UEngine 网络桥接(需要 root)", command=UengineBridgeRestart)
+uengineInternet.add_command(label="加载 UEngine 网络桥接(需要 root)", command=UengineBridgeReload)
+uengineInternet.add_command(label="强制加载 UEngine 网络桥接(需要 root)", command=UengineBridgeForceReload)
-uengineIcon.add_command(label="发送 uengine 应用列表到桌面", command=SendUengineAndroidListForDesktop)
-uengineIcon.add_command(label="发送 uengine 应用列表到启动器", command=SendUengineAndroidListForLauncher)
+uengineIcon.add_command(label="发送 UEngine 应用列表到桌面", command=SendUengineAndroidListForDesktop)
+uengineIcon.add_command(label="发送 UEngine 应用列表到启动器", command=SendUengineAndroidListForLauncher)
uengineIcon.add_separator()
-uengineIcon.add_command(label="添加/删除指定的 uengine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow)
+uengineIcon.add_command(label="添加/删除指定的 UEngine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow)
uengineIcon.add_separator()
-uengineIcon.add_command(label="清空所有 uengine 快捷方式", command=CleanAllUengineDesktopLink)
+uengineIcon.add_command(label="清空所有 UEngine 快捷方式", command=CleanAllUengineDesktopLink)
-uengineData.add_command(label="打开 uengine 根目录", command=OpenUengineRootData)
-uengineData.add_command(label="打开 uengine 用户数据目录", command=OpenUengineUserData)
+uengineUseAdb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
+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_command(label="清空 uengine 数据", command=BackUengineClean)
+uengineData.add_command(label="清空 UEngine 数据(需要 root)", command=BackUengineClean)
menu.configure(activebackground="dodgerblue")
help.configure(activebackground="dodgerblue")
+adb.configure(activebackground="dodgerblue")
uengine.configure(activebackground="dodgerblue")
programmenu.configure(activebackground="dodgerblue")
uengineService.configure(activebackground="dodgerblue")
uengineInternet.configure(activebackground="dodgerblue")
uengineIcon.configure(activebackground="dodgerblue")
+uengineUseAdb.configure(activebackground="dodgerblue")
+uengineData.configure(activebackground="dodgerblue")
# 设置控件
ComboUninstallPath['value'] = fineUninstallApkHistory
diff --git a/new-deb-build/DEBIAN/control b/new-deb-build/DEBIAN/control
index e00061b..9b4a50d 100644
--- a/new-deb-build/DEBIAN/control
+++ b/new-deb-build/DEBIAN/control
@@ -1,11 +1,11 @@
Package: com.gitee.uengine.runner.spark
-Source: spark-uengine-runner
-Version: 1.4.1
+Source: com.gitee.uengine.runner.spark
+Version: 1.4.2
Architecture: all
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
Priority: optional
Conflicts: spark-uengine-runner, spark-uengine-apk-builder
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
diff --git a/new-deb-build/DEBIAN/postinst b/new-deb-build/DEBIAN/postinst
index 044f8c9..68421f3 100755
--- a/new-deb-build/DEBIAN/postinst
+++ b/new-deb-build/DEBIAN/postinst
@@ -1,6 +1,7 @@
#!/bin/sh
# 使用 pip 安装所需库
python3 -m pip install --upgrade ttkthemes
+python3 -m pip install --upgrade requests
python3 -m pip install --upgrade pyautogui
python3 -m pip install --upgrade keyboard
# 建立软链接
@@ -10,4 +11,5 @@ ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall /usr/
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install /usr/bin/uengine-app-install
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-keyboard /usr/bin/uengine-keyboard
\ No newline at end of file
+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
\ No newline at end of file
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidProgramList.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidProgramList.desktop
index 29b43bc..dc2d3c7 100644
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidProgramList.desktop
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidProgramList.desktop
@@ -1,11 +1,11 @@
[Desktop Entry]
Categories=System;
-Comment=uengine(anbox) 程序菜单
+Comment=UEngine(anbox) 程序菜单
Encoding=UTF-8
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
MimeType=
-Name=uengine 程序菜单
-StartupWMClass=uengine 程序菜单
+Name=UEngine 程序菜单
+StartupWMClass=UEngine 程序菜单
Terminal=false
Type=Application
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidSetting.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidSetting.desktop
new file mode 100644
index 0000000..9c4c486
--- /dev/null
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/UengineAndroidSetting.desktop
@@ -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
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-install.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-install.desktop
index a549fd0..69a0c51 100644
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-install.desktop
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-install.desktop
@@ -6,9 +6,9 @@ Terminal=false
Exec=/usr/bin/uengine-runner -i %F
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
Name=Install APK(uengine runner)
-Comment=Install APK(uengine runner)
-Comment[zh]=安装 APK(uengine 运行器)
-Name[zh]=安装 APK(uengine 运行器)
+Comment=Install APK(UEngine runner)
+Comment[zh]=安装 APK(UEngine 运行器)
+Name[zh]=安装 APK(UEngine 运行器)
StartupNotify=true
Hidden=false
NoDisplay=true
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-uninstall.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-uninstall.desktop
index 0e7f788..258c81e 100644
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-uninstall.desktop
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/spark-uengine-uninstall.desktop
@@ -5,10 +5,10 @@ Categories=System;
Terminal=false
Exec=/usr/bin/uengine-runner -u %F
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
-Name=Uninstall APK(uengine runner)
-Comment=Uninstall APK(uengine runner)
-Comment[zh]=卸载 APK(uengine 运行器)
-Name[zh]=卸载 APK(uengine 运行器)
+Name=Uninstall APK(UEngine runner)
+Comment=Uninstall APK(UEngine runner)
+Comment[zh]=卸载 APK(UEngine 运行器)
+Name[zh]=卸载 APK(UEngine 运行器)
StartupNotify=true
Hidden=false
NoDisplay=true
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-runner.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-runner.desktop
index b3b125b..d0878c2 100755
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-runner.desktop
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/entries/applications/uengine-runner.desktop
@@ -6,8 +6,8 @@ Terminal=false
Exec=/usr/bin/uengine-runner
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
Name=uengine runner
-Comment=uengine runner
-Comment[zh]=uengine 运行器
-Name[zh]=uengine 运行器
+Comment=UEngine Runner
+Comment[zh]=UEngine 运行器
+Name[zh]=UEngine 运行器
StartupNotify=true
MimeType=
\ No newline at end of file
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UengineAndroidProgramList.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UengineAndroidProgramList.desktop
index 29b43bc..c130e1d 100755
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UengineAndroidProgramList.desktop
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UengineAndroidProgramList.desktop
@@ -1,11 +1,11 @@
[Desktop Entry]
Categories=System;
-Comment=uengine(anbox) 程序菜单
+Comment=UEngine 程序菜单
Encoding=UTF-8
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
MimeType=
-Name=uengine 程序菜单
-StartupWMClass=uengine 程序菜单
+Name=UEngine 程序菜单
+StartupWMClass=UEngine 程序菜单
Terminal=false
Type=Application
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json
index c8211b6..29fd2b9 100755
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json
@@ -3,10 +3,10 @@
"https://gitee.com/gfdgd-xi/uengine-runner",
"https://github.com/gfdgd-xi/uengine-runner"
],
- "Version": "1.4.1",
+ "Version": "1.4.2",
"System": "Linux(deepin/UOS)",
"Tips": [
- " 新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的Uengine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。",
+ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis",
"",
"安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮",
"",
@@ -14,20 +14,26 @@
"",
"保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可",
"",
- "键盘映射:详细请查看uengine键盘映射主界面",
+ "重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可",
+ " 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了",
"",
- "重置(删除)uengine数据:点击菜单栏的“uengine”的“清空uengine数据”,输入密码重启即可",
- " 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载uengine配置了",
- "",
- "打开Uengine应用列表:打开系统已安装的应用列表(安卓界面)",
+ "打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)",
"",
"提示:",
"1、需要你有使用 root 权限的能力;",
- "2、需要安装 uengine 才能使用;",
+ "2、需要安装 UEngine 才能使用;",
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
- "4、如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。"
+ "4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
],
"Update": [
+ "V1.4.2:",
+ "※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;",
+ "2、菜单栏的项目添加以及外观优化;",
+ "3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
+ "4、把 uengine 改为 UEngine;",
+ "5、修改 pkexec 获取密码时显示的图标和文本;",
+ "6、添加了 UEngine 系统设置的快捷方式;",
+ "",
"V1.4.1:",
"※1、初步支持键盘映射",
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
@@ -87,7 +93,7 @@
"暂无数据"
],
"Use": [
- "1、uengine相关软件包(基于anbox开发)",
+ "1、UEngine相关软件包(基于anbox开发)",
"2、Python3",
"3、tkinter(tkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk)",
"4、aapt",
@@ -96,9 +102,11 @@
"7、mkdir",
"8、echo",
"9、chmod",
+ "10、adb",
+ "11、deepin 终端",
"……"
],
- "Time": "2021年08月26日",
+ "Time": "2021年08月30日",
"Contribute": ["gfdgd xi<3025613752@qq.com>",
"actionchen<917981399@qq.com>"]
}
\ No newline at end of file
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/main.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/main.py
new file mode 100755
index 0000000..4245609
--- /dev/null
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/main.py
@@ -0,0 +1,1091 @@
+#!/usr/bin/env python3
+# 使用系统默认的 python3 运行
+###########################################################################################
+# 作者:gfdgd xi<3025613752@qq.com>
+# 版本:1.4.0
+# 更新时间:2021年8月26日
+# 感谢:anbox、deepin 和 UOS
+# 基于 Python3 的 tkinter 构建
+# 更新:actionchen<917981399@qq.com>
+###########################################################################################
+#################
+# 引入所需的库
+#################
+import os
+import sys
+import time
+import json
+import shutil
+import zipfile
+import traceback
+import threading
+import ttkthemes
+import webbrowser
+import subprocess
+import tkinter as tk
+import tkinter.ttk as ttk
+import tkinter.messagebox as messagebox
+import tkinter.filedialog as filedialog
+import tkinter.simpledialog as simpledialog
+from getxmlimg import getsavexml
+
+
+# 卸载程序
+def UninstallProgram(package: "apk 包名")->"卸载程序":
+ try:
+ global fineUninstallApkHistory
+ Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package))
+ if os.path.exists("{}/.local/share/applications/{}.desktop".format(get_home(), package)):
+ os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package))
+ if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)):
+ os.remove("{}/{}.desktop".format(get_desktop_path(), package))
+ fineUninstallApkHistory.append(ComboUninstallPath.get())
+ ComboUninstallPath['value'] = fineUninstallApkHistory
+ write_txt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json", str(json.dumps(ListToDictionary(fineUninstallApkHistory)))) # 将历史记录的数组转换为字典并写入
+ return Return
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+
+# 卸载文本框的浏览按钮事件
+def BtnFindUninstallApkClk():
+ path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApk.json"))["path"])
+ if path != "" and path != "()":
+ try:
+ ComboUninstallPath.set(path)
+ write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
+ except:
+ pass
+
+# 卸载按钮事件
+def ButtonClick8():
+ if ComboUninstallPath.get() is "":
+ messagebox.showerror(title="提示", message="信息没有填写完整,无法继续卸载 APK")
+ return
+ DisabledAndEnbled(True)
+ if os.path.exists(ComboUninstallPath.get()):
+ path = GetApkPackageName(ComboUninstallPath.get())
+ else:
+ path = ComboUninstallPath.get()
+ UninstallProgram(path)
+ messagebox.showinfo(message="操作执行完毕!", title="提示")
+ DisabledAndEnbled(False)
+
+# 浏览窗口
+# temp strs
+temppath=""
+def FindApk()->"浏览窗口":
+ path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApk.json"))["path"])
+ global temppath
+ temppath = path
+ print("apk path is find:" + path)
+ if path != "" and path != "()":
+ try:
+ ComboInstallPath.set(path)
+ write_txt(get_home() + "/.config/uengine-runner/FindApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
+ except:
+ pass
+
+# 安装按钮事件
+def Button3Install():
+ if ComboInstallPath.get() is "":
+ messagebox.showerror(title="提示", message="信息没有填写完整,无法继续安装 APK")
+ return
+ DisabledAndEnbled(True)
+ threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start()
+
+# 安装应用
+def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
+ try:
+ if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())):
+ print("Mkdir")
+ os.mkdir("{}/.local/share/applications/uengine/".format(get_home()))
+ print("start install apk")
+ global findApkHistory
+ commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
+ print(commandReturn)
+ print("start install apk12")
+ iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path))
+ tempstr1 = iconSavePath
+ print("start install apk1")
+ iconSaveDir = os.path.dirname(iconSavePath)
+ if not os.path.exists(iconSaveDir):
+ os.makedirs(iconSaveDir,exist_ok=True)
+ SaveApkIcon(path, iconSavePath)
+ print("start install apk2")
+ BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
+ "{}/{}.desktop".format(get_desktop_path(), GetApkPackageName(path)))
+ print("start install apk3")
+ BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
+ "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path)))
+ print("\nprint install complete")
+ if quit:
+ print(commandReturn)
+ return
+ messagebox.showinfo(title="提示", message="操作完成!")
+ findApkHistory.append(ComboInstallPath.get())
+ ComboInstallPath['value'] = findApkHistory
+ write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+ DisabledAndEnbled(False)
+
+# 禁用或启动所有控件
+def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控件":
+ userChoose = {True: tk.DISABLED, False: tk.NORMAL}
+ a = userChoose[choose]
+ ComboInstallPath.configure(state=a)
+ ComboUninstallPath.configure(state=a)
+ BtnFindApk.configure(state=a)
+ BtnInstall.configure(state=a)
+ BtnShowUengineApp.configure(state=a)
+ BtnUninstallApkBrowser.configure(state=a)
+ BtnUninstall.configure(state=a)
+ Btngeticon.configure(state=a)
+ BtnSaveApk.configure(state=a)
+
+# 需引入 subprocess
+# 运行系统命令并获取返回值
+def GetCommandReturn(cmd: "命令")->"运行系统命令并获取返回值":
+ # cmd 是要获取输出的命令
+ return subprocess.getoutput(cmd)
+
+# 打开所有窗口事件
+def Button5Click():
+ threading.Thread(target=OpenUengineProgramList).start()
+
+# 打开“uengine 所有程序列表”
+def OpenUengineProgramList()->"打开“uengine 所有程序列表”":
+ os.system("/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity")
+
+# 显示“关于这个程序”窗口
+def about_this_program()->"显示“关于这个程序”窗口":
+ global about
+ global title
+ global iconPath
+ mess = tk.Toplevel()
+ message = ttk.Frame(mess)
+ mess.resizable(0, 0)
+ mess.title("关于 {}".format(title))
+ #mess.iconphoto(False, tk.PhotoImage(file=iconPath))
+ img = ImageTk.PhotoImage(Image.open(iconPath))
+ LabApkPath = ttk.Label(message, image=img)
+ label2 = ttk.Label(message, text=about)
+ button1 = ttk.Button(message, text="确定", command=mess.withdraw)
+ LabApkPath.pack()
+ label2.pack()
+ button1.pack(side="bottom")
+ message.pack()
+ mess.mainloop()
+
+# 显示“提示”窗口
+def helps()->"显示“提示”窗口":
+ global tips
+ messagebox.showinfo(title="提示", message=tips)
+
+# 显示更新内容窗口
+def UpdateThings()->"显示更新内容窗口":
+ messagebox.showinfo(title="更新内容", message=updateThings)
+
+# 打开程序官网
+def OpenProgramURL()->"打开程序官网":
+ webbrowser.open_new_tab(programUrl)
+
+# 重启本应用程序
+def ReStartProgram()->"重启本应用程序":
+ python = sys.executable
+ os.execl(python, python, * sys.argv)
+
+# 清理历史记录
+def CleanProgramHistory()->"清理历史记录":
+ try:
+ if messagebox.askokcancel(title="警告", message="删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。"):
+ shutil.rmtree(get_home() + "/.config/uengine-runner")
+ ReStartProgram()
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+
+# 获取用户主目录
+def get_home()->"获取用户主目录":
+ return os.path.expanduser('~')
+
+# 发送“启动 uengine 所有程序”的 .desktop 文件到桌面
+def SendUengineAndroidListForDesktop()->"发送“启动 uengine 所有程序”的 .desktop 文件到桌面":
+ global desktop
+ global desktopName
+ DisabledAndEnbled(True)
+ try:
+ if os.path.exists("{}/{}".format(get_desktop_path(), desktopName)):
+ if not messagebox.askokcancel(title="提示", message="桌面已经存在快捷方式,你确定要覆盖吗?"):
+ DisabledAndEnbled(False)
+ return
+ shutil.copy(desktop, get_desktop_path())
+ messagebox.showinfo(title="提示", message="发送成功!")
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+ DisabledAndEnbled(False)
+
+# 获取用户桌面目录
+def get_desktop_path()->"获取用户桌面目录":
+ for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
+ desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
+ if desktop_index != -1: # 如果有对应项
+ break # 结束循环
+ if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
+ return -1
+ else:
+ get = line[17:-2] # 截取桌面目录路径
+ get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
+ if get != -1: # 如果有
+ get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
+ return get # 返回目录
+
+# 发送“启动 uengine 所有程序”的 .desktop 文件到启动器
+def SendUengineAndroidListForLauncher()->"发送“启动 uengine 所有程序”的 .desktop 文件到启动器":
+ DisabledAndEnbled(True)
+ try:
+ if os.path.exists("{}/.local/share/applications/{}".format(get_home(), desktopName)):
+ if not messagebox.askokcancel(title="提示", message="启动器已经存在快捷方式,你确定要覆盖吗?"):
+ DisabledAndEnbled(False)
+ return
+ if not os.path.exists("{}/.local/share/applications/".format(get_home())):
+ os.makedirs("{}/.local/share/applications/".format(get_home()))
+ shutil.copy(desktop, "{}/.local/share/applications/{}".format(get_home(), desktopName))
+ os.system("chmod 755 {}/.local/share/applications/{}".format(get_home(), desktopName))
+ messagebox.showinfo(title="提示", message="发送成功!")
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+ DisabledAndEnbled(False)
+
+# 数组转字典
+def ListToDictionary(list: "需要转换的数组")->"数组转字典":
+ dictionary = {}
+ for i in range(len(list)):
+ dictionary[i] = list[i]
+ return dictionary
+
+# 读取文本文档
+def readtxt(path: "路径")->"读取文本文档":
+ f = open(path, "r") # 设置文件对象
+ str = f.read() # 获取内容
+ f.close() # 关闭文本对象
+ return str # 返回结果
+
+# 写入文本文档
+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.write(things) # 写入文本
+ file.close() # 关闭文本对象
+
+# 获取 aapt 的所有信息
+def GetApkInformation(apkFilePath: "apk 所在路径")->"获取 aapt 的所有信息":
+ return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath))
+
+# 获取 apk Activity
+def GetApkActivityName(apkFilePath: "apk 所在路径")->"获取 apk Activity":
+ info = GetApkInformation(apkFilePath)
+ for line in info.split('\n'):
+ if "launchable-activity" in line:
+ line = line[0: line.index("label='")]
+ line = line.replace("launchable-activity: ", "")
+ line = line.replace("'", "")
+ line = line.replace(" ", "")
+ line = line.replace("name=", "")
+ line = line.replace("label=", "")
+ line = line.replace("icon=", "")
+ return line
+
+# 获取 apk 包名
+def GetApkPackageName(apkFilePath: "apk 所在路径")->"获取 apk 包名":
+ info = GetApkInformation(apkFilePath)
+ for line in info.split('\n'):
+ if "package:" in line:
+ line = line[0: line.index("versionCode='")]
+ line = line.replace("package:", "")
+ line = line.replace("name=", "")
+ line = line.replace("'", "")
+ line = line.replace(" ", "")
+ return line
+
+# 生成 uengine 启动文件到桌面
+def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径")->"生成 uengine 启动文件到桌面":
+ things = '''[Desktop Entry]
+Categories=app;
+Encoding=UTF-8
+Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={}
+GenericName={}
+Icon={}
+MimeType=
+Name={}
+StartupWMClass={}
+Terminal=false
+Type=Application
+'''.format(packageName, activityName, showName, iconPath, showName, showName)
+ write_txt(savePath, things)
+
+# 获取软件的中文名称
+def GetApkChineseLabel(apkFilePath)->"获取软件的中文名称":
+ info = GetApkInformation(apkFilePath)
+ for line in info.split('\n'):
+ if "application-label:" in line:
+ line = line.replace("application-label:", "")
+ line = line.replace("'", "")
+ return line
+
+# 保存apk图标
+def SaveApkIcon(apkFilePath, iconSavePath)->"保存 apk 文件的图标":
+ try:
+ info = GetApkInformation(apkFilePath)
+ for line in info.split('\n'):
+ if "application:" in line:
+ xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'","")
+ if xmlpath.endswith('.xml'):
+ xmlsave = getsavexml()
+ print(xmlpath)
+ xmlsave.savexml(apkFilePath,xmlpath,iconSavePath)
+ else:
+ zip = zipfile.ZipFile(apkFilePath)
+ iconData = zip.read(xmlpath)
+ with open(iconSavePath, 'w+b') as saveIconFile:
+ saveIconFile.write(iconData)
+ except:
+ traceback.print_exc()
+ print("Error, show defult icon")
+ shutil.copy(programPath + "/defult.png", iconSavePath)
+
+def saveicon():
+ global temppath
+ global tempstr1
+ iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(temppath))
+ print(iconSavePath+"iconpaths")
+ SaveApkIcon(temppath, iconSavePath)
+
+def KeyboardToMouse():
+ threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-keyboard".format(programPath)]).start()
+
+# 用户自行保存APK
+def SaveIconToOtherPath():
+ apkPath = ComboInstallPath.get()
+ if apkPath == "":
+ messagebox.showerror(title="错误", message="你没有选择 apk 文件")
+ return
+ path = filedialog.asksaveasfilename(title="保存图标", filetypes=[("PNG 图片", "*.png"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApkIcon.json"))["path"])
+ if not path == "":
+ try:
+ SaveApkIcon(apkPath, path)
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message="本程序不支持保存该 apk 的图标")
+ return
+ write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
+ findApkHistory.append(ComboInstallPath.get())
+ ComboInstallPath['value'] = findApkHistory
+ write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
+ messagebox.showinfo(title="提示", message="保存成功!")
+
+# 清空 uengine 数据
+def BackUengineClean()->"清空 uengine 数据":
+ print("Choose")
+ if messagebox.askokcancel(title="警告", message="清空后数据将会完全丢失,确定要继续吗?"):
+ DisabledAndEnbled(True)
+ try:
+ if os.path.exists("{}/.local/share/applications/uengine/".format(get_home())):
+ shutil.rmtree("{}/.local/share/applications/uengine/".format(get_home()))
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+ InstallWindow.ShowWindows("pkexec rm -rfv /data/uengine")
+ return
+ print("Choose False")
+
+# 启用 uengine 网络桥接
+def UengineBridgeStart()->"启用 uengine 网络桥接":
+ DisabledAndEnbled(True)
+ os.system("pkexec uengine-bridge.sh start")
+ DisabledAndEnbled(False)
+
+# 关闭 uengine 网络桥接
+def UengineBridgeStop()->"关闭 uengine 网络桥接":
+ DisabledAndEnbled(True)
+ os.system("pkexec uengine-bridge.sh stop")
+ DisabledAndEnbled(False)
+
+# 重启 uengine 网络桥接
+def UengineBridgeRestart()->"重启 uengine 网络桥接":
+ DisabledAndEnbled(True)
+ os.system("pkexec uengine-bridge.sh restart")
+ DisabledAndEnbled(False)
+
+# 加载 uengine 网络桥接
+def UengineBridgeReload()->"加载 uengine 网络桥接":
+ DisabledAndEnbled(True)
+ os.system("pkexec uengine-bridge.sh reload")
+ DisabledAndEnbled(False)
+
+# 强制加载 uengine 网络桥接
+def UengineBridgeForceReload()->"强制加载 uengine 网络桥接":
+ DisabledAndEnbled(True)
+ os.system("pkexec uengine-bridge.sh force-reload")
+ DisabledAndEnbled(False)
+
+# 启用 uengine 服务
+def StartUengine()->"启用 uengine 服务":
+ DisabledAndEnbled(True)
+ os.system("systemctl enable uengine-container uengine-session && systemctl start uengine-container uengine-session")
+ DisabledAndEnbled(False)
+
+# 关闭 uengine 服务
+def StopUengine()->"关闭 uengine 服务":
+ DisabledAndEnbled(True)
+ os.system("systemctl disable uengine-container uengine-session")
+ DisabledAndEnbled(False)
+
+# 重启 uengine 服务
+def UengineRestart()->"重启 uengine 服务":
+ DisabledAndEnbled(True)
+ os.system("systemctl restart uengine*")
+ DisabledAndEnbled(False)
+
+# 运行命令的窗口
+class InstallWindow():
+ # 显示窗口
+ def ShowWindows(command):
+ global message
+ global text
+ global installTipsText
+ global progressbar
+ message = tk.Toplevel()
+ message.iconphoto(False, tk.PhotoImage(file=iconPath))
+ messageFrame = ttk.Frame(message)
+ installTipsText = tk.StringVar()
+ message.title("正在操作……")
+ installTipsText.set("正在操作……")
+ installTips = ttk.Label(messageFrame, textvariable=installTipsText)
+ progressbar = ttk.Progressbar(messageFrame, length=500, mode='indeterminate')
+ text = tk.Text(messageFrame)
+ text.config(background="black", foreground="white")
+ installTips.pack()
+ progressbar.pack(fill="x")
+ text.pack(expand='yes', fill='both')
+ messageFrame.pack(expand='yes', fill='both')
+ print("Run!")
+ threading.Thread(target=InstallWindow.RunCommand, args=[command]).start()
+ message.mainloop()
+
+ # 运行命令并显示
+ def RunCommand(command):
+ global message
+ global text
+ global progressbar
+ global installTipsText
+ InstallWindow.AddText("$>" + command + "\n")
+ progressbar.start()
+ result = subprocess.getoutput(command)
+ InstallWindow.AddText(result)
+ messagebox.showinfo(title="提示", message="操作完毕!")
+ installTipsText.set("操作完毕!")
+ message.title("操作完毕!")
+ progressbar.stop()
+ progressbar["value"] = 100
+ # 特意添加!
+ DisabledAndEnbled(False)
+ print("Clean!")
+ if messagebox.askyesno(title="提示", message="清空完毕,将会在重启后生效,是否要重启?"):
+ print("reboot")
+ os.system("reboot")
+
+ # 添加文本
+ def AddText(things):
+ global text
+ text.configure(state=tk.NORMAL)
+ text.insert("end", things)
+ text.configure(state=tk.DISABLED)
+
+
+# 获取用户桌面目录
+def get_desktop_path()->"获取用户桌面目录":
+ for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
+ desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
+ if desktop_index != -1: # 如果有对应项
+ break # 结束循环
+ if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
+ return -1
+ else:
+ get = line[17:-2] # 截取桌面目录路径
+ get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
+ if get != -1: # 如果有
+ get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
+ return get # 返回目录
+
+# 提取已安装程序的apk
+def SaveInstallUengineApp():
+ while True:
+ result = simpledialog.askstring(title="输入apk包名", prompt="请输入要获取的apk包名以便进行下一步操作")
+ if result == "" or result == None:
+ return
+ if os.path.exists("/data/uengine/data/data/app/{}-1".format(result)):
+ break
+ messagebox.showerror(title="错误", message="路径不存在,请重试!")
+ path = filedialog.asksaveasfilename(title="保存apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApk.json"))["path"])
+ if path == "" or path == ():
+ return
+ try:
+ shutil.copy("/data/uengine/data/data/app/{}-1/base.apk".format(result), path)
+ write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": os.path.dirname(path)}))
+ messagebox.showinfo(title="提示", message="提取完成!")
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+
+# 获取用户主目录
+def get_home()->"获取用户主目录":
+ return os.path.expanduser('~')
+
+# 删除所有的 uengine 应用快捷方式
+def CleanAllUengineDesktopLink():
+ if messagebox.askokcancel(title="提示", message="你确定要删除所有的 UEngine 应用快捷方式吗?"):
+ try:
+ shutil.rmtree("{}/.local/share/applications/uengine".format(get_home()))
+ os.mkdir("{}/.local/share/applications/uengine".format(get_home()))
+ messagebox.showinfo(title="提示", message="删除完毕!")
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+
+# 打开 uengine 应用打包器
+def OpenUengineDebBuilder():
+ threading.Thread(target=os.system, args=[programPath + "/uengine-apk-builder"]).start()
+
+# 打开 uengine 根目录
+def OpenUengineRootData():
+ threading.Thread(target=os.system, args=["xdg-open /data/uengine/data/data"]).start()
+
+# 打开 uengine 用户数据目录
+def OpenUengineUserData():
+ threading.Thread(target=os.system, args=["xdg-open ~/安卓应用文件"]).start()
+
+# 终端显示 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 应用快捷方式
+class AddNewUengineDesktopLink():
+ addTips = '''可以输入app的包名和Activity或通过浏览apk文件来获取包名和Activity
+注意:如果是要删除只要输入包名即可'''
+ def ShowWindow():
+ global activityName
+ global packageName
+ message = tk.Toplevel()
+
+ tipsLabel = ttk.Label(message, text=AddNewUengineDesktopLink.addTips)
+ packageName = ttk.Combobox(message, width=30)
+ activityName = ttk.Combobox(message, width=30)
+ findApk = ttk.Button(message, text="浏览", command=AddNewUengineDesktopLink.FindApk)
+ controlFrame = ttk.Frame(message)
+ testOpen = ttk.Button(controlFrame, text="打开", command=AddNewUengineDesktopLink.TestOpen)
+ saveButton = ttk.Button(controlFrame, text="写入", command=AddNewUengineDesktopLink.SaveDesktopLink)
+ delButton = ttk.Button(controlFrame, text="删除", command=AddNewUengineDesktopLink.DelDesktopLink)
+
+ message.title("添加/删除 UEngine 图标")
+ message.resizable(0, 0)
+ message.iconphoto(False, tk.PhotoImage(file=iconPath))
+ # get screen width and height
+ screen_width = message.winfo_screenwidth()
+ screen_height = message.winfo_screenheight()
+ # calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。
+ winwith=570
+ winhigh=236
+ x = (screen_width/2) - (winwith/2)
+ y = (screen_height/2) - (winhigh/2)
+ message.geometry("+{}+{}".format(int(x), int(y)))
+
+ packageName["value"] = findApkNameHistory
+ activityName["value"] = findApkActivityHistory
+
+ tipsLabel.grid(row=0, column=0, columnspan=3)
+ packageName.grid(row=1, column=0)
+ activityName.grid(row=1, column=1)
+ findApk.grid(row=1, column=2)
+ controlFrame.grid(row=2, column=0, columnspan=3)
+ testOpen.grid(row=0, column=0)
+ saveButton.grid(row=0, column=1)
+ delButton.grid(row=0, column=2)
+
+ message.mainloop()
+
+ # 添加快捷方式
+ def SaveDesktopLink():
+ if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
+ if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"):
+ return
+ global activityName
+ iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get())
+ shutil.copy(programPath + "/defult.png", iconSavePath)
+ BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
+ "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
+ BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
+ "{}/{}.desktop".format(get_desktop_path(), packageName.get()))
+ AddNewUengineDesktopLink.SaveHistory()
+ messagebox.showinfo(title="提示", message="创建完毕!")
+
+ # 删除快捷方式
+ def DelDesktopLink():
+ global packageName
+ if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
+ messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
+ return
+ if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
+ return
+ try:
+ os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
+ AddNewUengineDesktopLink.SaveHistory()
+ messagebox.showinfo(title="提示", message="已删除")
+ except:
+ traceback.print_exc()
+ messagebox.showerror(title="错误", message=traceback.format_exc())
+
+ # 保存历史记录
+ def SaveHistory():
+ findApkNameHistory.append(packageName.get())
+ findApkActivityHistory.append(activityName.get())
+ packageName['value'] = findApkNameHistory
+ activityName['value'] = findApkActivityHistory
+ write_txt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json", str(json.dumps(ListToDictionary(findApkNameHistory)))) # 将历史记录的数组转换为字典并写入
+ write_txt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json", str(json.dumps(ListToDictionary(findApkActivityHistory)))) # 将历史记录的数组转换为字典并写入
+
+ # 打开测试
+ def TestOpen():
+ threading.Thread(target=os.system, args=["/usr/bin/uengine-launch.sh --package={} --component={}".format(packageName.get(), activityName.get())]).start()
+ AddNewUengineDesktopLink.SaveHistory()
+
+ # 浏览文件
+ def FindApk():
+ path = filedialog.askopenfilename(title="选择apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkName.json"))["path"])
+ if path == "" or path == ():
+ return
+ packageName.set(GetApkPackageName(path))
+ activityName.set(GetApkActivityName(path))
+ write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
+
+###########################
+# 程序信息
+###########################
+programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
+information = json.loads(readtxt(programPath + "/information.json"))
+programUrl = information["Url"][0]
+version = information["Version"]
+goodRunSystem = information["System"]
+aaptVersion = GetCommandReturn("aapt version")
+about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。
+
+版本 :{}
+
+适用平台 :{}
+
+程序官网 :{}
+
+©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
+tips = "\n".join(information["Tips"])
+updateThingsString = "\n".join(information["Update"])
+title = "UEngine 运行器 {}".format(version)
+updateTime = information["Time"]
+updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
+iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
+desktop = programPath + "/UengineAndroidProgramList.desktop"
+desktopName = "UengineAndroidProgramList.desktop"
+contribute = "\n".join(information["Contribute"])
+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"))
+
+
+###########################
+# 加载配置
+###########################
+if not os.path.exists("{}/.local/share/applications/uengine/".format(get_home())):
+ os.mkdir("{}/.local/share/applications/uengine/".format(get_home()))
+if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
+ os.mkdir(get_home() + "/.config/uengine-runner") # 创建配置文件夹
+if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkHistory.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", json.dumps({})) # 创建配置文件
+if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkNameHistory.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json", json.dumps({})) # 创建配置文件
+if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json", json.dumps({})) # 创建配置文件
+if not os.path.exists(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json", json.dumps({})) # 创建配置文件
+if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkName.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/FindApkName.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
+if not os.path.exists(get_home() + "/.config/uengine-runner/FindApk.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/FindApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
+if not os.path.exists(get_home() + "/.config/uengine-runner/FindUninstallApk.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/FindUninstallApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
+if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApkIcon.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
+if not os.path.exists(get_home() + "/.config/uengine-runner/SaveApk.json"): # 如果没有配置文件
+ write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件
+
+###########################
+# 设置变量
+###########################
+findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkHistory.json")).values())
+fineUninstallApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindUninstallApkHistory.json")).values())
+findApkNameHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkNameHistory.json")).values())
+findApkActivityHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkActivityHistory.json")).values())
+
+# add sub window
+#添加窗口开启关闭开关,防止重复开启
+windowflag = "close"
+
+def showhelp():
+
+ #define window and frame and button label
+ #
+ global windowflag
+ if windowflag == "close":
+ helpwindow=tk.Toplevel()
+ helpwindow.resizable(0, 0)
+ helpwindow.title("帮助")
+ helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
+
+ # get screen width and height
+ screen_width = helpwindow.winfo_screenwidth()
+ screen_height = helpwindow.winfo_screenheight()
+ # calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。
+ winwith=550
+ winhigh=700
+ x = (screen_width/2) - (winwith/2)
+ y = (screen_height/2) - (winhigh/2)
+
+ helpwindow.geometry("550x700"+"+{:.0f}+{:.0f}".format(x, y))
+
+ style = ttkthemes.ThemedStyle(helpwindow)
+ style.set_theme("breeze")
+
+
+
+ Frmroot=ttk.Frame(helpwindow)
+ FrmMenu = ttk.Frame(Frmroot)
+ FrmText = ttk.Frame(Frmroot)
+
+ LabFrmText=ttk.LabelFrame(FrmText,text="帮助",height=800,borderwidth=3)
+ HelpStr = tk.StringVar()
+ HelpStr.set(tips)
+ LabText = ttk.Label(LabFrmText, textvariable=HelpStr,width=55)
+ LabText.config(wraplength=350)
+
+ def on_closing():
+ global windowflag
+ windowflag = "close"
+ print(windowflag)
+ helpwindow.destroy()
+
+
+
+ # define button func
+ def ChgLog():
+ HelpStr.set(updateThingsString)
+ def ChgAbout():
+ HelpStr.set(about)
+ def ChgDep():
+ HelpStr.set(useProgram)
+ def ChgCon():
+ HelpStr.set(contribute)
+ def ChgTips():
+ HelpStr.set(tips)
+ LabText.config(wraplength=350)
+
+ BtnReadme = ttk.Button(FrmMenu, text="使用说明",width=14,command=ChgTips)
+ BtnLog = ttk.Button(FrmMenu, text="更新内容",width=14,command=ChgLog)
+ BtnZujian = ttk.Button(FrmMenu, text="程序依赖的组件",width=14,command=ChgDep)
+ BtnGongxian = ttk.Button(FrmMenu, text="有贡献的开发者",width=14,command=ChgCon)
+ BtnAbout = ttk.Button(FrmMenu, text="关于",width=14,command=ChgAbout)
+
+
+ #layout
+ FrmMenu.grid(row=0,column=0,sticky=tk.NW)
+ BtnReadme.grid(row=0,column=0,sticky=tk.NW,padx=3)
+ BtnLog.grid(row=1,column=0,sticky=tk.NW,padx=3)
+ BtnZujian.grid(row=2,column=0,sticky=tk.NW,padx=3)
+ BtnGongxian.grid(row=3,column=0,sticky=tk.NW,padx=3)
+ BtnAbout.grid(row=4,column=0,sticky=tk.NW,padx=3)
+
+ FrmText.grid(row=0,column=1,sticky=tk.NW)
+ LabFrmText.grid(row=0,column=0,sticky=tk.NW,padx=3,pady=3)
+ LabText.grid(row=0,column=0,sticky=tk.NW)
+
+ Frmroot.pack()
+ windowflag = "open"
+ print(windowflag)
+ #helpwindow.mainloop()
+ helpwindow.protocol("WM_DELETE_WINDOW", on_closing)
+
+
+###########################
+# 窗口创建
+###########################
+win = tk.Tk() # 创建窗口
+
+# 设置窗口
+style = ttkthemes.ThemedStyle(win)
+style.set_theme("breeze")
+window = ttk.Frame(win)
+win.attributes('-alpha', 0.5)
+win.title(title)
+win.resizable(0, 0)
+win.iconphoto(False, tk.PhotoImage(file=iconPath))
+
+# get screen width and height
+screen_width = win.winfo_screenwidth()
+screen_height = win.winfo_screenheight()
+# calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。
+winwith=570
+winhigh=236
+x = (screen_width/2) - (winwith/2)
+y = (screen_height/2) - (winhigh/2)
+
+win.geometry(""+"+{:.0f}+{:.0f}".format(x, y))
+
+# 创建控件
+FrmInstall = ttk.Frame(window)
+FrmUninstall = ttk.Frame(window)
+LabApkPath = ttk.Label(window, text="安装APK:")
+LabUninstallPath = ttk.Label(window, text="卸载APK:")
+ComboInstallPath = ttk.Combobox(window, width=50)
+ComboUninstallPath = ttk.Combobox(window, width=50)
+BtnFindApk = ttk.Button(FrmInstall, text="浏览", command=FindApk)
+BtnInstall = ttk.Button(FrmInstall, text="安装", command=Button3Install)
+BtnShowUengineApp = ttk.Button(window, text="打开 UEngine 应用列表", command=Button5Click)
+BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text="浏览", command=BtnFindUninstallApkClk)
+BtnUninstall = ttk.Button(FrmUninstall, text="卸载", command=ButtonClick8)
+Btngeticon = ttk.Button(FrmInstall, text="保存图标", command=SaveIconToOtherPath)
+BtnSaveApk = ttk.Button(FrmInstall, text="保存apk", command=SaveInstallUengineApp)
+# 设置菜单栏
+menu = tk.Menu(window, 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")
+help = tk.Menu(menu, tearoff=0, background="white") # 设置“帮助”菜单栏
+
+adbServer = tk.Menu(adb, tearoff=0, background="white")
+
+uengineService = tk.Menu(uengine, tearoff=0, background="white")
+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="adb", menu=adb)
+menu.add_cascade(label="UEngine", menu=uengine)
+menu.add_cascade(label="关于", menu=help)
+
+programmenu.add_command(label="清空软件历史记录", command=CleanProgramHistory)
+programmenu.add_separator() # 设置分界线
+programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”
+
+adb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
+adb.add_separator()
+adb.add_cascade(label="adb 服务", menu=adbServer)
+adb.add_command(label="显示 adb 连接的设备", command=AdbConnectDeviceShow)
+adb.add_separator()
+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=showhelp) # 设置“关于这个程序”项
+
+uengineService.add_command(label="启用 UEngine 服务(需要 root)", command=StartUengine)
+uengineService.add_command(label="关闭 UEngine 服务(需要 root)", command=StopUengine)
+uengineService.add_command(label="重启 UEngine 服务(需要 root)", command=UengineRestart)
+
+uengineInternet.add_command(label="启用 UEngine 网络桥接(需要 root)", command=UengineBridgeStart)
+uengineInternet.add_command(label="关闭 UEngine 网络桥接(需要 root)", command=UengineBridgeStop)
+uengineInternet.add_command(label="重启 UEngine 网络桥接(需要 root)", command=UengineBridgeRestart)
+uengineInternet.add_command(label="加载 UEngine 网络桥接(需要 root)", command=UengineBridgeReload)
+uengineInternet.add_command(label="强制加载 UEngine 网络桥接(需要 root)", command=UengineBridgeForceReload)
+
+uengineIcon.add_command(label="发送 UEngine 应用列表到桌面", command=SendUengineAndroidListForDesktop)
+uengineIcon.add_command(label="发送 UEngine 应用列表到启动器", command=SendUengineAndroidListForLauncher)
+uengineIcon.add_separator()
+uengineIcon.add_command(label="添加/删除指定的 UEngine 快捷方式", command=AddNewUengineDesktopLink.ShowWindow)
+uengineIcon.add_separator()
+uengineIcon.add_command(label="清空所有 UEngine 快捷方式", command=CleanAllUengineDesktopLink)
+
+uengineUseAdb.add_command(label="adb 连接 UEngine", command=UengineConnectAdb)
+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_command(label="清空 UEngine 数据(需要 root)", command=BackUengineClean)
+
+menu.configure(activebackground="dodgerblue")
+help.configure(activebackground="dodgerblue")
+adb.configure(activebackground="dodgerblue")
+uengine.configure(activebackground="dodgerblue")
+programmenu.configure(activebackground="dodgerblue")
+uengineService.configure(activebackground="dodgerblue")
+uengineInternet.configure(activebackground="dodgerblue")
+uengineIcon.configure(activebackground="dodgerblue")
+uengineUseAdb.configure(activebackground="dodgerblue")
+uengineData.configure(activebackground="dodgerblue")
+
+# 设置控件
+ComboUninstallPath['value'] = fineUninstallApkHistory
+ComboInstallPath['value'] = findApkHistory
+try:
+ if sys.argv[1] == "-i":
+ ComboInstallPath.set(sys.argv[2])
+ print("Install Path: " + sys.argv[2])
+ elif sys.argv[1] == "-u":
+ ComboUninstallPath.set(sys.argv[2])
+ print("Unstall Path: " + sys.argv[2])
+ else:
+ print("Command Format Error")
+except:
+ print("Not Command Or Command Format Error")
+# 显示控件
+win.config(menu=menu) # 显示菜单栏
+
+
+
+LabApkPath.grid(row=1, column=0,sticky= tk.W,padx=3)
+ComboInstallPath.grid(row=2, column=0,padx=3)
+
+
+FrmInstall.grid(row=2, column=1,padx=3, rowspan=2)
+BtnFindApk.grid(row=0, column=0)
+BtnInstall.grid(row=0, column=1)
+
+LabUninstallPath.grid(row=4, column=0,sticky= tk.W,padx=3)
+ComboUninstallPath.grid(row=5, column=0,padx=3)
+
+FrmUninstall.grid(row=5, column=1,padx=3)
+BtnUninstallApkBrowser.grid(row=0, column=0)
+BtnUninstall.grid(row=0, column=1)
+
+BtnShowUengineApp.grid(row=6, column=0,sticky= tk.W,padx=3,pady=2)
+
+Btngeticon.grid(row=1, column=0,sticky= tk.W,padx=3,pady=2)
+BtnSaveApk.grid(row=1, column=1,sticky= tk.W,padx=3,pady=2)
+
+window.pack()
+
+win.mainloop()
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json
old mode 100644
new mode 100755
index 815356f..947fc53
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json
@@ -1,6 +1,6 @@
{
"Package": "com.gitee.uengine.runner.spark",
"Update": true,
- "Version": "1.4.1",
+ "Version": "1.4.2",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
}
\ No newline at end of file
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder
index 6d2f12d..fbaf1ba 100755
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder
@@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi
-# 版本:1.3.3
-# 更新时间:2021年8月19日
+# 版本:1.4.2
+# 更新时间:2021年8月30日
# 感谢:anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建
###########################################################################################
@@ -374,7 +374,7 @@ def get_home():
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(programPath + "/information.json"))
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])
###########################
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean
index 019257b..98543e0 100755
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean
@@ -4,7 +4,7 @@ import sys
if len(sys.argv) > 1:
if sys.argv[1] == "--help":
print("帮助:")
- print("输入命令即可清空/重置uengine")
+ print("输入命令即可清空/重置UEngine")
sys.exit(0)
print("参数错误")
sys.exit(1)
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard
index ecf048e..39e6899 100755
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard
@@ -2,6 +2,7 @@
#########################################
# 版本:1.4.0
# 更新时间:2021年08月26日
+# Need: unix, python3-tk, python3-pip, pymouse, keyboard
#########################################
import os
import sys
@@ -17,17 +18,19 @@ import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog
-
+import Xlib.threaded as threaded
+#import pymouse.unix as pymouse
########################
#
########################
def Inputt(key):
- if key.event_type == "down":
+ if key.event_type == "up":
global setting
if setting:
Setting(key)
else:
Mouse(key)
+ #Mouse(key)
def Open():
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
@@ -49,9 +52,14 @@ def ReStartProgram()->"重启本应用程序":
def Mouse(key):
+ print(keybo)
if keybo.__contains__(key.name):
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):
if key.event_type == 'up':
@@ -84,10 +92,15 @@ def ShowTips():
time.sleep(0.1)
ShowTips()
except:
- pass
+ traceback.print_exc()
+ if not close:
+ ShowTips()
+
+def Closing():
+ close = True
+ window.destroy()
def Key():
- global inputs
keyboard.hook(Inputt)
# 获取用户主目录
@@ -95,11 +108,7 @@ def get_home()->"获取用户主目录":
return os.path.expanduser('~')
# 写入文本文档
-def write_txt(path: "路径", things: "内容")->"写入文本文档":
- TxtDir = os.path.dirname(path)
- print(TxtDir)
- if not os.path.exists(TxtDir):
- os.makedirs(TxtDir,exist_ok=True)
+def write_txt(path: "路径", things: "内容")->"写入文本文档":
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
@@ -136,6 +145,7 @@ if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home()))
#
###################
setting = False
+close = False
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
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.set_theme("breeze")
+window.protocol('WM_DELETE_WINDOW', Closing)
window.resizable(0, 0)
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=aboutMenu)
@@ -202,8 +213,15 @@ settingMouseToKeyboard.grid(row=0, column=0)
settingButton.grid(row=0, column=1)
win.pack(fill="both", expand="yes")
-
+#threaded.lock.allocate_lock()
threading.Thread(target=Key).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()
\ No newline at end of file
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about
index 4c09eb2..c4330e7 100755
--- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about
@@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi
-# 版本:1.3.3
-# 更新时间:2021年8月19日
+# 版本:1.4.2
+# 更新时间:2021年8月30日
# 感谢:anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建
###########################################################################################
@@ -34,29 +34,42 @@ programUrl = information["Url"][0]
version = information["Version"]
goodRunSystem = information["System"]
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"])
updateThingsString = "\n".join(information["Update"])
-title = "uengine 运行器 {}".format(version)
+title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop"
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
#添加窗口开启关闭开关,防止重复开启
diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb
new file mode 100755
index 0000000..09b078d
--- /dev/null
+++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb
@@ -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)
\ No newline at end of file
diff --git a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.env.policy b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.env.policy
new file mode 100644
index 0000000..c0a942a
--- /dev/null
+++ b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.env.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Run App
+ 使用对应的程序需要输入密码
+ preferences-system
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/env
+ true
+
+
+
\ No newline at end of file
diff --git a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.rm.policy b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.rm.policy
new file mode 100644
index 0000000..9b65bb5
--- /dev/null
+++ b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.rm.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Delete Files
+ 删除文件需要输入密码
+ preferences-system
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/rm
+ true
+
+
+
\ No newline at end of file
diff --git a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy
new file mode 100644
index 0000000..7c0ca86
--- /dev/null
+++ b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-bridge.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://github.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Setting UEngine Internet Bridge
+ 设置 UEngine 桥接需要输入密码
+ kbox
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/uengine-bridge.sh
+ true
+
+
+
\ No newline at end of file
diff --git a/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy
new file mode 100644
index 0000000..70d8f15
--- /dev/null
+++ b/new-deb-build/usr/share/polkit-1/actions/com.deepin.pkexec.uengine-session-launch-helper.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Change UEngine
+ 设置 UEngine 需要输入密码
+ kbox
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/uengine-session-launch-helper
+ true
+
+
+
\ No newline at end of file
diff --git a/pkexec/com.deepin.pkexec.env.policy b/pkexec/com.deepin.pkexec.env.policy
new file mode 100644
index 0000000..c0a942a
--- /dev/null
+++ b/pkexec/com.deepin.pkexec.env.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Run App
+ 使用对应的程序需要输入密码
+ preferences-system
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/env
+ true
+
+
+
\ No newline at end of file
diff --git a/pkexec/com.deepin.pkexec.rm.policy b/pkexec/com.deepin.pkexec.rm.policy
new file mode 100644
index 0000000..9b65bb5
--- /dev/null
+++ b/pkexec/com.deepin.pkexec.rm.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Delete Files
+ 删除文件需要输入密码
+ preferences-system
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/rm
+ true
+
+
+
\ No newline at end of file
diff --git a/pkexec/com.deepin.pkexec.uengine-bridge.policy b/pkexec/com.deepin.pkexec.uengine-bridge.policy
new file mode 100644
index 0000000..7c0ca86
--- /dev/null
+++ b/pkexec/com.deepin.pkexec.uengine-bridge.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://github.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Setting UEngine Internet Bridge
+ 设置 UEngine 桥接需要输入密码
+ kbox
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/uengine-bridge.sh
+ true
+
+
+
\ No newline at end of file
diff --git a/pkexec/com.deepin.pkexec.uengine-session-launch-helper.policy b/pkexec/com.deepin.pkexec.uengine-session-launch-helper.policy
new file mode 100644
index 0000000..70d8f15
--- /dev/null
+++ b/pkexec/com.deepin.pkexec.uengine-session-launch-helper.policy
@@ -0,0 +1,21 @@
+
+
+
+ gfdgd xi
+ https://gitee.com/gfdgd-xi/uengine-runner/
+
+ Authentication is required to Change UEngine
+ 设置 UEngine 需要输入密码
+ kbox
+
+ no
+ no
+ auth_admin_keep
+
+ /usr/bin/uengine-session-launch-helper
+ true
+
+
+
\ No newline at end of file
diff --git a/setting-new.json b/setting-new.json
old mode 100644
new mode 100755
index 815356f..947fc53
--- a/setting-new.json
+++ b/setting-new.json
@@ -1,6 +1,6 @@
{
"Package": "com.gitee.uengine.runner.spark",
"Update": true,
- "Version": "1.4.1",
+ "Version": "1.4.2",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
}
\ No newline at end of file
diff --git a/setting.json b/setting.json
old mode 100644
new mode 100755
index 68321b4..eb69668
--- a/setting.json
+++ b/setting.json
@@ -1,7 +1,7 @@
{
"Package": "spark-uengine-runner",
"Update": true,
- "Version": "1.4.1",
+ "Version": "1.4.2",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
}
\ No newline at end of file
diff --git a/spark-uengine-runner.deb b/spark-uengine-runner.deb
index 198097b..53e4581 100755
Binary files a/spark-uengine-runner.deb and b/spark-uengine-runner.deb differ
diff --git a/uengine-apk-builder b/uengine-apk-builder
index 6d2f12d..fbaf1ba 100755
--- a/uengine-apk-builder
+++ b/uengine-apk-builder
@@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi
-# 版本:1.3.3
-# 更新时间:2021年8月19日
+# 版本:1.4.2
+# 更新时间:2021年8月30日
# 感谢:anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建
###########################################################################################
@@ -374,7 +374,7 @@ def get_home():
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(programPath + "/information.json"))
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])
###########################
diff --git a/uengine-clean b/uengine-clean
index 019257b..98543e0 100755
--- a/uengine-clean
+++ b/uengine-clean
@@ -4,7 +4,7 @@ import sys
if len(sys.argv) > 1:
if sys.argv[1] == "--help":
print("帮助:")
- print("输入命令即可清空/重置uengine")
+ print("输入命令即可清空/重置UEngine")
sys.exit(0)
print("参数错误")
sys.exit(1)
diff --git a/uengine-install (1).desktop b/uengine-install (1).desktop
index eae661c..e386dfa 100755
--- a/uengine-install (1).desktop
+++ b/uengine-install (1).desktop
@@ -2,15 +2,15 @@
Categories=system;Utility;
Encoding=UTF-8
Exec=uengine-runner -ci %F
-GenericName=APK 安装(uengine)
-GenericName[zh_CN]=APK 安装(uengine)
+GenericName=APK Install(UEngine)
+GenericName[zh_CN]=APK 安装(UEngine)
Icon=/opt/apps/uengine-runner/icon.png
MimeType=application/apk;
-Name=APK 安装(uengine)
-Name[zh_CN]=APK 安装(uengine)
+Name=APK Install(UEngine)
+Name[zh_CN]=APK 安装(UEngine)
NoDisplay=true
OnlyShowIn=Unity;
StartupNotify=false
-StartupWMClass=APK 安装(uengine)
+StartupWMClass=APK 安装(UEngine)
Terminal=false
Type=Application
diff --git a/uengine-keyboard b/uengine-keyboard
index ecf048e..39e6899 100755
--- a/uengine-keyboard
+++ b/uengine-keyboard
@@ -2,6 +2,7 @@
#########################################
# 版本:1.4.0
# 更新时间:2021年08月26日
+# Need: unix, python3-tk, python3-pip, pymouse, keyboard
#########################################
import os
import sys
@@ -17,17 +18,19 @@ import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
import tkinter.filedialog as filedialog
-
+import Xlib.threaded as threaded
+#import pymouse.unix as pymouse
########################
#
########################
def Inputt(key):
- if key.event_type == "down":
+ if key.event_type == "up":
global setting
if setting:
Setting(key)
else:
Mouse(key)
+ #Mouse(key)
def Open():
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
@@ -49,9 +52,14 @@ def ReStartProgram()->"重启本应用程序":
def Mouse(key):
+ print(keybo)
if keybo.__contains__(key.name):
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):
if key.event_type == 'up':
@@ -84,10 +92,15 @@ def ShowTips():
time.sleep(0.1)
ShowTips()
except:
- pass
+ traceback.print_exc()
+ if not close:
+ ShowTips()
+
+def Closing():
+ close = True
+ window.destroy()
def Key():
- global inputs
keyboard.hook(Inputt)
# 获取用户主目录
@@ -95,11 +108,7 @@ def get_home()->"获取用户主目录":
return os.path.expanduser('~')
# 写入文本文档
-def write_txt(path: "路径", things: "内容")->"写入文本文档":
- TxtDir = os.path.dirname(path)
- print(TxtDir)
- if not os.path.exists(TxtDir):
- os.makedirs(TxtDir,exist_ok=True)
+def write_txt(path: "路径", things: "内容")->"写入文本文档":
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
@@ -136,6 +145,7 @@ if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home()))
#
###################
setting = False
+close = False
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
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.set_theme("breeze")
+window.protocol('WM_DELETE_WINDOW', Closing)
window.resizable(0, 0)
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=aboutMenu)
@@ -202,8 +213,15 @@ settingMouseToKeyboard.grid(row=0, column=0)
settingButton.grid(row=0, column=1)
win.pack(fill="both", expand="yes")
-
+#threaded.lock.allocate_lock()
threading.Thread(target=Key).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()
\ No newline at end of file
diff --git a/uengine-runner-about b/uengine-runner-about
index 4c09eb2..c4330e7 100755
--- a/uengine-runner-about
+++ b/uengine-runner-about
@@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi
-# 版本:1.3.3
-# 更新时间:2021年8月19日
+# 版本:1.4.2
+# 更新时间:2021年8月30日
# 感谢:anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建
###########################################################################################
@@ -34,29 +34,42 @@ programUrl = information["Url"][0]
version = information["Version"]
goodRunSystem = information["System"]
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"])
updateThingsString = "\n".join(information["Update"])
-title = "uengine 运行器 {}".format(version)
+title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop"
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
#添加窗口开启关闭开关,防止重复开启
diff --git a/uengine-useadb b/uengine-useadb
new file mode 100755
index 0000000..09b078d
--- /dev/null
+++ b/uengine-useadb
@@ -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)
\ No newline at end of file
diff --git a/update-console.py b/update-console.py
old mode 100644
new mode 100755