新增评分功能

This commit is contained in:
gfdgd xi 2022-02-07 22:35:15 +08:00
parent d081862a4a
commit bb813fc866
14 changed files with 94 additions and 36 deletions

View File

@ -13,7 +13,13 @@
+ **近期升级的 UEngine 安装时会自动把要安装的 apk 删除**,如果这个 apk 文件非常重要请**拷贝一个备份版并安装这个备份版** + **近期升级的 UEngine 安装时会自动把要安装的 apk 删除**,如果这个 apk 文件非常重要请**拷贝一个备份版并安装这个备份版**
### 更新内容 ### 更新内容
#### V1.5.32021-12-12DDUC11版未完全完工 #### V1.6.0(开学版,即将完成!!!)
##### 目前更新内容
**※1、更换了新的图标暂未全部更新完成**
**※2、支持程序的评分和查看分数详情的功能如果炸了我的服务器这个就作废了**
**※3、修复了在安装奇奇怪怪的安装包如格式、标识不正确的时的快捷方式图标为空以及快捷方式文本的变化**
#### V1.5.32021-12-12DDUC11版
##### 更新内容 ##### 更新内容
**※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题** **※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题**
**※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录**`~/.local/share/icons/hicolor/256x256/apps`**不存在时点击无反应参考报错1.5.3-1** **※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录**`~/.local/share/icons/hicolor/256x256/apps`**不存在时点击无反应参考报错1.5.3-1**

BIN
SourceHanSansCN-Normal.otf Normal file

Binary file not shown.

BIN
builer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

12
help/index.html Normal file
View File

@ -0,0 +1,12 @@
<head>
<title>UEngine 运行器 1.6.0 帮助</title>
</head>
<body>
<h1>UEngine 运行器 1.6.0 帮助</h1>
<hr/>
<h2>安装自定义 APK 应用</h2>
<h3>方法1</h3>
<h3>方法2</h3>
<hr/>
<h2>高级功能</h2>
</body>

BIN
icon.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 35 KiB

