修改语言配置文件

This commit is contained in:
gfdgd xi 2022-06-12 22:25:02 +08:00
parent 4a5d060c43
commit 22d1f1ab87
3 changed files with 68 additions and 10 deletions

View File

@ -13,6 +13,14 @@
"Btngeticon": "保存图标",
"BtnSaveApk": "保存Apk",
"BtnApkInformation": "Apk 信息",
"Error": {
"InstallError": "信息没有填写完整,无法继续安装 APK",
"UninstallError": "信息没有填写完整,无法继续卸载 APK",
"BackApkError": "无法还原安装包\n提示新版UEngine安装后会自动删除安装包备份的Apk在/tmp/uengine-runner/bak.apk电脑重启后就会丢失",
"ChooseApkError": "你没有选择 apk 文件",
"SaveApkIconError": "本程序不支持保存该 apk 的图标",
"PathError": "路径不存在,请重试!"
},
"Menu": [
{
"Name": "程序",
@ -105,7 +113,8 @@
"构建 UEngine 带最高权限的镜像到用户主目录",
"安装默认的 UEngine 镜像"
]
}
},
"在 Ubuntu 上安装 UEngine"
]
},
{
@ -150,6 +159,14 @@
"Btngeticon": "Save Apk Icon",
"BtnSaveApk": "Saving Installed App Apk",
"BtnApkInformation": "Apk Information",
"Error": {
"InstallError": "You don't input the APK file path, Can't install Android program by now.",
"UninstallError": "You don't input the APK file path or android program package name, Can't uninstall Android program by now.",
"BackApkError": "Can't recover the apk\nTips: Newer UEngine will delete the APK installing file when finish install, recover apk is in \"tmp/uengine-runner/bak.apk\", but it will be lose when you restart your computer.",
"ChooseApkError": "You don't choose any APK file.",
"SaveApkIconError": "This APK file isn't allow to save the icon file.",
"PathError": "Path not found, please try again"
},
"Menu": [
{
"Name": "Program",
@ -242,16 +259,17 @@
"Build An UEngine Image With Root User In Your Home Path",
"Install Defult UEngine Image"
]
}
},
"Install UEngine On Ubuntu"
]
},
{
"Name": "About",
"Menu": [
"Program WebSize",
"Program Help",
"About This Program",
"Upload Problem And Advice",
"ABout This Program",
"Update This Program",
"More Help"
]
}

17
main.py
View File

@ -64,7 +64,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 +92,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 +138,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 +334,9 @@ 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 BuildRootUengineImage():
threading.Thread(target=os.system, args=["deepin-terminal -C \"bash '{}'\"".format(programPath + "/root-uengine.sh")]).start()
@ -407,7 +411,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 +419,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 +527,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
@ -1399,6 +1403,7 @@ adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Men
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)

35
uengine-installer Executable file
View File

@ -0,0 +1,35 @@
#/bin/bash
is_tar_checked="0"
rm -rf /tmp/uengine
until [ "$is_tar_checked" = "1" ];do
echo "请拖入uengine.tar.xz并回车确认,可在 https://cowtransfer.com/s/44656ada129e42 下载获取。"
read tar_path
tar_path=`echo "$tar_path" | sed $'s/\'//g'`
echo "路径为 $tar_path"
tar_md5sum=`md5sum $tar_path`
tar_md5sum=`echo ${tar_md5sum%%/*}`
if [ "$tar_md5sum" = "b8429c4d8bfd507b9dc4547e0b71c962" ];then
is_tar_checked="1"
else
echo $tar_md5sum
echo "md5完整性检查失败请检查是否是这个文件"
sleep 3
reset
fi
done
echo "完整性检查通过开始部署。部署过程会需要root权限完成后会要求重启。请注意不要在安装过程中安装或卸载其他软件"
cd /tmp
tar -xf "$tar_path"
mkdir -p $HOME/uengine
mkdir -p $HOME/uengine-launch
cp /tmp/uengine/run_daemon.sh $HOME/uengine-launch
cp /tmp/uengine/launch_uengine.sh $HOME/uengine-launch
cd /tmp/uengine
/tmp/uengine/install.sh
echo "重启后在$HOME/uengine-launch执行launch_uengine.sh即可打开uengine守护进程。随后即可安装和使用安卓应用"
echo "你需要在每次启动安卓应用之前打开这个脚本。打开后可安全关闭"
echo "按回车重启"
read
reboot