1.5.3完成
This commit is contained in:
parent
2abc67e426
commit
09857468f7
17
README.md
17
README.md
|
@ -1,9 +1,9 @@
|
|||
# uengine 运行器 1.5.2
|
||||
# uengine 运行器 1.5.3
|
||||
|
||||
### 介绍
|
||||
新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。
|
||||
![1.5.2](https://storage.deepin.org/thread/202111281607295590_截图_选择区域_20211128160706.png)
|
||||
(测试平台:UOS 家庭版,deepin 20.2.2,UOS 专业版 1040)
|
||||
![1.5.3](https://storage.deepin.org/thread/202112121231595786_截图_选择区域_20211212123106.png)
|
||||
(测试平台:UOS 家庭版 21.1,deepin 20.3,UOS 专业版 1040)
|
||||
(自己美术功底太差,图标直接用 anbox 的了)
|
||||
|
||||
## 安装前必读
|
||||
|
@ -15,10 +15,11 @@
|
|||
### 更新内容
|
||||
#### V1.5.3(2021-12-12,DDUC11版,未完全完工):
|
||||
##### 更新内容
|
||||
**※1、“添加/删除 UEngine 图标”窗口的写入按钮在目录**`~/.local/share/icons/hicolor/256x256/apps`**不存在时点击无反应,参考报错1.5.3-1**
|
||||
**※2、修复了“UEngine APK 应用打包器”打包的deb包的.desktop文件的**`Icon`**和**`Exec`**字段有误的问题以及使用“使用前缀‘uengine-dc’”前缀的问题**
|
||||
3、“UEngine APK 应用打包器”支持打包完后自动删除临时目录
|
||||
4、“UEngine APK 应用打包器”以及“添加/删除 UEngine 图标”支持在运行出现错误时显示报错
|
||||
**※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题**
|
||||
**※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录**`~/.local/share/icons/hicolor/256x256/apps`**不存在时点击无反应,参考报错1.5.3-1**
|
||||
**※3、修复了“UEngine APK 应用打包器”打包的deb包的.desktop文件的**`Icon`**和**`Exec`**字段有误的问题以及使用“使用前缀‘uengine-dc’”前缀的问题**
|
||||
4、“UEngine APK 应用打包器”支持打包完后自动删除临时目录
|
||||
5、“UEngine APK 应用打包器”以及“添加/删除 UEngine 图标”支持在运行出现错误时显示报错
|
||||
##### 报错:
|
||||
*1.5.3-1*
|
||||
```bash
|
||||
|
@ -34,6 +35,8 @@ Traceback (most recent call last):
|
|||
with open(dst, 'wb') as fdst:
|
||||
FileNotFoundError: [Errno 2] No such file or directory: '/home/gfdgd_xi/.local/share/icons/hicolor/256x256/apps/com.miHoYo.cloudgames.ys.png'
|
||||
```
|
||||
##### 截图
|
||||
![1.5.3](https://storage.deepin.org/thread/202112121231595786_截图_选择区域_20211212123106.png)
|
||||
|
||||
#### V1.5.2(2021-11-28):
|
||||
**※1、支持安装和构建带 Root 的 UEngine 的镜像**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Package: spark-uengine-runner
|
||||
Version: 1.5.2
|
||||
Version: 1.5.3
|
||||
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
|
||||
|
|
|
@ -7,4 +7,4 @@ python3 -m pip install --upgrade requests -i http://mirrors.aliyun.com/pypi/si
|
|||
# 刷新图标缓存
|
||||
gtk-update-icon-cache /usr/share/icons/bloom
|
||||
# 向服务器返回安装数加1(不显示内容且忽略错误)
|
||||
curl http://120.25.153.144/uengine-runner/Install.php?Version=1.5.2 -s > /dev/null | true
|
||||
curl http://120.25.153.144/uengine-runner/Install.php?Version=1.5.3 -s > /dev/null | true
|
|
@ -3,31 +3,33 @@
|
|||
"https://gitee.com/gfdgd-xi/uengine-runner",
|
||||
"https://github.com/gfdgd-xi/uengine-runner"
|
||||
],
|
||||
"Version": "1.5.2",
|
||||
"Version": "1.5.3",
|
||||
"System": "Linux(deepin/UOS)",
|
||||
"Tips": [
|
||||
"更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis",
|
||||
"",
|
||||
"安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮",
|
||||
"",
|
||||
"卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。",
|
||||
"",
|
||||
"保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可",
|
||||
"",
|
||||
"重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可",
|
||||
" 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了",
|
||||
"",
|
||||
"打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)",
|
||||
"",
|
||||
"提示:",
|
||||
"1、需要你有使用 root 权限的能力;",
|
||||
"2、需要安装 UEngine 才能使用;",
|
||||
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
|
||||
"4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
|
||||
"※1、近期升级的 UEngine 安装时会自动把要安装的 apk 删除,如果这个 apk 文件非常重要请拷贝一个备份版并安装这个备份版",
|
||||
"2、需要你有使用 root 权限的能力;",
|
||||
"3、需要安装 UEngine 才能使用;",
|
||||
"4、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
|
||||
"5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
|
||||
],
|
||||
"Update": [
|
||||
"V1.5.3:",
|
||||
"※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题",
|
||||
"※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应,参考报错",
|
||||
"※3、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀‘uengine-dc’”前缀的问题",
|
||||
"4、“UEngine APK应用打包器”支持打包完后自动删除临时目录",
|
||||
"5、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错",
|
||||
"",
|
||||
"V1.5.2:",
|
||||
"※1、支持安装和构建带 Root 的 UEngine 的镜像",
|
||||
"※1、支持安装和构建带Root的UEngine的镜像",
|
||||
"2、更新了反馈链接",
|
||||
"",
|
||||
"V1.5.1:",
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"Package": "com.gitee.uengine.runner.spark",
|
||||
"Update": true,
|
||||
"Version": "1.5.1",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"Package": "spark-uengine-runner",
|
||||
"Update": true,
|
||||
"Version": "1.5.1",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi
|
||||
# 版本:1.5.1
|
||||
# 更新时间:2021年10月06日
|
||||
# 版本:1.5.3
|
||||
# 更新时间:2021年12月12日(DDUC11了)
|
||||
# 感谢:anbox、deepin 和 统信
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
|
@ -43,12 +43,20 @@ def BuildDeb():
|
|||
messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK")
|
||||
return
|
||||
DisabledAndEnbled(True)
|
||||
threading.Thread(target=BuildApkDeb, args=(combobox1.get(),)).start()
|
||||
threading.Thread(target=GetBuildApkDebError, args=(combobox1.get(),)).start()
|
||||
|
||||
def RunCommandShow(command):
|
||||
TextboxAddText1("$> {}".format(command))
|
||||
TextboxAddText1(GetCommandReturn(command))
|
||||
|
||||
def GetBuildApkDebError(apkPath):
|
||||
try:
|
||||
BuildApkDeb(apkPath)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
DisabledAndEnbled(False)
|
||||
|
||||
def BuildApkDeb(apkPath):
|
||||
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
|
||||
RunCommandShow("echo '======================================New===================================='")
|
||||
|
@ -58,11 +66,12 @@ def BuildApkDeb(apkPath):
|
|||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath))
|
||||
RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'")
|
||||
apkPackageName = GetApkPackageName(apkPath)
|
||||
apkPackageName = GetApkPackageName(apkPath, False)
|
||||
apkPackageNameNew = GetApkPackageName(apkPath, True)
|
||||
apkPackageVersion = GetApkVersion(apkPath)
|
||||
apkChineseLabel = GetApkChineseLabel(apkPath)
|
||||
apkActivityName = GetApkActivityName(apkPath)
|
||||
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageName)
|
||||
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew)
|
||||
debControl = '''Package: {}
|
||||
Version: {}
|
||||
Architecture: all
|
||||
|
@ -70,82 +79,66 @@ Maintainer: {}
|
|||
Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1)
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Description: {}\n'''.format(apkPackageName, apkPackageVersion, apkChineseLabel, apkChineseLabel)
|
||||
Description: {}\n'''.format(apkPackageNameNew, apkPackageVersion, apkChineseLabel, apkChineseLabel)
|
||||
debPostinst = '''#!/bin/sh
|
||||
|
||||
APK_DIR="/usr/share/uengine/apk"
|
||||
APK_NAME="{}.apk"
|
||||
APK_NAME="{}"
|
||||
APK_PATH="$APK_DIR/$APK_NAME"
|
||||
DESKTOP_FILE="/usr/share/applications/{}.desktop"
|
||||
ICON_FILE="/usr/share/uengine/icons/{}.png"
|
||||
DESKTOP_FILE="{}"
|
||||
|
||||
|
||||
if [ -f $APK_PATH ]; then
|
||||
echo "Installing $APK_NAME"
|
||||
else
|
||||
echo "ERROR: $APK_NAME file not found."
|
||||
exit 1
|
||||
echo "ERROR: $APK_NAME does not exist."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
echo "ERROR: app install failed(session-manager is not running)."
|
||||
sess_dir="/usr/share/uengine/session_install"
|
||||
if [ ! -d $sess_dir ]; then
|
||||
mkdir $sess_dir
|
||||
chmod 777 $sess_dir
|
||||
fi
|
||||
apk_name=${{APK_PATH##*/}}
|
||||
fileName="$sess_dir/$apk_name"
|
||||
echo $DESKTOP_FILE > $fileName
|
||||
abistr=""
|
||||
if test -n "$abistr"; then
|
||||
abi=`echo $abistr |awk -F \= '{{print $2}}'`
|
||||
echo $abi >> $fileName
|
||||
fi
|
||||
chmod 766 $fileName
|
||||
fi
|
||||
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: apk install error..."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"
|
||||
|
||||
sudo rm -f "$APK_PATH"
|
||||
|
||||
exit 0'''.format(apkPackageName, apkPackageName, apkPackageName)
|
||||
exit 0'''.format(apkPackageNameNew + ".apk", "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
|
||||
debPrerm = '''#!/bin/sh
|
||||
|
||||
APP_NAME="{}"
|
||||
DESKTOP_FILE="{}"
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
exit 1
|
||||
echo "ERROR: app uninstall failed(session-manager is not running)."
|
||||
sess_dir="/usr/share/uengine/session_uninstall"
|
||||
if [ ! -d $sess_dir ]; then
|
||||
mkdir $sess_dir
|
||||
chmod 777 $sess_dir
|
||||
fi
|
||||
fileName="$sess_dir/$APP_NAME"
|
||||
echo $DESKTOP_FILE > $fileName
|
||||
chmod 766 $fileName
|
||||
fi
|
||||
|
||||
echo "Uninstalling $APP_NAME"
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: app uninstall error..."
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
exit 1
|
||||
fi
|
||||
/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"
|
||||
|
||||
cat /etc/passwd | awk -F: '$3>=1000' | cut -f 1 -d : | while read line
|
||||
do
|
||||
inifile="/home/$line/.config/uengineAppGeometry.ini"
|
||||
if [ -f $inifile ]; then
|
||||
sed -i "/$APP_NAME/d" $inifile
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0'''.format(apkPackageName)
|
||||
exit 0'''.format(apkPackageName, "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
|
||||
desktopFile = '''[Desktop Entry]
|
||||
Categories=Other;
|
||||
Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={}
|
||||
|
@ -162,20 +155,22 @@ Name={}
|
|||
write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst)
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm)
|
||||
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageName))
|
||||
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName), desktopFile)
|
||||
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, iconSavePath,
|
||||
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName))
|
||||
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageNameNew))
|
||||
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), desktopFile)
|
||||
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew),
|
||||
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew))
|
||||
RunCommandShow("echo '复制文件'")
|
||||
RunCommandShow("echo '写入 APK 软件图标'")
|
||||
SaveApkIcon(apkPath, iconSavePath)
|
||||
RunCommandShow("echo '复制 APK 文件'")
|
||||
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageName))
|
||||
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew))
|
||||
RunCommandShow("echo '正在设置文件权限……'")
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath))
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath))
|
||||
RunCommandShow("echo '打包 deb 到桌面……'")
|
||||
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageName, apkPackageVersion))
|
||||
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, apkPackageVersion))
|
||||
RunCommandShow("echo '正在删除临时目录……'")
|
||||
RunCommandShow("rm -rfv '{}'".format(tempPath))
|
||||
RunCommandShow("echo '完成!'")
|
||||
findApkHistory.append(apkPath)
|
||||
combobox1['value'] = findApkHistory
|
||||
|
@ -260,7 +255,7 @@ def GetApkActivityName(apkFilePath):
|
|||
line = line.replace("icon=", "")
|
||||
return line
|
||||
|
||||
def GetApkPackageName(apkFilePath):
|
||||
def GetApkPackageName(apkFilePath, setting):
|
||||
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
|
@ -271,7 +266,7 @@ def GetApkPackageName(apkFilePath):
|
|||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
# 此较为特殊,因为需要判断用户是否要添加前缀
|
||||
if qianZhui.get() == True:
|
||||
if setting:
|
||||
return "uengine-dc-{}".format(line).lower()
|
||||
return line.lower()
|
||||
|
||||
|
@ -294,7 +289,7 @@ def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath)
|
|||
[Desktop Entry]
|
||||
Categories=app;
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine launch.sh --action=android.intent.action.MAIN --package={} --component={}
|
||||
Exec=/usr/bin/uengine launch --action=android.intent.action.MAIN --package={} --component={}
|
||||
GenericName={}
|
||||
Icon={}
|
||||
MimeType=
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi<3025613752@qq.com>
|
||||
# 版本:1.5.1
|
||||
# 更新时间:2021年10月05日(国庆了)
|
||||
# 版本:1.5.3
|
||||
# 更新时间:2021年12月12日(DDUC11了)
|
||||
# 感谢:anbox、deepin 和 UOS
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
# 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>
|
||||
|
@ -37,6 +37,7 @@ def UninstallProgram(package: "apk 包名")->"卸载程序":
|
|||
try:
|
||||
global fineUninstallApkHistory
|
||||
Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package))
|
||||
print(Return)
|
||||
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)):
|
||||
|
@ -104,8 +105,6 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
|
|||
os.makedirs("{}/.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
|
||||
|
@ -120,6 +119,8 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
|
|||
print("start install apk3")
|
||||
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
|
||||
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path)))
|
||||
commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
|
||||
print(commandReturn)
|
||||
print("\nprint install complete")
|
||||
if quit:
|
||||
print(commandReturn)
|
||||
|
@ -857,9 +858,12 @@ class AddNewUengineDesktopLink():
|
|||
|
||||
# 添加快捷方式
|
||||
def SaveDesktopLink():
|
||||
try:
|
||||
if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
|
||||
if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"):
|
||||
return
|
||||
if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())):
|
||||
os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home()))
|
||||
global activityName
|
||||
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get())
|
||||
shutil.copy(programPath + "/defult.png", iconSavePath)
|
||||
|
@ -869,9 +873,14 @@ class AddNewUengineDesktopLink():
|
|||
"{}/{}.desktop".format(get_desktop_path(), packageName.get()))
|
||||
AddNewUengineDesktopLink.SaveHistory()
|
||||
messagebox.showinfo(title="提示", message="创建完毕!")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
|
||||
|
||||
# 删除快捷方式
|
||||
def DelDesktopLink():
|
||||
try:
|
||||
global packageName
|
||||
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
|
||||
messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
|
||||
|
@ -885,6 +894,9 @@ class AddNewUengineDesktopLink():
|
|||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
|
||||
# 保存历史记录
|
||||
def SaveHistory():
|
||||
|
@ -954,7 +966,7 @@ Tk 版本 :{}
|
|||
|
||||
程序官网 :{}
|
||||
|
||||
系统版本 :{}
|
||||
系统版本 : {}
|
||||
|
||||
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y"))
|
||||
tips = "\n".join(information["Tips"])
|
||||
|
|
|
@ -66,14 +66,14 @@ starValue.set("5分")
|
|||
name = ttk.Label(win, text="你的昵称:")
|
||||
nameThings = ttk.Entry(win, width=25)
|
||||
|
||||
contact = ttk.Label(win, text="联系方式:")
|
||||
contact = ttk.Label(win, text="联系方式(电子邮箱):")
|
||||
contactThings = ttk.Entry(win, width=25)
|
||||
|
||||
star = ttk.Label(win, text="评分:")
|
||||
starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分")
|
||||
|
||||
updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):")
|
||||
updateThings = tk.Text(win)
|
||||
updateThings = tk.Text(win, width=100)
|
||||
|
||||
otherUpload = ttk.Frame(win)
|
||||
# 所属内容
|
||||
|
@ -106,7 +106,7 @@ starMenu.grid(row=0, column=5)
|
|||
updateThingsTips.grid(row=1, column=0, columnspan=2)
|
||||
updateThings.grid(row=2, column=0, columnspan=6)
|
||||
|
||||
otherUpload.grid(row=3, column=0, columnspan=4)
|
||||
otherUpload.grid(row=3, column=0, columnspan=4, sticky=tk.W)
|
||||
updateButton.grid(row=3, column=5)
|
||||
|
||||
win.pack(expand="yes", fill="both")
|
||||
|
|
Binary file not shown.
|
@ -21,11 +21,12 @@
|
|||
"5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
|
||||
],
|
||||
"Update": [
|
||||
"V1.5.3(未完全完工):",
|
||||
"※1、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应,参考报错",
|
||||
"※2、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀‘uengine-dc’”前缀的问题",
|
||||
"3、“UEngine APK应用打包器”支持打包完后自动删除临时目录",
|
||||
"4、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错",
|
||||
"V1.5.3:",
|
||||
"※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题",
|
||||
"※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应,参考报错",
|
||||
"※3、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀‘uengine-dc’”前缀的问题",
|
||||
"4、“UEngine APK应用打包器”支持打包完后自动删除临时目录",
|
||||
"5、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错",
|
||||
"",
|
||||
"V1.5.2:",
|
||||
"※1、支持安装和构建带Root的UEngine的镜像",
|
||||
|
|
1
main.py
1
main.py
|
@ -37,6 +37,7 @@ def UninstallProgram(package: "apk 包名")->"卸载程序":
|
|||
try:
|
||||
global fineUninstallApkHistory
|
||||
Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package))
|
||||
print(Return)
|
||||
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)):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Package: com.gitee.uengine.runner.spark
|
||||
Source: com.gitee.uengine.runner.spark
|
||||
Version: 1.5.2
|
||||
Version: 1.5.3
|
||||
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, uengine, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell, python3-xlib
|
||||
|
|
|
@ -19,4 +19,4 @@ ln -s /opt/apps/com.gitee.uengine.runner.spark/files/root-uengine
|
|||
# 刷新图标缓存
|
||||
#gtk-update-icon-cache /usr/share/icons/bloom
|
||||
# 向服务器返回安装数加1(不显示内容且忽略错误)
|
||||
curl http://120.25.153.144/uengine-runner/Install.php?Version=1.5.2 -s > /dev/null | true
|
||||
curl http://120.25.153.144/uengine-runner/Install.php?Version=1.5.3 -s > /dev/null | true
|
|
@ -3,31 +3,33 @@
|
|||
"https://gitee.com/gfdgd-xi/uengine-runner",
|
||||
"https://github.com/gfdgd-xi/uengine-runner"
|
||||
],
|
||||
"Version": "1.5.2",
|
||||
"Version": "1.5.3",
|
||||
"System": "Linux(deepin/UOS)",
|
||||
"Tips": [
|
||||
"更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis",
|
||||
"",
|
||||
"安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮",
|
||||
"",
|
||||
"卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。",
|
||||
"",
|
||||
"保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可",
|
||||
"",
|
||||
"重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可",
|
||||
" 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了",
|
||||
"",
|
||||
"打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)",
|
||||
"",
|
||||
"提示:",
|
||||
"1、需要你有使用 root 权限的能力;",
|
||||
"2、需要安装 UEngine 才能使用;",
|
||||
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
|
||||
"4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
|
||||
"※1、近期升级的 UEngine 安装时会自动把要安装的 apk 删除,如果这个 apk 文件非常重要请拷贝一个备份版并安装这个备份版",
|
||||
"2、需要你有使用 root 权限的能力;",
|
||||
"3、需要安装 UEngine 才能使用;",
|
||||
"4、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
|
||||
"5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
|
||||
],
|
||||
"Update": [
|
||||
"V1.5.3:",
|
||||
"※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题",
|
||||
"※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应,参考报错",
|
||||
"※3、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀‘uengine-dc’”前缀的问题",
|
||||
"4、“UEngine APK应用打包器”支持打包完后自动删除临时目录",
|
||||
"5、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错",
|
||||
"",
|
||||
"V1.5.2:",
|
||||
"※1、支持安装和构建带 Root 的 UEngine 的镜像",
|
||||
"※1、支持安装和构建带Root的UEngine的镜像",
|
||||
"2、更新了反馈链接",
|
||||
"",
|
||||
"V1.5.1:",
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"Package": "com.gitee.uengine.runner.spark",
|
||||
"Update": true,
|
||||
"Version": "1.5.1",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"Package": "spark-uengine-runner",
|
||||
"Update": true,
|
||||
"Version": "1.5.1",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi
|
||||
# 版本:1.5.1
|
||||
# 更新时间:2021年10月06日
|
||||
# 版本:1.5.3
|
||||
# 更新时间:2021年12月12日(DDUC11了)
|
||||
# 感谢:anbox、deepin 和 统信
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
|
@ -43,12 +43,20 @@ def BuildDeb():
|
|||
messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK")
|
||||
return
|
||||
DisabledAndEnbled(True)
|
||||
threading.Thread(target=BuildApkDeb, args=(combobox1.get(),)).start()
|
||||
threading.Thread(target=GetBuildApkDebError, args=(combobox1.get(),)).start()
|
||||
|
||||
def RunCommandShow(command):
|
||||
TextboxAddText1("$> {}".format(command))
|
||||
TextboxAddText1(GetCommandReturn(command))
|
||||
|
||||
def GetBuildApkDebError(apkPath):
|
||||
try:
|
||||
BuildApkDeb(apkPath)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
DisabledAndEnbled(False)
|
||||
|
||||
def BuildApkDeb(apkPath):
|
||||
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
|
||||
RunCommandShow("echo '======================================New===================================='")
|
||||
|
@ -58,11 +66,12 @@ def BuildApkDeb(apkPath):
|
|||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath))
|
||||
RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'")
|
||||
apkPackageName = GetApkPackageName(apkPath)
|
||||
apkPackageName = GetApkPackageName(apkPath, False)
|
||||
apkPackageNameNew = GetApkPackageName(apkPath, True)
|
||||
apkPackageVersion = GetApkVersion(apkPath)
|
||||
apkChineseLabel = GetApkChineseLabel(apkPath)
|
||||
apkActivityName = GetApkActivityName(apkPath)
|
||||
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageName)
|
||||
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew)
|
||||
debControl = '''Package: {}
|
||||
Version: {}
|
||||
Architecture: all
|
||||
|
@ -70,82 +79,66 @@ Maintainer: {}
|
|||
Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1)
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Description: {}\n'''.format(apkPackageName, apkPackageVersion, apkChineseLabel, apkChineseLabel)
|
||||
Description: {}\n'''.format(apkPackageNameNew, apkPackageVersion, apkChineseLabel, apkChineseLabel)
|
||||
debPostinst = '''#!/bin/sh
|
||||
|
||||
APK_DIR="/usr/share/uengine/apk"
|
||||
APK_NAME="{}.apk"
|
||||
APK_NAME="{}"
|
||||
APK_PATH="$APK_DIR/$APK_NAME"
|
||||
DESKTOP_FILE="/usr/share/applications/{}.desktop"
|
||||
ICON_FILE="/usr/share/uengine/icons/{}.png"
|
||||
DESKTOP_FILE="{}"
|
||||
|
||||
|
||||
if [ -f $APK_PATH ]; then
|
||||
echo "Installing $APK_NAME"
|
||||
else
|
||||
echo "ERROR: $APK_NAME file not found."
|
||||
exit 1
|
||||
echo "ERROR: $APK_NAME does not exist."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
echo "ERROR: app install failed(session-manager is not running)."
|
||||
sess_dir="/usr/share/uengine/session_install"
|
||||
if [ ! -d $sess_dir ]; then
|
||||
mkdir $sess_dir
|
||||
chmod 777 $sess_dir
|
||||
fi
|
||||
apk_name=${{APK_PATH##*/}}
|
||||
fileName="$sess_dir/$apk_name"
|
||||
echo $DESKTOP_FILE > $fileName
|
||||
abistr=""
|
||||
if test -n "$abistr"; then
|
||||
abi=`echo $abistr |awk -F \= '{{print $2}}'`
|
||||
echo $abi >> $fileName
|
||||
fi
|
||||
chmod 766 $fileName
|
||||
fi
|
||||
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: apk install error..."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"
|
||||
|
||||
sudo rm -f "$APK_PATH"
|
||||
|
||||
exit 0'''.format(apkPackageName, apkPackageName, apkPackageName)
|
||||
exit 0'''.format(apkPackageNameNew + ".apk", "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
|
||||
debPrerm = '''#!/bin/sh
|
||||
|
||||
APP_NAME="{}"
|
||||
DESKTOP_FILE="{}"
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
exit 1
|
||||
echo "ERROR: app uninstall failed(session-manager is not running)."
|
||||
sess_dir="/usr/share/uengine/session_uninstall"
|
||||
if [ ! -d $sess_dir ]; then
|
||||
mkdir $sess_dir
|
||||
chmod 777 $sess_dir
|
||||
fi
|
||||
fileName="$sess_dir/$APP_NAME"
|
||||
echo $DESKTOP_FILE > $fileName
|
||||
chmod 766 $fileName
|
||||
fi
|
||||
|
||||
echo "Uninstalling $APP_NAME"
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: app uninstall error..."
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
exit 1
|
||||
fi
|
||||
/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"
|
||||
|
||||
cat /etc/passwd | awk -F: '$3>=1000' | cut -f 1 -d : | while read line
|
||||
do
|
||||
inifile="/home/$line/.config/uengineAppGeometry.ini"
|
||||
if [ -f $inifile ]; then
|
||||
sed -i "/$APP_NAME/d" $inifile
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0'''.format(apkPackageName)
|
||||
exit 0'''.format(apkPackageName, "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
|
||||
desktopFile = '''[Desktop Entry]
|
||||
Categories=Other;
|
||||
Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={}
|
||||
|
@ -162,20 +155,22 @@ Name={}
|
|||
write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst)
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm)
|
||||
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageName))
|
||||
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName), desktopFile)
|
||||
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, iconSavePath,
|
||||
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName))
|
||||
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageNameNew))
|
||||
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), desktopFile)
|
||||
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew),
|
||||
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew))
|
||||
RunCommandShow("echo '复制文件'")
|
||||
RunCommandShow("echo '写入 APK 软件图标'")
|
||||
SaveApkIcon(apkPath, iconSavePath)
|
||||
RunCommandShow("echo '复制 APK 文件'")
|
||||
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageName))
|
||||
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew))
|
||||
RunCommandShow("echo '正在设置文件权限……'")
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath))
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath))
|
||||
RunCommandShow("echo '打包 deb 到桌面……'")
|
||||
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageName, apkPackageVersion))
|
||||
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, apkPackageVersion))
|
||||
RunCommandShow("echo '正在删除临时目录……'")
|
||||
RunCommandShow("rm -rfv '{}'".format(tempPath))
|
||||
RunCommandShow("echo '完成!'")
|
||||
findApkHistory.append(apkPath)
|
||||
combobox1['value'] = findApkHistory
|
||||
|
@ -260,7 +255,7 @@ def GetApkActivityName(apkFilePath):
|
|||
line = line.replace("icon=", "")
|
||||
return line
|
||||
|
||||
def GetApkPackageName(apkFilePath):
|
||||
def GetApkPackageName(apkFilePath, setting):
|
||||
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
|
@ -271,7 +266,7 @@ def GetApkPackageName(apkFilePath):
|
|||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
# 此较为特殊,因为需要判断用户是否要添加前缀
|
||||
if qianZhui.get() == True:
|
||||
if setting:
|
||||
return "uengine-dc-{}".format(line).lower()
|
||||
return line.lower()
|
||||
|
||||
|
@ -294,7 +289,7 @@ def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath)
|
|||
[Desktop Entry]
|
||||
Categories=app;
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine launch.sh --action=android.intent.action.MAIN --package={} --component={}
|
||||
Exec=/usr/bin/uengine launch --action=android.intent.action.MAIN --package={} --component={}
|
||||
GenericName={}
|
||||
Icon={}
|
||||
MimeType=
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi<3025613752@qq.com>
|
||||
# 版本:1.5.1
|
||||
# 更新时间:2021年10月05日(国庆了)
|
||||
# 版本:1.5.3
|
||||
# 更新时间:2021年12月12日(DDUC11了)
|
||||
# 感谢:anbox、deepin 和 UOS
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
# 更新:gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>
|
||||
|
@ -37,6 +37,7 @@ def UninstallProgram(package: "apk 包名")->"卸载程序":
|
|||
try:
|
||||
global fineUninstallApkHistory
|
||||
Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package))
|
||||
print(Return)
|
||||
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)):
|
||||
|
@ -104,8 +105,6 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
|
|||
os.makedirs("{}/.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
|
||||
|
@ -120,6 +119,8 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
|
|||
print("start install apk3")
|
||||
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
|
||||
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path)))
|
||||
commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
|
||||
print(commandReturn)
|
||||
print("\nprint install complete")
|
||||
if quit:
|
||||
print(commandReturn)
|
||||
|
@ -857,9 +858,12 @@ class AddNewUengineDesktopLink():
|
|||
|
||||
# 添加快捷方式
|
||||
def SaveDesktopLink():
|
||||
try:
|
||||
if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
|
||||
if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"):
|
||||
return
|
||||
if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())):
|
||||
os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home()))
|
||||
global activityName
|
||||
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get())
|
||||
shutil.copy(programPath + "/defult.png", iconSavePath)
|
||||
|
@ -869,9 +873,14 @@ class AddNewUengineDesktopLink():
|
|||
"{}/{}.desktop".format(get_desktop_path(), packageName.get()))
|
||||
AddNewUengineDesktopLink.SaveHistory()
|
||||
messagebox.showinfo(title="提示", message="创建完毕!")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
|
||||
|
||||
# 删除快捷方式
|
||||
def DelDesktopLink():
|
||||
try:
|
||||
global packageName
|
||||
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
|
||||
messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
|
||||
|
@ -885,6 +894,9 @@ class AddNewUengineDesktopLink():
|
|||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
|
||||
# 保存历史记录
|
||||
def SaveHistory():
|
||||
|
@ -954,7 +966,7 @@ Tk 版本 :{}
|
|||
|
||||
程序官网 :{}
|
||||
|
||||
系统版本 :{}
|
||||
系统版本 : {}
|
||||
|
||||
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y"))
|
||||
tips = "\n".join(information["Tips"])
|
||||
|
|
|
@ -66,14 +66,14 @@ starValue.set("5分")
|
|||
name = ttk.Label(win, text="你的昵称:")
|
||||
nameThings = ttk.Entry(win, width=25)
|
||||
|
||||
contact = ttk.Label(win, text="联系方式:")
|
||||
contact = ttk.Label(win, text="联系方式(电子邮箱):")
|
||||
contactThings = ttk.Entry(win, width=25)
|
||||
|
||||
star = ttk.Label(win, text="评分:")
|
||||
starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分")
|
||||
|
||||
updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):")
|
||||
updateThings = tk.Text(win)
|
||||
updateThings = tk.Text(win, width=100)
|
||||
|
||||
otherUpload = ttk.Frame(win)
|
||||
# 所属内容
|
||||
|
@ -106,7 +106,7 @@ starMenu.grid(row=0, column=5)
|
|||
updateThingsTips.grid(row=1, column=0, columnspan=2)
|
||||
updateThings.grid(row=2, column=0, columnspan=6)
|
||||
|
||||
otherUpload.grid(row=3, column=0, columnspan=4)
|
||||
otherUpload.grid(row=3, column=0, columnspan=4, sticky=tk.W)
|
||||
updateButton.grid(row=3, column=5)
|
||||
|
||||
win.pack(expand="yes", fill="both")
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import requests
|
||||
import traceback
|
||||
|
||||
# 读取文本文档
|
||||
def read_txt(path):
|
||||
f = open(path,"r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
def GetPackageUpdateInformation():
|
||||
global setting
|
||||
global package
|
||||
for i in allJson['Program']:
|
||||
if i['Package'] == package:
|
||||
return i
|
||||
|
||||
try:
|
||||
setting = json.loads(read_txt("{}/setting.json".format(os.path.split(os.path.realpath(__file__))[0])))
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("配置文件无法访问!")
|
||||
package = setting['Package']
|
||||
nowVersion = setting['Version']
|
||||
try:
|
||||
jsons = requests.get(setting["Url"])
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("服务器出现错误!")
|
||||
sys.exit(1)
|
||||
allJson = json.loads(jsons.text)
|
||||
updateInformation = GetPackageUpdateInformation()
|
||||
name = updateInformation['Name']
|
||||
newVersion = updateInformation['Version']
|
||||
print("更新程序:{}".format(name))
|
||||
print("最新版本:{}".format(newVersion))
|
||||
print("目前版本:{}".format(nowVersion))
|
||||
if nowVersion == newVersion:
|
||||
print("目前是最新版本,无需更新!")
|
||||
quit()
|
||||
print("更新内容:")
|
||||
print(updateInformation['New Things'])
|
||||
choose = input("更新?[Y/N]")
|
||||
if choose.upper() == "N":
|
||||
quit()
|
||||
if os.path.exists("/tmp/update-console-{}".format(package)):
|
||||
shutil.rmtree("/tmp/update-console-{}".format(package))
|
||||
os.mkdir("/tmp/update-console-{}".format(package))
|
||||
if updateInformation["Linux App Url"][0] == None:
|
||||
print("没有可用包源")
|
||||
quit()
|
||||
os.system("wget '{}' -P '/tmp/update-console-{}'".format(updateInformation["Linux App Url"][0], package))
|
||||
os.system("sudo dpkg -i /tmp/update-console-{}/*".format(package))
|
||||
os.system("sudo apt install -f -y")
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"Package": "com.gitee.uengine.runner.spark",
|
||||
"Update": true,
|
||||
"Version": "1.5.1",
|
||||
"Version": "1.5.3",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Package": "spark-uengine-runner",
|
||||
"Update": true,
|
||||
"Version": "1.5.1",
|
||||
"Version": "1.5.3",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
|
||||
}
|
Binary file not shown.
|
@ -66,14 +66,14 @@ starValue.set("5分")
|
|||
name = ttk.Label(win, text="你的昵称:")
|
||||
nameThings = ttk.Entry(win, width=25)
|
||||
|
||||
contact = ttk.Label(win, text="联系方式:")
|
||||
contact = ttk.Label(win, text="联系方式(电子邮箱):")
|
||||
contactThings = ttk.Entry(win, width=25)
|
||||
|
||||
star = ttk.Label(win, text="评分:")
|
||||
starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分")
|
||||
|
||||
updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):")
|
||||
updateThings = tk.Text(win)
|
||||
updateThings = tk.Text(win, width=100)
|
||||
|
||||
otherUpload = ttk.Frame(win)
|
||||
# 所属内容
|
||||
|
@ -106,7 +106,7 @@ starMenu.grid(row=0, column=5)
|
|||
updateThingsTips.grid(row=1, column=0, columnspan=2)
|
||||
updateThings.grid(row=2, column=0, columnspan=6)
|
||||
|
||||
otherUpload.grid(row=3, column=0, columnspan=4)
|
||||
otherUpload.grid(row=3, column=0, columnspan=4, sticky=tk.W)
|
||||
updateButton.grid(row=3, column=5)
|
||||
|
||||
win.pack(expand="yes", fill="both")
|
||||
|
|
Loading…
Reference in New Issue