85
main.py
View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi<3025613752@qq.com> # 作者gfdgd xi<3025613752@qq.com>
# 版本1.5.3 # 版本1.6.1
# 更新时间2021年12月12日DDUC11了) # 更新时间2022年2月6日要开学了)
# 感谢anbox、deepin 和 UOS # 感谢anbox、deepin 和 UOS
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
# 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com> # 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>
@ -19,9 +19,16 @@ import shutil
import zipfile import zipfile
import traceback import traceback
import threading import threading
import easygui
import ttkthemes import ttkthemes
import webbrowser import webbrowser
import subprocess import subprocess
import matplotlib
import requests
import numpy
import matplotlib.figure
import matplotlib.pylab
import matplotlib.font_manager
import PIL.Image as Image import PIL.Image as Image
import PIL.ImageTk as ImageTk import PIL.ImageTk as ImageTk
import tkinter as tk import tkinter as tk
@ -53,16 +60,6 @@ def UninstallProgram(package: "apk 包名")->"卸载程序":
messagebox.showerror(title="错误", message=traceback.format_exc()) messagebox.showerror(title="错误", message=traceback.format_exc())
DisabledAndEnbled(False) DisabledAndEnbled(False)
# 卸载文本框的浏览按钮事件
#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(): def ButtonClick8():
if ComboInstallPath.get() is "": if ComboInstallPath.get() is "":
@ -324,6 +321,8 @@ def ReinstallUengineImage():
# 生成 uengine 启动文件到桌面 # 生成 uengine 启动文件到桌面
def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径")->"生成 uengine 启动文件到桌面": def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径")->"生成 uengine 启动文件到桌面":
if showName == "" or showName == None:
showName = "未知应用"
things = '''[Desktop Entry] things = '''[Desktop Entry]
Categories=app; Categories=app;
Encoding=UTF-8 Encoding=UTF-8
@ -358,11 +357,15 @@ def SaveApkIcon(apkFilePath, iconSavePath)->"保存 apk 文件的图标":
xmlsave = getsavexml() xmlsave = getsavexml()
print(xmlpath) print(xmlpath)
xmlsave.savexml(apkFilePath,xmlpath,iconSavePath) xmlsave.savexml(apkFilePath,xmlpath,iconSavePath)
return
else: else:
zip = zipfile.ZipFile(apkFilePath) zip = zipfile.ZipFile(apkFilePath)
iconData = zip.read(xmlpath) iconData = zip.read(xmlpath)
with open(iconSavePath, 'w+b') as saveIconFile: with open(iconSavePath, 'w+b') as saveIconFile:
saveIconFile.write(iconData) saveIconFile.write(iconData)
return
print("None Icon! Show defult icon")
shutil.copy(programPath + "/defult.png", iconSavePath)
except: except:
traceback.print_exc() traceback.print_exc()
print("Error, show defult icon") print("Error, show defult icon")
@ -634,8 +637,12 @@ class ApkInformation():
global path global path
global tab1 global tab1
path = ComboInstallPath.get() path = ComboInstallPath.get()
package = GetApkPackageName(path)
if package == None or package == "":
messagebox.showerror(title="错误", message="该应用安装包异常,无法查询相关数据!")
return
message = tk.Toplevel() message = tk.Toplevel()
message.iconphoto(False, tk.PhotoImage(file=iconPath))
tab = ttk.Notebook(message) tab = ttk.Notebook(message)
@ -673,6 +680,49 @@ class ApkInformation():
Activity{} Activity{}
版本{}'''.format(GetApkPackageName(path), GetApkChineseLabel(path), GetApkActivityName(path), GetApkVersion(path)) 版本{}'''.format(GetApkPackageName(path), GetApkChineseLabel(path), GetApkActivityName(path), GetApkVersion(path))
ttk.Label(tab1, text=info).pack() ttk.Label(tab1, text=info).pack()
ttk.Button(tab1, text="查看程序评分情况", command=ApkInformation.ShowMap).pack()
ttk.Button(tab1, text="上传程序评分情况", command=ApkInformation.UpdateMark).pack()
def UpdateMark():
#message = tk.Toplevel()
#message.iconphoto(False, tk.PhotoImage(file=iconPath))
choose = easygui.indexbox(title="选择评分", choices=["含有不良信息", "0分", "1分", "2分", "3分", "4分", "5分", "取消"], msg="""选择应用“{}”的使用评分。建议参考如下规范进行评分:
含有不良信息-1含有色情暴力欺凌赌博等违法违规信息如果有就不要选择其它选项了
0完全无法使用连安装都有问题
1完全无法使用但是能正常安装
2可以打开但只能使用一点点功能
3勉强能使用运行也不大流畅
4大部分功能正常运行流畅可能会有点小卡
5完全正常且非常流畅没有任何功能和性能问题就和直接在手机上用一样
""".format(GetApkChineseLabel(path)))
print(choose)
if choose == None or choose == 7:
return
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="无法连接服务器!无法进行评分!")
def ShowMap():
package = GetApkPackageName(path)
if package == None or package == "":
messagebox.showerror(title="错误", message="该应用安装包异常,无法查询相关数据!")
return
try:
data = json.loads(requests.get("http://120.25.153.144/uengine-runner/app/check/" + package +"/data.json").text)
print(data)
except:
messagebox.showinfo(title="错误", message="此程序暂时没有评分,欢迎您贡献第一个评分!")
return
index = numpy.arange(len(data))
print(index)
fonts = matplotlib.font_manager.FontProperties(fname='/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc') # 用于支持中文显示需要依赖fonts-noto-cjk
matplotlib.pylab.barh(index, data)
matplotlib.pylab.yticks(index, ["不良信息", "0分", "1分", "2分", "3分", "4分", "5分"], fontproperties=fonts)
matplotlib.pylab.xlabel("用户评分数", fontproperties=fonts)
matplotlib.pylab.ylabel("等级", fontproperties=fonts)
matplotlib.pylab.title("" + GetApkChineseLabel(path) + "”的用户评分(数据只供参考)", fontproperties=fonts)
matplotlib.pylab.show()
class AdbChangeUengineDisplaySize(): class AdbChangeUengineDisplaySize():
@ -681,6 +731,7 @@ class AdbChangeUengineDisplaySize():
global displayY global displayY
global displaySize global displaySize
message = tk.Toplevel() message = tk.Toplevel()
message.iconphoto(False, tk.PhotoImage(file=iconPath))
messageFrame = ttk.Frame(message) messageFrame = ttk.Frame(message)
displaySize = tk.StringVar() displaySize = tk.StringVar()
@ -819,6 +870,7 @@ class AddNewUengineDesktopLink():
global activityName global activityName
global packageName global packageName
message = tk.Toplevel() message = tk.Toplevel()
message.iconphoto(False, tk.PhotoImage(file=iconPath))
tipsLabel = ttk.Label(message, text=AddNewUengineDesktopLink.addTips) tipsLabel = ttk.Label(message, text=AddNewUengineDesktopLink.addTips)
packageName = ttk.Combobox(message, width=30) packageName = ttk.Combobox(message, width=30)
@ -974,7 +1026,7 @@ updateThingsString = "\n".join(information["Update"])
title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version) title = "{} {}".format(langFile[lang]["Main"]["MainWindow"]["Title"], version)
updateTime = information["Time"] updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/runner.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = programPath + "/UengineAndroidProgramList.desktop" desktop = programPath + "/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop" desktopName = "UengineAndroidProgramList.desktop"
contribute = "\n".join(information["Contribute"]) contribute = "\n".join(information["Contribute"])
@ -1134,13 +1186,10 @@ win.geometry(""+"+{:.0f}+{:.0f}".format(x, y))
FrmInstall = ttk.Frame(window) FrmInstall = ttk.Frame(window)
#FrmUninstall = ttk.Frame(window) #FrmUninstall = ttk.Frame(window)
LabApkPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabApkPath"]) LabApkPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabApkPath"])
#LabUninstallPath = ttk.Label(window, text=langFile[lang]["Main"]["MainWindow"]["LabUninstallPath"])
ComboInstallPath = ttk.Combobox(window, width=50) ComboInstallPath = ttk.Combobox(window, width=50)
#ComboUninstallPath = ttk.Combobox(window, width=50)
BtnFindApk = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnFindApk"], command=FindApk) BtnFindApk = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnFindApk"], command=FindApk)
BtnInstall = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnInstall"], command=Button3Install) BtnInstall = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnInstall"], command=Button3Install)
BtnShowUengineApp = ttk.Button(window, text=langFile[lang]["Main"]["MainWindow"]["BtnShowUengineApp"], command=Button5Click) BtnShowUengineApp = ttk.Button(window, text=langFile[lang]["Main"]["MainWindow"]["BtnShowUengineApp"], command=Button5Click)
#BtnUninstallApkBrowser = ttk.Button(FrmUninstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstallApkBrowser"], command=BtnFindUninstallApkClk)
BtnUninstall = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstall"], command=ButtonClick8) BtnUninstall = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnUninstall"], command=ButtonClick8)
Btngeticon = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["Btngeticon"], command=SaveIconToOtherPath) Btngeticon = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["Btngeticon"], command=SaveIconToOtherPath)
BtnSaveApk = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnSaveApk"], command=SaveInstallUengineApp) BtnSaveApk = ttk.Button(FrmInstall, text=langFile[lang]["Main"]["MainWindow"]["BtnSaveApk"], command=SaveInstallUengineApp)
@ -1188,7 +1237,6 @@ 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"][1], command=AdbStopServer)
adbServer.add_command(label=langFile[lang]["Main"]["MainWindow"]["Menu"][1]["Menu"][1]["Menu"][2], command=AdbKillAdbProgress) 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"][0], command=UengineSettingShow)
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"][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"][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"][8], command=UengineCheckCpu)
@ -1249,7 +1297,6 @@ uengineUseAdb.configure(activebackground="dodgerblue")
uengineData.configure(activebackground="dodgerblue") uengineData.configure(activebackground="dodgerblue")
# 设置控件 # 设置控件
#ComboUninstallPath['value'] = fineUninstallApkHistory
ComboInstallPath['value'] = findApkHistory ComboInstallPath['value'] = findApkHistory
try: try:
if sys.argv[1] == "-i": if sys.argv[1] == "-i":

BIN
menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
old-icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
runner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
simhei.ttf Executable file

Binary file not shown.

View File

@ -3,7 +3,7 @@
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.5.3 # 版本1.5.3
# 更新时间2021年12月12日DDUC11了) # 更新时间2022年02月07日要开学了)
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -285,6 +285,8 @@ def GetApkVersion(apkFilePath):
return line return line
def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath): def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath):
if showName == "" or showName == None:
showName = "未知应用"
things = ''' things = '''
[Desktop Entry] [Desktop Entry]
Categories=app; Categories=app;
@ -308,17 +310,6 @@ def GetApkChineseLabel(apkFilePath):
line = line.replace("'", "") line = line.replace("'", "")
return line return line
#def GetApkIconInApk(apkFilePath):
# info = GetApkInformation(apkFilePath)
# for line in info.split('\n'):
# if "application:" in line:
# line = line[line.index("icon='"): -1]
# line = line.replace("icon='", "")
# if "'" in line:
# line = line[0: line.index("'")]
# return line
# return line
#合并两个函数到一起 #合并两个函数到一起
def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标": def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标":
try: try:
@ -335,6 +326,9 @@ def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标":
iconData = zip.read(xmlpath) iconData = zip.read(xmlpath)
with open(iconSavePath, 'w+b') as saveIconFile: with open(iconSavePath, 'w+b') as saveIconFile:
saveIconFile.write(iconData) saveIconFile.write(iconData)
return
print("Show defult icon")
shutil.copy(programPath + "/defult.png", iconSavePath)
except: except:
traceback.print_exc() traceback.print_exc()
print("Error, show defult icon") print("Error, show defult icon")
@ -383,7 +377,7 @@ if not lang in langFile.keys():
information = json.loads(readtxt(programPath + "/information.json")) information = json.loads(readtxt(programPath + "/information.json"))
version = information["Version"] version = information["Version"]
title = "{} {}".format(langFile[lang]["Uengine Apk Builder"]["Title"], version) title = "{} {}".format(langFile[lang]["Uengine Apk Builder"]["Title"], version)
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/builer.png".format(os.path.split(os.path.realpath(__file__))[0])
########################### ###########################
# 加载配置 # 加载配置

