uengine-runner/uengine-apk-builder

505 lines
21 KiB
Plaintext
Raw Normal View History

2021-08-19 08:49:50 +08:00
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
# 作者gfdgd xi
2022-08-03 22:59:13 +08:00
# 版本1.8.1
# 更新时间2022年08月01日
2021-08-19 08:49:50 +08:00
# 感谢anbox、deepin 和 统信
2022-08-03 22:59:13 +08:00
# 基于 Python3 的 PyQt5 构建
2021-08-19 08:49:50 +08:00
###########################################################################################
#################
# 引入所需的库
#################
import os
import sys
import json
import shutil
import random
import zipfile
import traceback
import subprocess
import updatekiller
2022-07-23 21:51:18 +08:00
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
2021-08-19 08:49:50 +08:00
from getxmlimg import getsavexml
2023-01-18 15:29:44 +08:00
print("""渔家傲·秋思
塞下秋来风景异,衡阳雁去无留意。四面边声连角起。千嶂里,长烟落日孤城闭。
浊酒一杯家万里,燕然未勒归无计。羌管悠悠霜满地。人不寐,将军白发征夫泪。""")
print("")
2023-01-18 15:50:04 +08:00
print("""译文:眼看秋天到了,西北边塞的风光和江南风光自然大不相同。头顶的大雁又飞回南方衡阳去了,一点也没有停留意思。此情此景,不禁又勾起戍边人思乡的情绪。黄昏时分,军中号角催吹,周围的边声也随之而起。层峦叠嶂里,暮霭沉沉,山衔落日,孤零零的城门紧闭。
2023-01-18 15:29:44 +08:00
饮一杯浊酒,我不由得想起万里之外的亲人。可是,眼下外患未平,功不成名不就,又怎能半途而废。远方传来羌笛的悠悠之声,天气寒冷,军营里早已结满寒霜。夜深了,我还不能安睡,为操持军计,我的须发都变白了。戍边人思念亲人,也久久难以成眠,多少次梦里流下眼泪。""")
print("================================")
2021-08-19 08:49:50 +08:00
def FindApk():
2022-07-23 21:51:18 +08:00
path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 APK", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"], "APK 可执行文件(*.apk);;所有文件(*.*)")
2021-08-19 08:49:50 +08:00
if path != "" and path != "()":
try:
2022-07-23 21:51:18 +08:00
combobox1.setEditText(path[0])
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path[0])})) # 写入配置文件
2021-08-19 08:49:50 +08:00
except:
2022-07-23 21:51:18 +08:00
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
class QT:
run = None
2021-08-19 08:49:50 +08:00
def BuildDeb():
2022-07-23 21:51:18 +08:00
if combobox1.currentText() == "":
QtWidgets.QMessageBox.critical(None, "提示", "信息没有填写完整,无法继续打包 APK")
2021-08-19 08:49:50 +08:00
return
2022-07-23 21:51:18 +08:00
if not os.path.exists(combobox1.currentText()):
QtWidgets.QMessageBox.critical(None, "提示", "信息填写错误,无法继续打包 APK")
2021-08-19 08:49:50 +08:00
return
DisabledAndEnbled(True)
2022-07-23 21:51:18 +08:00
QT.run = BuildApkDeb(combobox1.currentText())
QT.run.signal.connect(TextboxAddText1)
QT.run.labelChange.connect(ChangeItems)
QT.run.tips.connect(TipsMessagebox)
QT.run.start()
class BuildApkDeb(QtCore.QThread):
signal = QtCore.pyqtSignal(str)
labelChange = QtCore.pyqtSignal(str)
tips = QtCore.pyqtSignal(str)
def __init__(self, apkPath) -> None:
self.apkPath = apkPath
super().__init__()
def RunCommandShow(self, command):
if command.replace(" ", "").replace("\n", "") == "":
return
self.signal.emit("$> {}".format(command))
res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# 实时读取程序返回
while res.poll() is None:
try:
texts = res.stdout.readline().decode("utf8")
except:
texts = ""
print(texts, end="")
self.signal.emit(texts)
2022-07-08 04:02:21 +08:00
# 已废弃
# TextboxAddText1(GetCommandReturn(command))
2021-08-19 08:49:50 +08:00
2022-07-23 21:51:18 +08:00
def run(self):
try:
apkPath = self.apkPath
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
self.RunCommandShow("echo '======================================New===================================='")
self.RunCommandShow("echo '创建目录'")
self.RunCommandShow("mkdir -pv '{}/DEBIAN'".format(tempPath))
self.RunCommandShow("mkdir -pv '{}/usr/share/applications'".format(tempPath))
self.RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath))
self.RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath))
self.RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'")
apkPackageName = GetApkPackageName(apkPath, False)
if check.isChecked():
2022-08-03 22:59:13 +08:00
apkPackageNameNew = GetApkPackageName(apkPath, True).lower().replace("_", "-")
2022-07-23 21:51:18 +08:00
else:
2022-08-03 22:59:13 +08:00
apkPackageNameNew = GetApkPackageName(apkPath, False).lower().replace("_", "-")
2022-07-23 21:51:18 +08:00
apkPackageVersion = GetApkVersion(apkPath)
if apkPackageVersion[0].upper() == "V":
package = list(apkPackageVersion)
package.pop(0)
apkPackageVersion = "".join(package)
apkChineseLabel = GetApkChineseLabel(apkPath)
apkActivityName = GetApkActivityName(apkPath)
2022-08-03 22:59:13 +08:00
if sizes.isChecked() and os.path.exists(f"/usr/share/uengine/appetc/{apkPackageName}.txt"):
os.makedirs(f"{tempPath}/usr/share/uengine/appetc")
shutil.copy(f"/usr/share/uengine/appetc/{apkPackageName}.txt", f"{tempPath}/usr/share/uengine/appetc/{apkPackageName}.txt")
2022-07-23 21:51:18 +08:00
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew)
debControl = '''Package: {}
2021-08-19 08:49:50 +08:00
Version: {}
Architecture: all
Maintainer: {}
2023-01-18 12:24:16 +08:00
Depends: deepin-elf-verify, uengine (>= 1.0.1)
2021-08-19 08:49:50 +08:00
Section: utils
Priority: optional
2023-01-18 18:29:02 +08:00
Description: {}, Build By UEngine Runner Packager\n'''.format(apkPackageNameNew, apkPackageVersion, apkChineseLabel, apkChineseLabel)
2022-07-23 21:51:18 +08:00
debPostinst = '''#!/bin/sh
2021-08-19 08:49:50 +08:00
APK_DIR="/usr/share/uengine/apk"
2021-12-12 11:28:22 +08:00
APK_NAME="{}"
2021-08-19 08:49:50 +08:00
APK_PATH="$APK_DIR/$APK_NAME"
2021-12-12 11:28:22 +08:00
DESKTOP_FILE="{}"
2021-08-19 08:49:50 +08:00
if [ -f $APK_PATH ]; then
echo "Installing $APK_NAME"
else
2021-12-12 11:28:22 +08:00
echo "ERROR: $APK_NAME does not exist."
exit 0
2021-08-19 08:49:50 +08:00
fi
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
if test -z "$session_manager"; then
2021-12-12 11:28:22 +08:00
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
2021-08-19 08:49:50 +08:00
fi
2021-12-12 11:28:22 +08:00
/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"
2021-08-19 08:49:50 +08:00
2021-12-12 11:28:22 +08:00
exit 0'''.format(apkPackageNameNew + ".apk", "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
2022-07-23 21:51:18 +08:00
debPrerm = '''#!/bin/sh
2021-08-19 08:49:50 +08:00
APP_NAME="{}"
2021-12-12 11:28:22 +08:00
DESKTOP_FILE="{}"
2021-08-19 08:49:50 +08:00
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
if test -z "$session_manager"; then
2021-12-12 11:28:22 +08:00
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
2021-08-19 08:49:50 +08:00
fi
echo "Uninstalling $APP_NAME"
2021-12-12 11:28:22 +08:00
/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"
2021-08-19 08:49:50 +08:00
2021-12-12 11:28:22 +08:00
exit 0'''.format(apkPackageName, "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
2022-07-23 21:51:18 +08:00
desktopFile = '''[Desktop Entry]
2021-08-19 08:49:50 +08:00
Categories=Other;
Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={}
2021-08-19 08:49:50 +08:00
Icon=/usr/share/uengine/icons/{}.png
Terminal=false
Type=Application
GenericName={}
Name={}
'''
2022-07-23 21:51:18 +08:00
#self.RunCommandShow("echo '{}' > '{}/DEBIAN/control'".format(debControl, tempPath))
self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/control'".format(tempPath))
write_txt("{}/DEBIAN/control".format(tempPath), debControl)
self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/postinst'".format(tempPath))
write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst)
self.RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath))
write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm)
self.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),
2021-12-12 11:28:22 +08:00
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew))
2022-07-23 21:51:18 +08:00
self.RunCommandShow("echo '复制文件'")
self.RunCommandShow("echo '写入 APK 软件图标'")
SaveApkIcon(apkPath, iconSavePath)
self.RunCommandShow("echo '复制 APK 文件'")
self.RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew))
self.RunCommandShow("echo '正在设置文件权限……'")
self.RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath))
self.RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath))
self.RunCommandShow("echo '打包 deb 到桌面……'")
2023-07-10 09:40:45 +08:00
self.RunCommandShow("dpkg-deb -Z xz -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, apkPackageVersion))
2022-07-23 21:51:18 +08:00
self.RunCommandShow("echo '正在删除临时目录……'")
self.RunCommandShow("rm -rfv '{}'".format(tempPath))
self.RunCommandShow("echo '完成!'")
findApkHistory.append(apkPath)
self.labelChange.emit("")
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
DisabledAndEnbled(False)
self.tips.emit("打包完成")
except:
DisabledAndEnbled(False)
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
def TipsMessagebox(tips):
QtWidgets.QMessageBox.information(widget, "提示", tips)
def ChangeItems(self):
combobox1.clear()
combobox1.addItems(findApkHistory)
#combobox1.setEditText("")
2021-08-19 08:49:50 +08:00
def DisabledAndEnbled(choose):
2022-07-23 21:51:18 +08:00
combobox1.setDisabled(choose)
check.setDisabled(choose)
button2.setDisabled(choose)
button3.setDisabled(choose)
2023-01-18 12:24:16 +08:00
sizes.setDisabled(choose)
2021-08-19 08:49:50 +08:00
# 重启本应用程序
def ReStartProgram():
python = sys.executable
os.execl(python, python, * sys.argv)
2022-07-23 21:51:18 +08:00
def GetCommandReturn(command):
return subprocess.getoutput(command)
2021-08-19 08:49:50 +08:00
# 获取用户主目录
def get_home():
return os.path.expanduser('~')
2021-09-20 17:10:05 +08:00
# 获取当前语言
def get_now_lang()->"获取当前语言":
return os.getenv('LANG')
2021-08-19 08:49:50 +08:00
# 获取用户桌面目录
def get_desktop_path():
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0没有返回 -1
if desktop_index != -1: # 如果有对应项
break # 结束循环
if desktop_index == -1: # 如果是提前结束,值一定≠-1如果是没有提前结束值一定-1
return -1
else:
get = line[17:-2] # 截取桌面目录路径
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
if get != -1: # 如果有
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
return get # 返回目录
# 数组转字典
def ListToDictionary(list):
dictionary = {}
for i in range(len(list)):
dictionary[i] = list[i]
return dictionary
# 读取文本文档
def readtxt(path):
f = open(path, "r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
# 写入文本文档
def write_txt(path, things):
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
def GetApkInformation(apkFilePath):
2024-01-29 18:55:14 +08:00
return GetCommandReturn("'{}/aapt/run-aapt.sh' dump badging '{}'".format(programPath, apkFilePath))
2021-08-19 08:49:50 +08:00
def GetApkActivityName(apkFilePath):
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "launchable-activity" in line:
line = line[0: line.index("label='")]
line = line.replace("launchable-activity: ", "")
line = line.replace("'", "")
line = line.replace(" ", "")
line = line.replace("name=", "")
line = line.replace("label=", "")
line = line.replace("icon=", "")
return line
2022-12-18 18:48:30 +08:00
return f"{GetApkPackageName(apkFilePath, False)}.Main"
2021-08-19 08:49:50 +08:00
2021-12-12 11:28:22 +08:00
def GetApkPackageName(apkFilePath, setting):
2021-09-11 15:51:23 +08:00
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
2021-08-19 08:49:50 +08:00
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "package:" in line:
line = line[0: line.index("versionCode='")]
line = line.replace("package:", "")
line = line.replace("name=", "")
line = line.replace("'", "")
line = line.replace(" ", "")
2021-09-11 15:51:23 +08:00
# 此较为特殊,因为需要判断用户是否要添加前缀
2021-12-12 11:28:22 +08:00
if setting:
2022-05-15 20:13:18 +08:00
return "uengine-dc-{}".format(line)
return line
2021-08-19 08:49:50 +08:00
def GetApkVersion(apkFilePath):
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "package:" in line:
if "compileSdkVersion='" in line:
line = line.replace(line[line.index("compileSdkVersion='"): -1], "")
if "platform" in line:
line = line.replace(line[line.index("platform"): -1], "")
line = line.replace(line[0: line.index("versionName='")], "")
line = line.replace("versionName='", "")
line = line.replace("'", "")
line = line.replace(" ", "")
return line
def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath):
2022-02-07 22:35:15 +08:00
if showName == "" or showName == None:
showName = "未知应用"
2021-08-19 08:49:50 +08:00
things = '''
[Desktop Entry]
Categories=app;
Encoding=UTF-8
2021-12-12 11:28:22 +08:00
Exec=/usr/bin/uengine launch --action=android.intent.action.MAIN --package={} --component={}
2021-08-19 08:49:50 +08:00
GenericName={}
Icon={}
MimeType=
Name={}
StartupWMClass={}
Terminal=false
Type=Application
'''.format(packageName, activityName, showName, iconPath, showName, showName)
write_txt(savePath, things)
# 获取软件的中文名称
def GetApkChineseLabel(apkFilePath)->"获取软件的中文名称":
2021-08-19 08:49:50 +08:00
info = GetApkInformation(apkFilePath)
name = None
2021-08-19 08:49:50 +08:00
for line in info.split('\n'):
if "application-label-zh:" in line:
line = line.replace("application-label-zh:", "")
line = line.replace("'", "")
return line
2021-08-19 08:49:50 +08:00
if "application-label:" in line:
line = line.replace("application-label:", "")
line = line.replace("'", "")
name = line
return name
2021-08-19 08:49:50 +08:00
#合并两个函数到一起
def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标":
try:
info = GetApkInformation(apkFilePath)
for line in info.split('\n'):
if "application:" in line:
xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'","")
if xmlpath.endswith('.xml'):
xmlsave = getsavexml()
print(xmlpath)
xmlsave.savexml(apkFilePath,xmlpath,iconSavePath)
else:
zip = zipfile.ZipFile(apkFilePath)
iconData = zip.read(xmlpath)
with open(iconSavePath, 'w+b') as saveIconFile:
saveIconFile.write(iconData)
2022-02-07 22:35:15 +08:00
return
print("Show defult icon")
shutil.copy(programPath + "/defult.svg", iconSavePath)
2021-08-19 08:49:50 +08:00
except:
traceback.print_exc()
print("Error, show defult icon")
shutil.copy(programPath + "/defult.svg", iconSavePath)
2021-08-19 08:49:50 +08:00
def TextboxAddText1(message):
global textbox1
2022-08-03 22:59:13 +08:00
if message.replace(" ", "").replace("\n", "") == "":
return
textbox1.append(message.replace("\n", ""))
2021-08-19 08:49:50 +08:00
# 获取用户桌面目录
def get_desktop_path():
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0没有返回 -1
if desktop_index != -1: # 如果有对应项
break # 结束循环
if desktop_index == -1: # 如果是提前结束,值一定≠-1如果是没有提前结束值一定-1
return -1
else:
get = line[17:-2] # 截取桌面目录路径
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
if get != -1: # 如果有
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
return get # 返回目录
# 获取用户主目录
def get_home():
return os.path.expanduser('~')
###########################
# 程序信息
###########################
2021-08-19 14:08:05 +08:00
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
2021-09-20 17:10:05 +08:00
lang = get_now_lang()
langFile = json.loads(readtxt(programPath + "/Language.json"))
if not lang in langFile.keys():
lang = "en_US.UTF-8"
2021-08-19 14:08:05 +08:00
information = json.loads(readtxt(programPath + "/information.json"))
version = information["Version"]
2023-01-18 18:46:03 +08:00
title = "{} {}".format(langFile[lang]["Uengine Apk Builder"]["Title"], version)
#title = f"UEngine 运行器应用打包器(高级) {version}"
2022-07-23 21:51:18 +08:00
iconPath = "{}/builer.svg".format(os.path.split(os.path.realpath(__file__))[0])
2021-08-19 08:49:50 +08:00
###########################
# 加载配置
###########################
2021-08-19 14:08:05 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
2021-09-11 15:51:23 +08:00
os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹
2021-08-19 14:08:05 +08:00
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", json.dumps({})) # 创建配置文件
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuild.json"): # 如果没有配置文件
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": "~"})) # 创建配置文件
2021-08-19 08:49:50 +08:00
###########################
# 设置变量
###########################
2021-08-19 14:08:05 +08:00
findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json")).values())
2021-08-19 08:49:50 +08:00
###########################
# 窗口创建
###########################
2022-07-23 21:51:18 +08:00
app = QtWidgets.QApplication(sys.argv)
# 权重
size = QtWidgets.QSizePolicy()
size.setHorizontalPolicy(0)
widgetSize = QtWidgets.QSizePolicy()
widgetSize.setVerticalPolicy(0)
#
window = QtWidgets.QMainWindow()
widget = QtWidgets.QWidget()
widgetLayout = QtWidgets.QGridLayout()
combobox1 = QtWidgets.QComboBox()
label1 = QtWidgets.QLabel(langFile[lang]["Uengine Apk Builder"]["label1"])
button2 = QtWidgets.QPushButton(langFile[lang]["Uengine Apk Builder"]["button2"])
button3 = QtWidgets.QPushButton(langFile[lang]["Uengine Apk Builder"]["button3"])
textbox1 = QtWidgets.QTextBrowser()
frame2 = QtWidgets.QHBoxLayout()
check = QtWidgets.QCheckBox(langFile[lang]["Uengine Apk Builder"]["check"])
2022-08-03 22:59:13 +08:00
sizes = QtWidgets.QCheckBox(langFile[lang]["Uengine Apk Builder"]["size"])
2022-07-23 21:51:18 +08:00
label1.setSizePolicy(size)
button2.setSizePolicy(size)
check.setSizePolicy(size)
button3.setSizePolicy(size)
combobox1.setEditable(True)
combobox1.addItems(findApkHistory)
combobox1.setEditText("")
button2.clicked.connect(FindApk)
button3.clicked.connect(BuildDeb)
widgetLayout.addWidget(label1, 0, 0, 1, 1)
widgetLayout.addWidget(combobox1, 0, 1, 1, 1)
widgetLayout.addWidget(button2, 0, 2, 1, 1)
2022-08-03 22:59:13 +08:00
widgetLayout.addLayout(frame2, 1, 1, 1, 1)
2022-07-23 21:51:18 +08:00
widgetLayout.addWidget(textbox1, 2, 0, 1, 3)
# 菜单栏
menu = window.menuBar()
programmenu = menu.addMenu(langFile[lang]["Uengine Apk Builder"]["Menu"][0]["Name"])
exitProgram = QtWidgets.QAction(langFile[lang]["Uengine Apk Builder"]["Menu"][0]["Menu"][0])
exitProgram.triggered.connect(window.close)
programmenu.addAction(exitProgram)
#
2022-11-28 21:43:27 +08:00
check.setChecked(True)
2022-07-23 21:51:18 +08:00
frame2.addWidget(check)
2022-08-03 22:59:13 +08:00
frame2.addWidget(sizes)
2022-07-23 21:51:18 +08:00
frame2.addWidget(button3)
widget.setLayout(widgetLayout)
window.setWindowTitle(title)
window.setCentralWidget(widget)
window.setWindowIcon(QtGui.QIcon(iconPath))
2023-01-15 10:08:29 +08:00
window.resize(int(window.frameSize().width() * 1.3), int(window.frameSize().height() * 1.1))
2022-11-28 21:43:27 +08:00
try:
combobox1.setCurrentText(sys.argv[1])
except:
print("无参数")
2022-07-23 21:51:18 +08:00
window.show()
sys.exit(app.exec_())