制作平滑升级包ing……

This commit is contained in:
gfdgd xi 2022-06-20 22:29:10 +08:00
parent acaa13e8ae
commit 9660c8fb72
8 changed files with 108 additions and 1568 deletions

Binary file not shown.

View File

@ -4,7 +4,7 @@
"https://gitee.com/gfdgd-xi/uengine-runner",
"https://github.com/gfdgd-xi/uengine-runner"
],
"Version": "1.6.2 Alpha",
"Version": "1.6.2",
"System": "Linuxdeepin/UOS",
"Tips": [
"更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis",
@ -26,6 +26,7 @@
"※1、优化了 UEngine 运行器的英语翻译",
"※2、新增加了可以打开或关闭第三方应用安装的功能使用此功能后在UEngine里可以使用默认的APK安装程序安装应用此操作需要使用程序的Adb补丁",
"※3、新增加了 UEngine 的 Ubuntu 安装程序",
"※4、双包合一只保留了UOS打包标准可以从旧标准无缝升级",
"4、修复了本程序在 Ubuntu 上安装和卸载报错无法继续的问题",
"V1.6.1",
"※1、修复了打包 deb 包在 APK 的包名有大写时无法启动的问题",

11
main.py
View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者gfdgd xi<3025613752@qq.com>
# 版本1.6.2 Alpha
# 更新时间2022年6月19日(要期末考试了)
# 版本1.6.2
# 更新时间2022年6月20日(要期末考试了)
# 感谢anbox、deepin 和 UOS
# 基于 Python3 的 tkinter 构建
# 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>、为什么您不喜欢熊出没和阿布呢
@ -18,7 +18,6 @@ import time
import json
import shutil
import zipfile
import ctypes
import traceback
import threading
import easygui
@ -1244,12 +1243,14 @@ def showhelp():
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))
if not helpwindow.winfo_screenheight() > 1080:
helpwindow.geometry(f"{winwith}x{winhigh}"+"+{:.0f}+{:.0f}".format(x, y))
style = ttkthemes.ThemedStyle(helpwindow)
style.set_theme("breeze")

View File

@ -2,12 +2,11 @@ Package: com.gitee.uengine.runner.spark
Replaces: spark-uengine-runner
Breaks: spark-uengine-runner
Source: com.gitee.uengine.runner.spark
Version: 1.6.2Alpha1
Version: 1.6.2
Architecture: all
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>, 柚子<https://gitee.com/Limexb>, 为什么您不喜欢熊出没和阿布呢<https://weibo.com/u/7755040136>, 星空露光<https://gitee.com/Cynorkyle>, shenmo
Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, uengine, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell, python3-xlib, fonts-noto-cjk, python3-numpy, python3-matplotlib, wget, inotify-tools, aria2
Section: utils
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>, 柚子<https://gitee.com/Limexb>, 为什么您不喜欢熊出没和阿布呢<https://weibo.com/u/7755040136>, 星空露光<https://gitee.com/Cynorkyle>, shenmo<jifengshenmo@outlook.com>
Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell, python3-xlib, fonts-noto-cjk, python3-numpy, python3-matplotlib, wget, inotify-tools, aria2, uengine
Priority: optional
Conflicts: spark-uengine-runner, spark-uengine-apk-builder
Conflicts: 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

View File