View File

@ -49,7 +49,7 @@ updateThingsString = "\n".join(information["Update"])
title = "UEngine 运行器 {}".format(version) title = "UEngine 运行器 {}".format(version)
updateTime = information["Time"] updateTime = information["Time"]
updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) updateThings = "{} 更新内容:\n{}\n更新时间{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/runner.png".format(os.path.split(os.path.realpath(__file__))[0])
desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop" desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop"
desktopName = "UengineAndroidProgramList.desktop" desktopName = "UengineAndroidProgramList.desktop"
contribute = "\n".join(information["Contribute"]) contribute = "\n".join(information["Contribute"])

View File

@ -49,7 +49,7 @@ def OpenGithubIssues():
########################### ###########################
# 程序信息 # 程序信息
########################### ###########################
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) iconPath = "{}/runner.png".format(os.path.split(os.path.realpath(__file__))[0])
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
information = json.loads(readtxt(programPath + "/information.json")) information = json.loads(readtxt(programPath + "/information.json"))
version = information["Version"] version = information["Version"]

View File

@ -4,7 +4,6 @@
# 更新时间2021年08月30日 # 更新时间2021年08月30日
######################################### #########################################
import os import os
import shutil
import sys import sys
import traceback import traceback
import ttkthemes import ttkthemes