-
Notifications
You must be signed in to change notification settings - Fork 9
/
uengine-apk-builder-more
executable file
·563 lines (518 loc) · 23 KB
/
uengine-apk-builder-more
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi
# 版本:1.8.1
# 更新时间:2022年08月01日
# 感谢:anbox、deepin 和 统信
# 基于 Python3 的 PyQt5 构建
###########################################################################################
#################
# 引入所需的库
#################
import os
import sys
import json
import shutil
import random
import zipfile
import traceback
import subprocess
import updatekiller
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
from getxmlimg import getsavexml
print("""南安军
梅花南北路,风雨湿征衣。出岭同谁出?归乡如此归!
山河千古在,城郭一时非。饿死真吾志,梦中行采薇。""")
print("")
print("""译文:由南往北走过大庾岭口,一路风雨打湿衣裳。想到去南岭时有哪些同伴,回到家乡却身为俘囚。
祖国的河山千年万世永存,城郭只是暂时落入敌手。绝食而死是我真正的意愿,梦中也学伯夷叔齐,吃野菜充饥等死。""")
print("================================")
def FindApk():
path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 APK", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"], "APK 可执行文件(*.apk);;所有文件(*.*)")
print(path)
if path[0] != "" and path[1] != "":
try:
combobox1.setEditText(path[0])
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path[0])})) # 写入配置文件
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
def FindIcon():
path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 APK", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"], "png 文件(*.png);;svg 文件(*.svg);;所有文件(*.*)")
if path[0] != "" and path[1] != "":
try:
iconText.setText(path[0])
#write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path[0])})) # 写入配置文件
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
class QT:
run = None
def BuildDeb():
if combobox1.currentText() == "":
QtWidgets.QMessageBox.critical(None, "提示", "信息没有填写完整,无法继续打包 APK")
return
for i in textList:
if i.text() == "":
QtWidgets.QMessageBox.critical(None, "提示", "信息没有填写完整,无法继续打包 APK")
return
# 包名小写
packageText.setText(packageText.text().lower())
if not os.path.exists(combobox1.currentText()) or not os.path.exists(iconPath):
QtWidgets.QMessageBox.critical(None, "提示", "信息填写错误,无法继续打包 APK")
return
DisabledAndEnbled(True)
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)
# 已废弃
# TextboxAddText1(GetCommandReturn(command))
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)
apkPackageNameNew = packageText.text()
# 高级打包器直接忽略此勾选
#if check.isChecked():
# apkPackageNameNew = GetApkPackageName(apkPath, True).lower().replace("_", "-")
#else:
# apkPackageNameNew = GetApkPackageName(apkPath, False).lower().replace("_", "-")
apkPackageVersion = GetApkVersion(apkPath)
if apkPackageVersion[0].upper() == "V":
package = list(apkPackageVersion)
package.pop(0)
apkPackageVersion = "".join(package)
apkChineseLabel = GetApkChineseLabel(apkPath)
apkActivityName = GetApkActivityName(apkPath)
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")
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew)
debControl = f'''Package: {apkPackageNameNew}
Version: {versionText.text()}
Architecture: all
Maintainer: {makerText.text()}
Depends: deepin-elf-verify, uengine (>= 1.0.1)
Section: utils
Priority: optional
Description: {comText.text()}\n'''
debPostinst = '''#!/bin/sh
APK_DIR="/usr/share/uengine/apk"
APK_NAME="{}"
APK_PATH="$APK_DIR/$APK_NAME"
DESKTOP_FILE="{}"
if [ -f $APK_PATH ]; then
echo "Installing $APK_NAME"
else
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 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
/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"
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 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"
/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"
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={}
Icon=/usr/share/uengine/icons/{}.png
Terminal=false
Type=Application
GenericName={}
Name={}
'''
#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, nameText.text(), "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew),
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), typeChoose.currentText())
self.RunCommandShow("echo '复制文件'")
self.RunCommandShow("echo '写入 APK 软件图标'")
#SaveApkIcon(apkPath, iconSavePath)
self.RunCommandShow(f"cp -rv '{iconText.text()}' '{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 到桌面……'")
self.RunCommandShow("dpkg-deb -Z xz -b '{}' '{}/{}_{}_all.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, versionText.text()))
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("")
def DisabledAndEnbled(choose):
combobox1.setDisabled(choose)
check.setDisabled(choose)
button2.setDisabled(choose)
button3.setDisabled(choose)
sizes.setDisabled(choose)
iconBrowser.setDisabled(choose)
typeChoose.setDisabled(choose)
for i in textList:
i.setDisabled(choose)
# 重启本应用程序
def ReStartProgram():
python = sys.executable
os.execl(python, python, * sys.argv)
def GetCommandReturn(command):
return subprocess.getoutput(command)
# 获取用户主目录
def get_home():
return os.path.expanduser('~')
# 获取当前语言
def get_now_lang()->"获取当前语言":
return os.getenv('LANG')
# 获取用户桌面目录
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):
return GetCommandReturn("'{}/aapt/run-aapt.sh' dump badging '{}'".format(programPath, apkFilePath))
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
return f"{GetApkPackageName(apkFilePath, False)}.Main"
def GetApkPackageName(apkFilePath, setting):
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
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(" ", "")
# 此较为特殊,因为需要判断用户是否要添加前缀
if setting:
return "uengine-dc-{}".format(line)
return line
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, type):
if showName == "" or showName == None:
showName = "未知应用"
things = f'''
[Desktop Entry]
Categories=app;
Encoding=UTF-8
Exec=/usr/bin/uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName}
GenericName={showName}
Icon={iconPath}
MimeType=
Name={showName}
Categories={type};
StartupWMClass={showName}
Terminal=false
Type=Application
'''
write_txt(savePath, things)
# 获取软件的中文名称
def GetApkChineseLabel(apkFilePath)->"获取软件的中文名称":
info = GetApkInformation(apkFilePath)
name = None
for line in info.split('\n'):
if "application-label-zh:" in line:
line = line.replace("application-label-zh:", "")
line = line.replace("'", "")
return line
if "application-label:" in line:
line = line.replace("application-label:", "")
line = line.replace("'", "")
name = line
return name
#合并两个函数到一起
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)
return
print("Show defult icon")
shutil.copy(programPath + "/defult.svg", iconSavePath)
except:
traceback.print_exc()
print("Error, show defult icon")
shutil.copy(programPath + "/defult.svg", iconSavePath)
def TextboxAddText1(message):
global textbox1
if message.replace(" ", "").replace("\n", "") == "":
return
textbox1.append(message.replace("\n", ""))
# 获取用户桌面目录
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('~')
###########################
# 程序信息
###########################
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
lang = get_now_lang()
langFile = json.loads(readtxt(programPath + "/Language.json"))
if not lang in langFile.keys():
lang = "en_US.UTF-8"
information = json.loads(readtxt(programPath + "/information.json"))
version = information["Version"]
#title = "{} {}".format(langFile[lang]["Uengine Apk Builder"]["Title"], version)
title = f"UEngine 运行器应用打包器(高级) {version}"
iconPath = "{}/builer.svg".format(os.path.split(os.path.realpath(__file__))[0])
###########################
# 加载配置
###########################
if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹
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": "~"})) # 创建配置文件
###########################
# 设置变量
###########################
findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json")).values())
###########################
# 窗口创建
###########################
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()
packageText = QtWidgets.QLineEdit()
versionText = QtWidgets.QLineEdit()
comText = QtWidgets.QLineEdit()
makerText = QtWidgets.QLineEdit()
typeChoose = QtWidgets.QComboBox()
nameText = QtWidgets.QLineEdit()
iconText = QtWidgets.QLineEdit()
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"])
sizes = QtWidgets.QCheckBox(langFile[lang]["Uengine Apk Builder"]["size"])
iconBrowser = QtWidgets.QPushButton("浏览")
iconBrowser.clicked.connect(FindIcon)
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)
typeChoose.addItems(["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility"])
typeChoose.setCurrentText("Network")
widgetLayout.addWidget(label1, 0, 0, 1, 1)
widgetLayout.addWidget(combobox1, 0, 1, 1, 1)
widgetLayout.addWidget(button2, 0, 2, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("包名:"), 1, 0)
widgetLayout.addWidget(packageText, 1, 1, 1, 1)
widgetLayout.addWidget(QtWidgets.QLabel("版本号:"), 2, 0)
widgetLayout.addWidget(versionText, 2, 1)
widgetLayout.addWidget(QtWidgets.QLabel("说明:"), 3, 0)
widgetLayout.addWidget(comText, 3, 1)
widgetLayout.addWidget(QtWidgets.QLabel("维护者:"), 4, 0)
widgetLayout.addWidget(makerText, 4, 1)
widgetLayout.addWidget(QtWidgets.QLabel("程序分类:"), 5, 0)
widgetLayout.addWidget(typeChoose, 5, 1)
widgetLayout.addWidget(QtWidgets.QLabel("程序名称:"), 6, 0)
widgetLayout.addWidget(nameText, 6, 1)
widgetLayout.addWidget(QtWidgets.QLabel("程序图标:"), 7, 0)
widgetLayout.addWidget(iconText, 7, 1)
widgetLayout.addWidget(iconBrowser, 7, 2)
widgetLayout.addLayout(frame2, 8, 1, 1, 1)
widgetLayout.addWidget(textbox1, 9, 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)
#
check.setChecked(True)
#frame2.addWidget(check)
frame2.addWidget(sizes)
frame2.addWidget(button3)
widget.setLayout(widgetLayout)
window.setWindowTitle(title)
window.setCentralWidget(widget)
window.setWindowIcon(QtGui.QIcon(iconPath))
window.resize(int(window.frameSize().width() * 1.3), int(window.frameSize().height() * 1.1))
try:
combobox1.setCurrentText(sys.argv[1])
except:
print("无参数")
window.show()
textList = [
packageText,
versionText,
comText,
makerText,
nameText,
iconText
]
sys.exit(app.exec_())