@ -0,0 +1,25 @@
#!/bin/bash
FILE=/usr/bin/uengine
if [ -f "$FILE" ]; then
echo "$FILE 存在,正常打开菜单"
/usr/bin/uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
else
echo "$FILE 不存在,没有安装 UEngine询问是否安装 UEngine"
# 读取系统版本
version=`sed -n '/^NAME/s/NAME="//Ip' /etc/os-release | sed -n 's/\"//Ip'`
declare -l versionLower=$version
echo "系统:$version"
if [ "$versionLower" = "deepin" ] || [ "$versionLower" = "uos" ]; then
echo "此系统为 Deepin/UOS使用 apt 安装"
zenity --question --text="您还未安装 UEngine是否现在安装" --no-wrap
if [[ $? = 0 ]]; then
deepin-terminal -C "pkexec apt install uengine"
fi
else
echo "非 Deepin/UOS 系统,使用 shenmo 提供的脚本安装"
zenity --question --text="您还未安装 UEngine是否现在安装\n将会使用 shenmo 提供的脚本进行安装" --no-wrap
if [[ $? = 0 ]]; then
deepin-terminal -C "bash /opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer"
fi
fi
fi

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行
###########################################################################################
# 作者gfdgd xi<3025613752@qq.com>
# 版本1.6.1
# 更新时间2022年5月21日要开学了)
# 版本1.6.2 Alpha
# 更新时间2022年6月19日要期末考试了)
# 感谢anbox、deepin 和 UOS
# 基于 Python3 的 tkinter 构建
# 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>、为什么您不喜欢熊出没和阿布呢
@ -12,11 +12,13 @@
# 引入所需的库
#################
import os
import api
import sys
import time
import json
import shutil
import zipfile
import ctypes
import traceback
import threading
import easygui
@ -64,7 +66,8 @@ def UninstallProgram(package: "apk 包名")->"卸载程序":
# 卸载按钮事件
def ButtonClick8():
if ComboInstallPath.get() is "":
messagebox.showerror(title="提示", message="信息没有填写完整,无法继续卸载 APK")
messagebox.showerror(title="提示", message=langFile[lang]["Main"]["MainWindow"]["Error"]["UninstallError"])
return
DisabledAndEnbled(True)
if os.path.exists(ComboInstallPath.get()):
@ -91,7 +94,7 @@ def FindApk()->"浏览窗口":
# 安装按钮事件
def Button3Install():
if ComboInstallPath.get() is "" or not os.path.exists(ComboInstallPath.get()):
messagebox.showerror(title="提示", message="信息没有填写完整或错误,无法继续安装 APK")
messagebox.showerror(title="提示", message=langFile[lang]["Main"]["MainWindow"]["Error"]["InstallError"])
return
DisabledAndEnbled(True)
threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start()
@ -137,7 +140,7 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
if setting["SaveApk"]:
shutil.copy("/tmp/uengine-runner/bak.apk", path)
except:
messagebox.showerror(title="错误", message="无法还原安装包\n提示新版UEngine安装后会自动删除安装包备份的Apk在/tmp/uengine-runner/bak.apk电脑重启后就会丢失")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["BackApkError"])
print("\nprint install complete")
if quit:
print(commandReturn)
@ -333,6 +336,12 @@ def InstallRootUengineImage():
write_txt("/tmp/uengine-runner/install.sh", "sudo dpkg -i /tmp/uengine-runner/u*.deb\nsudo apt install -f")
threading.Thread(target=os.system, args=["deepin-terminal -C \"wget -P '/tmp/uengine-runner' 'https://hub.fastgit.xyz/gfdgd-xi/uengine-runner/releases/download/U1.2.15/uengine-android-image_1.2.15_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'\""]).start()
def UengineUbuntuInstall():
threading.Thread(target=os.system, args=["deepin-terminal -C \"bash '{}'\"".format(programPath + "/uengine-installer")]).start()
def UbuntuInstallUengine():
threading.Thread(target=os.system, args=["deepin-terminal -C \"bash '{}'\"".format(programPath + "/uengine-installer")]).start()
def BuildRootUengineImage():
threading.Thread(target=os.system, args=["deepin-terminal -C \"bash '{}'\"".format(programPath + "/root-uengine.sh")]).start()
@ -407,7 +416,7 @@ def KeyboardToMouse():
def SaveIconToOtherPath():
apkPath = ComboInstallPath.get()
if apkPath == "":
messagebox.showerror(title="错误", message="你没有选择 apk 文件")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ChooseApkError"])
return
path = filedialog.asksaveasfilename(title="保存图标", filetypes=[("PNG 图片", "*.png"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApkIcon.json"))["path"])
if not path == "":
@ -415,7 +424,7 @@ def SaveIconToOtherPath():
SaveApkIcon(apkPath, path)
except:
traceback.print_exc()
messagebox.showerror(title="错误", message="本程序不支持保存该 apk 的图标")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["SaveApkIconError"])
return
write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
findApkHistory.append(ComboInstallPath.get())
@ -523,7 +532,7 @@ def SaveInstallUengineApp():
return
if os.path.exists("/data/uengine/data/data/app/{}-1".format(result)):
break
messagebox.showerror(title="错误", message="路径不存在,请重试!")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["PathError"])
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
@ -659,6 +668,18 @@ def VersionCheck(version1, version2):
def ShowHelp():
webbrowser.open_new_tab(programPath + "/Help/index.html")
def AllowOrDisallowUpdateAndroidApp():
if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
if not messagebox.askyesno(title=langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["UseAdbPackageAnswer"]):
return
os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath,"{}/.android/adbkey.pub".format(get_home()))) # 写入配
adb = api.Adb("192.168.250.2:5555")
adb.Service.Close()
adb.connect()
if messagebox.askyesno(title=langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["AllowOrDisallowUpdateAndroidAppAnswer"][int(adb.boolAndroidInstallOtherAppSetting())]):
adb.setAndroidInstallOtherAppSetting(not adb.boolAndroidInstallOtherAppSetting())
messagebox.showinfo(title=langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"])
class SettingWindow():
saveApkOption = tk.IntVar()
def ShowWindow():
@ -670,7 +691,7 @@ class SettingWindow():
try:
data = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json"))
except:
messagebox.showerror(title="错误", message="读取设置错误!无法打开设置窗口!")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["SettingReadError"])
setting.destroy()
SettingWindow.saveApkOption = tk.IntVar()
SettingWindow.saveApkOption.set(int(data["SaveApk"]))
@ -686,7 +707,7 @@ class SettingWindow():
write_txt(get_home() + "/.config/uengine-runner/setting.json", json.dumps({"SaveApk": bool(SettingWindow.saveApkOption.get())}))
except:
traceback.print_exc()
messagebox.showerror(title="错误", message="保存设置错误!")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["SettingSaveError"])
return
messagebox.showinfo(title="提示", message="设置保存完毕!")
@ -712,8 +733,7 @@ class UpdateWindow():
updateText.insert("0.0", UpdateWindow.data["New"].replace("\\n", "\n"))
except:
traceback.print_exc()
messagebox.showerror(title="错误", message="无法连接服务器!")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ConnectServerError"])
updateText.configure(state=tk.DISABLED)
versionLabel.pack(anchor=tk.W)
updateText.pack()
@ -753,7 +773,7 @@ class ApkInformation():
path = ComboInstallPath.get()
package = GetApkPackageName(path)
if package == None or package == "":
messagebox.showerror(title="错误", message="该应用安装包异常,无法查询相关数据!")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ApkFileError"])
return
message = tk.Toplevel()
message.title("“{}“的Apk信息".format(GetApkChineseLabel(path)))
@ -818,12 +838,13 @@ Activity{}
try:
messagebox.showinfo(title="提示", message=requests.post("http://120.25.153.144/uengine-runner/app/check/add.php", {"Package": GetApkPackageName(path), "Type": choose}).text)
except:
messagebox.showerror(title="错误", message="无法连接服务器!无法进行评分!")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ConnectServerStarError"])
def ShowMap():
package = GetApkPackageName(path)
if package == None or package == "":
messagebox.showerror(title="错误", message="该应用安装包异常,无法查询相关数据!")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["ApkFileError"])
return
try:
data = json.loads(requests.get("http://120.25.153.144/uengine-runner/app/check/" + package +"/data.json").text)
@ -844,7 +865,6 @@ Activity{}
matplotlib.pylab.title("“" + chinese + "”的用户评分(数据只供参考)", fontproperties=fonts)
matplotlib.pylab.show()
class AdbChangeUengineDisplaySize():
def ShowWindows():
global displayX
@ -901,7 +921,7 @@ class AdbChangeUengineDisplaySize():
int(displayX.get())
int(displayY.get())
except:
messagebox.showerror(title="错误", message="你输入的数值不正确!")
messagebox.showerror(title="错误", message=langFile[lang]["Main"]["MainWindow"]["Error"]["InputDataError"])
return
os.system("adb -s '192.168.250.2:5555' shell wm size {}x{}".format(displayX.get(), displayY.get()))
AdbChangeUengineDisplaySize.GetUengineDisplaySize()
@ -1245,7 +1265,7 @@ def showhelp():
HelpStr.set(tips)
LabText = ttk.Label(LabFrmText, textvariable=HelpStr,width=55)
LabText.config(wraplength=350)
def on_closing():
global windowflag
windowflag = "close"
@ -1315,6 +1335,26 @@ def showhelp():
#helpwindow.mainloop()
helpwindow.protocol("WM_DELETE_WINDOW", on_closing)
###########################
# 检查 UEngine 是否安装
###########################
if not os.path.exists("/usr/bin/uengine"):
# 不渲染窗口
style = ttkthemes.ThemedStyle(win)
style.set_theme("breeze")
win.withdraw()
# Deepin/UOS 用户
if "deepin" in SystemVersion.lower() or "uos" in SystemVersion.lower():
if messagebox.askyesno(title="提示", message="您的电脑没有安装 UEngine是否安装 UEngine 以便更好的使用\n安装完后重新启动该程序即可"):
os.system("deepin-terminal -C \"pkexec apt install uengine\"")
sys.exit(0)
# 非 Deepin/UOS 用户
else:
if messagebox.askyesno(title="提示", message="您的电脑没有安装 UEngine是否安装 UEngine 以便更好的使用\n这里将会使用 shenmo 提供的脚本进行安装\n安装完后重新启动该程序即可"):
os.system(f"deepin-terminal -C \"bash '{programPath}/uengine-installer'\"")
sys.exit(0)
# 重新显示窗口
win.wm_deiconify()
###########################
# 窗口创建
@ -1396,9 +1436,11 @@ adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Men
adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][1], command=AdbStopServer)
adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2], command=AdbKillAdbProgress)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][13], command=AllowOrDisallowUpdateAndroidApp)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][1], command=OpenUengineDebBuilder)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][7], command=KeyboardToMouse)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][8], command=UengineCheckCpu)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][12], command=UengineUbuntuInstall)
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][2]["Name"], menu=uengineService)
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][3]["Name"], menu=uengineInternet)
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][4]["Name"], menu=uengineIcon)
@ -1407,6 +1449,7 @@ uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][9], command=DelUengineCheck)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][10], command=ReinstallUengine)
uengine.add_cascade(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][11]["Name"], menu=uengineRoot)
uengine.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][2]["Menu"][14], command=UbuntuInstallUengine)
help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][0], command=OpenProgramURL) # 设置“程序官网”项
help.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][2], command=UengineRunnerBugUpload) # 设置“传bug”项

View File

@ -0,0 +1,10 @@
Package: spark-uengine-runner
Depends: com.gitee.uengine.runner.spark, ${misc:Depends}
Architecture: all
Priority: optional
Section: oldlibs
Version: 1.6.2
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>, 柚子<https://gitee.com/Limexb>, 为什么您不喜欢熊出没和阿布呢<https://weibo.com/u/7755040136>, 星空露光<https://gitee.com/Cynorkyle>, shenmo<jifengshenmo@outlook.com>
Conflicts: 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