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

View File

@@ -1,11 +1,11 @@
[Desktop Entry]
Categories=System;
Comment=uengineanbox 程序菜单
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

View File

@@ -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": "Linuxdeepin/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、tkintertkinter.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>"]
}

File diff suppressed because it is too large Load Diff

View File

@@ -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"
}

View File

@@ -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])
###########################

View File

@@ -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)

View File

@@ -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()

View File

@@ -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
#添加窗口开启关闭开关,防止重复开启

View File

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