-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmainwindow.py
executable file
·2231 lines (2053 loc) · 112 KB
/
mainwindow.py
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
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi<[email protected]>
# 版本:2.0.0
# 更新时间:2022年07月25日
# 感谢:anbox、deepin 和 UOS
# 基于 Python3 的 PyQt5 构建
# 更新:gfdgd xi<[email protected]>、actionchen<[email protected]>
###########################################################################################
#################
# 引入所需的库
#################
import os
import api
import sys
import time
import json
import numpy
import base64
import socket
import shutil
import datetime
import zipfile
import platform
import requests
import traceback
import threading
import webbrowser
import subprocess
import updatekiller
map = True
import matplotlib
import matplotlib.figure
import matplotlib.pylab
import matplotlib.font_manager
import urllib.parse as parse
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
from getxmlimg import getsavexml
try:
import PyQt5.QtWebEngineWidgets as QtWebEngineWidgets
bad = False
except:
bad = True
from Model import *
def PythonLower():
app = QtWidgets.QApplication(sys.argv)
QtWidgets.QMessageBox.critical(None, "错误", "Python 至少需要 3.6 及以上版本,目前版本:" + platform.python_version() + "")
sys.exit(1)
# Python 版本检测,因为 f-string 格式化要至少 Python 3.6 及以上的版本,所以需要检测
# 判断主版本号
if sys.version_info[0] < 3:
PythonLower()
if sys.version_info[1] < 6:
PythonLower()
print("""观沧海 曹操
东临碣石,以观沧海。水何澹澹,山岛竦峙。
树木丛生,百草丰茂。秋风萧瑟,洪波涌起。
日月之行,若出其中;星汉灿烂,若出其里。
幸甚至哉,歌以咏志。""")
print("")
print("""译文:东行登上碣石山,来观赏那苍茫的海。海水多么宽阔浩荡,山岛高高地挺立在海边。
树木和百草丛生,十分繁茂。秋风吹动树木发出悲凉的声音,海中涌着巨大的海浪。
太阳和月亮的运行,好像是从这浩瀚的海洋中发出的。银河星光灿烂,好像是从这浩瀚的海洋中产生出来的。
我很幸运,就用这首诗歌来表达自己内心的志向。""")
print("================================")
class UninstallProgram(QtCore.QThread):
info = QtCore.pyqtSignal(str)
error = QtCore.pyqtSignal(str)
combo = QtCore.pyqtSignal(int)
def __init__(self, package) -> None:
self.package = package
super().__init__()
def run(self):
package = self.package
try:
global fineUninstallApkHistory
Return = os.system("uengine uninstall --pkg='{}'".format(package))
print(Return)
if Return != 0:
self.error.emit("疑似卸载失败,请检查 UEngine 是否正常安装、运行以及 APK 文件或包名是否正确、完整")
DisabledAndEnbled(False)
return
if os.path.exists("{}/{}.desktop".format(desktopFilePath, package)):
os.remove("{}/{}.desktop".format(desktopFilePath, package))
if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)):
os.remove("{}/{}.desktop".format(get_desktop_path(), package))
findApkHistory.append(ComboInstallPath.currentText())
self.combo.emit(0)
write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
self.info.emit("操作执行完毕!")
DisabledAndEnbled(False)
except:
traceback.print_exc()
self.error.emit(traceback.format_exc())
DisabledAndEnbled(False)
# 卸载程序
#def UninstallProgram(package: "apk 包名")->"卸载程序":
# pass
# 卸载按钮事件
def ButtonClick8():
if ComboInstallPath.currentText() is "":
QtWidgets.QMessageBox.information(widget, "提示", langFile[lang]["Main"]["MainWindow"]["Error"]["UninstallError"])
return
DisabledAndEnbled(True)
if os.path.exists(ComboInstallPath.currentText()):
path = GetApkPackageName(ComboInstallPath.currentText())
else:
path = ComboInstallPath.currentText()
print(path)
QT.installRun = UninstallProgram(path)
QT.installRun.error.connect(ErrorBox)
QT.installRun.info.connect(InformationBox)
QT.installRun.combo.connect(UpdateCombobox)
QT.installRun.start()
#threading.Thread(target=UninstallProgram, args=[path]).start()
# 浏览窗口
temppath=""
def FindApk()->"浏览窗口":
path = QtWidgets.QFileDialog.getOpenFileName(widget, "选择 Apk", json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApk.json"))["path"], "APK 文件(*.apk);;所有文件(*.*)")[0]
global temppath
temppath = path
print("apk path is find:" + path)
if path != "" and path != "()":
try:
ComboInstallPath.setEditText(path)
write_txt(get_home() + "/.config/uengine-runner/FindApk.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
except:
pass
class QT:
installRun = None
# 安装按钮事件
def Button3Install():
if ComboInstallPath.currentText() is "" or not os.path.exists(ComboInstallPath.currentText()):
QtWidgets.QMessageBox.information(widget, "提示", langFile[lang]["Main"]["MainWindow"]["Error"]["InstallError"])
return
DisabledAndEnbled(True)
#threading.Thread(target=InstallApk, args=(ComboInstallPath.get(),)).start()
QT.installRun = InstallApk(ComboInstallPath.currentText())
QT.installRun.infor.connect(InformationBox)
QT.installRun.error.connect(ErrorBox)
QT.installRun.combo.connect(UpdateCombobox)
QT.installRun.make.connect(InstallBuildDesktop)
QT.installRun.start()
# 安装应用
class InstallApk(QtCore.QThread):
infor = QtCore.pyqtSignal(str)
error = QtCore.pyqtSignal(str)
combo = QtCore.pyqtSignal(int)
make = QtCore.pyqtSignal(str)
def __init__(self, path, quit = False) -> None:
self.path = path
self.quit = quit
super().__init__()
def run(self):
path = self.path
quit = self.quit
# 将会强制改为拷贝安装,安装拷贝后的APK
try:
if not os.path.exists("/tmp/uengine-runner"):
os.makedirs("/tmp/uengine-runner")
if not os.path.exists(desktopFilePath):
print("Mkdir")
os.makedirs(desktopFilePath)
# 读取设置
setting = json.loads(readtxt(get_home() + "/.config/uengine-runner/setting.json"))
# 安装应用
print("start install apk")
global findApkHistory
print("start install apk12")
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path))
tempstr1 = iconSavePath
print("start install apk1")
iconSaveDir = os.path.dirname(iconSavePath)
if not os.path.exists(iconSaveDir):
os.makedirs(iconSaveDir,exist_ok=True)
SaveApkIcon(path, iconSavePath)
try:
shutil.copy(path, "/tmp/uengine-runner/bak.apk")
except:
QtWidgets.QMessageBox.critical(widget, "错误", "无法备份安装包,无法继续安装!")
DisabledAndEnbled(False)
return
print(f"uengine install --apk='/tmp/uengine-runner/bak.apk'")
commandReturn = os.system(f"uengine install --apk='/tmp/uengine-runner/bak.apk'")
# 因为安装的是备份包,所以不需要再拷贝回去了(应该也没了)
#try:
# if setting["SaveApk"]:
# shutil.copy("/tmp/uengine-runner/bak.apk", path)
#except:
# self.error.emit(langFile[lang]["Main"]["MainWindow"]["Error"]["BackApkError"])
if commandReturn != 0:
self.error.emit("疑似 APK 安装失败,请检查 UEngine 是否正常安装、运行以及 APK 文件是否正确、完整")
DisabledAndEnbled(False)
return
if settingConf["AutoScreenConfig"]:
# 计算最合适的大小
# 竖屏
screen = QtGui.QGuiApplication.primaryScreen()
mm = screen.availableGeometry()
verticalHeighe = int(mm.height() * 0.9) # 竖屏高
verticalWidth = int(verticalHeighe / 16 * 9) # 竖屏宽
horizontaltWidth = int(mm.width() * 0.8) # 横屏宽
horizontaltHeighe = int(horizontaltWidth / 16 * 9) # 横屏高
#verticalHeighe =
write_txt(f"/tmp/{GetApkPackageName(path)}.txt", f"""verticalWidth {verticalWidth} //竖屏宽
verticalHeighe {verticalHeighe} //竖屏高
horizontaltWidth {horizontaltWidth} //横屏宽,备选为1280
horizontaltHeighe {horizontaltHeighe} //横屏高 ,备选为720
verticalScreen 1 //设置默认横屏还是竖屏,1为竖屏,0为横屏
allowFullScreen 1 //设置是否允许全屏,1为允许,0为不允许
allowScreenSwitching 1 //设置是否允许横竖屏切换,1为允许,0为不允许
defaultFullScreen 0 //设置是否默认显示最大化,1为默认最大化,0为不是
logicalDensityDpi 160
physicalDpi 72
appWidth {verticalWidth}
appHeight {verticalHeighe}
logicalWidth {verticalWidth}
logicalHeight {verticalHeighe}
""")
if os.system(f"pkexec '{programPath}/uengine-window-size-setting.py' -a {GetApkPackageName(path)}"):
self.error.emit("屏幕配置设置失败")
DisabledAndEnbled(False)
return
if settingConf["ChooseProgramType"]:
self.make.emit(iconSavePath)
else:
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
"{}/{}.desktop".format(get_desktop_path(), GetApkPackageName(path)))
print("start install apk3")
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
"{}/{}.desktop".format(desktopFilePath, GetApkPackageName(path)))
print("\nprint install complete")
if quit:
return
findApkHistory.append(ComboInstallPath.currentText())
self.combo.emit(0)
write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
self.infor.emit("操作完成!")
except:
traceback.print_exc()
self.error.emit(traceback.format_exc())
DisabledAndEnbled(False)
def InstallBuildDesktop(iconSavePath):
choose = QtWidgets.QInputDialog.getItem(widget, "提示", "请选择分类,如果点击取消,将会设置为默认的分类", ["Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility"])[0]
path = ComboInstallPath.currentText()
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
"{}/{}.desktop".format(get_desktop_path(), GetApkPackageName(path)), choose)
print("start install apk3")
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
"{}/{}.desktop".format(desktopFilePath, GetApkPackageName(path)), choose)
print("\nprint install complete")
def UpdateCombobox(tmp):
ComboInstallPath.clear()
ComboInstallPath.addItems(findApkHistory)
ComboInstallPath.setEditText(findApkHistory[-1])
def ErrorBox(error):
QtWidgets.QMessageBox.critical(widget, "错误", error)
def InformationBox(info):
QtWidgets.QMessageBox.information(widget, "提示", info)
# 禁用或启动所有控件
def DisabledAndEnbled(choose: "启动或者禁用")->"禁用或启动所有控件":
ComboInstallPath.setDisabled(choose)
#ComboUninstallPath.configure(state=a)
BtnFindApk.setDisabled(choose)
BtnInstall.setDisabled(choose)
BtnAppStore.setDisabled(choose)
BtnShowUengineApp.setDisabled(choose)
#BtnUninstallApkBrowser.configure(state=a)
BtnUninstall.setDisabled(choose)
Btngeticon.setDisabled(choose)
BtnSaveApk.setDisabled(choose)
BtnApkInformation.setDisabled(choose)
LabApkPath.setDisabled(choose)
# 需引入 subprocess
# 运行系统命令并获取返回值
def GetCommandReturn(cmd: "命令")->"运行系统命令并获取返回值":
# cmd 是要获取输出的命令
return subprocess.getoutput(cmd)
def GetSystemVersion():
systemInformation = readtxt("/etc/os-release")
for systemInformation in systemInformation.split('\n'):
if "PRETTY_NAME=" in systemInformation:
return systemInformation.replace("PRETTY_NAME=", "").replace('"', '')
# 打开所有窗口事件
def Button5Click():
threading.Thread(target=OpenUengineProgramList).start()
# 打开“uengine 所有程序列表”
def OpenUengineProgramList()->"打开“uengine 所有程序列表”":
os.system("uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity")
# 打开程序官网
def OpenProgramURL()->"打开程序官网":
webbrowser.open_new_tab(programUrl)
# 重启本应用程序
def ReStartProgram()->"重启本应用程序":
python = sys.executable
os.execl(python, python, * sys.argv)
# 清理历史记录
def CleanProgramHistory()->"清理历史记录":
try:
if QtWidgets.QMessageBox.warning(widget, "警告", "删除后将无法恢复,你确定吗?\n删除后软件将会自动重启。", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Ok:
shutil.rmtree(get_home() + "/.config/uengine-runner")
ReStartProgram()
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
# 获取用户主目录
def get_home()->"获取用户主目录":
return os.path.expanduser('~')
# 获取当前语言
def get_now_lang()->"获取当前语言":
return os.getenv('LANG')
# 发送“启动 uengine 所有程序”的 .desktop 文件到桌面
def SendUengineAndroidListForDesktop()->"发送“启动 uengine 所有程序”的 .desktop 文件到桌面":
global desktop
global desktopName
DisabledAndEnbled(True)
try:
if os.path.exists("{}/{}".format(get_desktop_path(), desktopName)):
if QtWidgets.QMessageBox.question(widget, "提示", "桌面已经存在快捷方式,你确定要覆盖吗?") == QtWidgets.QMessageBox.No:
DisabledAndEnbled(False)
return
shutil.copy(desktop, get_desktop_path())
QtWidgets.QMessageBox.critical(widget, "提示", "发送成功!")
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
DisabledAndEnbled(False)
# 获取用户桌面目录
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 # 返回目录
# 发送“启动 uengine 所有程序”的 .desktop 文件到启动器
def SendUengineAndroidListForLauncher()->"发送“启动 uengine 所有程序”的 .desktop 文件到启动器":
DisabledAndEnbled(True)
try:
if os.path.exists("{}/.local/share/applications/{}".format(get_home(), desktopName)):
if QtWidgets.QMessageBox.question(widget, "提示", "启动器已经存在快捷方式,你确定要覆盖吗?") == QtWidgets.QMessageBox.No:
DisabledAndEnbled(False)
return
if not os.path.exists("{}/.local/share/applications/".format(get_home())):
os.makedirs("{}/.local/share/applications/".format(get_home()))
shutil.copy(desktop, "{}/.local/share/applications/{}".format(get_home(), desktopName))
os.system("chmod 755 {}/.local/share/applications/{}".format(get_home(), desktopName))
QtWidgets.QMessageBox.critical(widget, "提示", "发送成功!")
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
DisabledAndEnbled(False)
# 数组转字典
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: "内容")->"写入文本文档":
TxtDir = os.path.dirname(path)
print(TxtDir)
if not os.path.exists(TxtDir):
os.makedirs(TxtDir,exist_ok=True)
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
file.write(things) # 写入文本
file.close() # 关闭文本对象
# 获取 aapt 的所有信息
def GetApkInformation(apkFilePath: "apk 所在路径")->"获取 aapt 的所有信息":
return GetCommandReturn("'{}/aapt/run-aapt.sh' dump badging '{}'".format(programPath, apkFilePath))
# 获取 apk Activity
def GetApkActivityName(apkFilePath: "apk 所在路径")->"获取 apk Activity":
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)}.Main"
# 获取 apk 包名
def GetApkPackageName(apkFilePath: "apk 所在路径")->"获取 apk 包名":
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(" ", "")
return line
'''
Bail修改:
将以下5个函数的deepin-terminal的"-C"参数改为"-e",
解决了BuildRootUengineImage()函数未输入密码自动回车的bug
'''
def InstallRootUengineImage():
if not os.path.exists:
os.mkdir("/tmp/uengine-runner")
write_txt("/tmp/uengine-runner/install.sh", "sudo dpkg -i /tmp/uengine-runner/u*.deb\nsudo apt install -f")
#threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e \"wget -P '/tmp/uengine-runner' 'https://hub.fastgit.xyz/gfdgd-xi/uengine-runner/releases/download/U1.2.15/uengine-android-image_1.2.15_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'\""]).start()
threading.Thread(target=OpenTerminal, args=[f"wget -P '/tmp/uengine-runner' 'https://hub.fastgit.xyz/gfdgd-xi/uengine-runner/releases/download/U1.2.15/uengine-android-image_1.2.15_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'"]).start()
def UengineUbuntuInstall():
threading.Thread(target=OpenTerminal, args=[f"bash '{programPath + '/uengine-installer'}'"]).start()
def UengineUbuntuInstallRoot():
# 加 SuperSU 参数
threading.Thread(target=OpenTerminal, args=[f"bash '{programPath + '/uengine-installer'}' SuperSU"]).start()
def UbuntuInstallUengine():
threading.Thread(target=OpenTerminal, args=[f"bash '{programPath + '/uengine-installer'}'"]).start()
def BuildRootUengineImage():
threading.Thread(target=OpenTerminal, args=[f"bash '{programPath}/root-uengine.sh'"]).start()
def ReinstallUengineImage():
threading.Thread(target=OpenTerminal, args=[f"pkexec apt reinstall uengine-android-image -y"]).start()
# 生成 uengine 启动文件到桌面
def BuildUengineDesktop(packageName: "软件包名", activityName: "activity", showName: "显示名称", iconPath: "程序图标所在目录", savePath:".desktop 文件保存路径", choose="")->"生成 uengine 启动文件到桌面":
if showName == "" or showName == None:
showName = "未知应用"
if choose != "":
things = f'''[Desktop Entry]
Encoding=UTF-8
Exec=uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName}
GenericName={showName}
Icon={iconPath}
MimeType=
Name={showName}
StartupWMClass={showName}
Categories={choose};
Terminal=false
Type=Application
'''
else:
things = f'''[Desktop Entry]
Categories=app;
Encoding=UTF-8
Exec=uengine launch --action=android.intent.action.MAIN --package={packageName} --component={activityName}
GenericName={showName}
Icon={iconPath}
MimeType=
Name={showName}
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
# 保存apk图标
def SaveApkIcon(apkFilePath, iconSavePath)->"保存 apk 文件的图标":
try:
if os.path.exists(iconSavePath):
os.remove(iconSavePath)
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)
return
else:
zip = zipfile.ZipFile(apkFilePath)
iconData = zip.read(xmlpath)
with open(iconSavePath, 'w+b') as saveIconFile:
saveIconFile.write(iconData)
return
print("None Icon! 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 saveicon():
global temppath
global tempstr1
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(temppath))
print(iconSavePath+"iconpaths")
SaveApkIcon(temppath, iconSavePath)
def KeyboardToMouse():
threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-keyboard".format(programPath)]).start()
# 用户自行保存
def SaveIconToOtherPath():
apkPath = ComboInstallPath.currentText()
if apkPath == "":
QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["ChooseApkError"])
return
path = QtWidgets.QFileDialog.getSaveFileName(widget, "保存图标", "icon.png", "PNG 图片(*.png);;所有文件(*.*)", json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApkIcon.json"))["path"])[0]
if not path == "":
try:
SaveApkIcon(apkPath, path)
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["SaveApkIconError"])
return
write_txt(get_home() + "/.config/uengine-runner/SaveApkIcon.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
findApkHistory.append(ComboInstallPath.currentText())
UpdateCombobox(0)
write_txt(get_home() + "/.config/uengine-runner/FindApkHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
QtWidgets.QMessageBox.information(widget, "提示", "保存成功!")
# 清空 uengine 数据
def BackUengineClean()->"清空 uengine 数据":
print("Choose")
if QtWidgets.QMessageBox.warning(widget, "警告", "清空后数据将会完全丢失,确定要继续吗?", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Ok:
DisabledAndEnbled(True)
try:
if os.path.exists(desktopFilePath):
shutil.rmtree(desktopFilePath)
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
OpenTerminal(f"pkexec rm -rfv /data/uengine")
return
print("Choose False")
# 启用 uengine 网络桥接
def UengineBridgeStart()->"启用 uengine 网络桥接":
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh start")
DisabledAndEnbled(False)
# 关闭 uengine 网络桥接
def UengineBridgeStop()->"关闭 uengine 网络桥接":
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh stop")
DisabledAndEnbled(False)
# 重启 uengine 网络桥接
def UengineBridgeRestart()->"重启 uengine 网络桥接":
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh restart")
DisabledAndEnbled(False)
# 加载 uengine 网络桥接
def UengineBridgeReload()->"加载 uengine 网络桥接":
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh reload")
DisabledAndEnbled(False)
# 强制加载 uengine 网络桥接
def UengineBridgeForceReload()->"强制加载 uengine 网络桥接":
DisabledAndEnbled(True)
os.system("pkexec uengine-bridge.sh force-reload")
DisabledAndEnbled(False)
# 启用 uengine 服务
def StartUengine()->"启用 uengine 服务":
DisabledAndEnbled(True)
os.system("systemctl enable uengine-container uengine-session && systemctl start uengine-container uengine-session")
DisabledAndEnbled(False)
# 关闭 uengine 服务
def StopUengine()->"关闭 uengine 服务":
DisabledAndEnbled(True)
os.system("systemctl disable uengine-container uengine-session")
DisabledAndEnbled(False)
# 重启 uengine 服务
def UengineRestart()->"重启 uengine 服务":
DisabledAndEnbled(True)
os.system("systemctl restart uengine*")
DisabledAndEnbled(False)
def ScrcpyConnectUengine():
if os.path.exists("/snap/bin/scrcpy"):
threading.Thread(target=os.system, args=["/snap/bin/scrcpy -s '192.168.250.2:5555'"]).start()
return
if QtWidgets.QMessageBox.question(widget, "提示", "你没有安装Scrcpy(指使用Snap安装),\n如果你使用了其他方法安装了Scrcpy,可以输入命令“scrcpy -s '192.168.250.2:5555'”,\n是否现在要使用Snap安装Scrcpy?") == QtWidgets.QMessageBox.Yes:
if not os.path.exists("/tmp/uengine-runner"):
os.makedirs("/tmp/uengine-runner")
write_txt("/tmp/uengine-runner/InstallScrcpy.sh", '''#!/bin/bash
sudo apt install snapd -y
sudo snap refresh
sudo snap install scrcpy''')
threading.Thread(target=OpenTerminal, args=[f"chmod 777 /tmp/uengine-runner/InstallScrcpy.sh -Rv && pkexec /tmp/uengine-runner/InstallScrcpy.sh"]).start()
return
# 获取用户桌面目录
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 # 返回目录
# 提取已安装程序的apk
def SaveInstallUengineApp():
while True:
result = QtWidgets.QInputDialog.getText(widget, "输入 APK 包名", "请输入要获取的apk包名以便进行下一步操作")
if result[1] == False:
return
result = result[0]
if os.path.exists("/data/uengine/data/data/app/{}-1".format(result)):
break
QtWidgets.QMessageBox.critical(widget, "错误", langFile[lang]["Main"]["MainWindow"]["Error"]["PathError"])
path = QtWidgets.QFileDialog.getSaveFileName(widget, "保存apk", "~", "APK 文件(*.apk);;所有文件(*.*)", json.loads(readtxt(get_home() + "/.config/uengine-runner/SaveApk.json"))["path"])[0]
if path == "" or path == ():
return
try:
shutil.copy("/data/uengine/data/data/app/{}-1/base.apk".format(result), path)
write_txt(get_home() + "/.config/uengine-runner/SaveApk.json", json.dumps({"path": os.path.dirname(path)}))
QtWidgets.QMessageBox.information(widget, "提示", "提取完成!")
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
def UengineCheckCpu():
english = GetCommandReturn("uengine check-features")
QtWidgets.QMessageBox.information(widget, "提示", english)
# 获取用户主目录
def get_home()->"获取用户主目录":
return os.path.expanduser('~')
# 删除所有的 uengine 应用快捷方式
def CleanAllUengineDesktopLink():
if QtWidgets.QMessageBox.question(widget, "提示", "你是否要删除所有的 UEngine 应用快捷方式?") == QtWidgets.QMessageBox.No:
try:
shutil.rmtree("{}/.local/share/applications/uengine".format(get_home()))
os.makedirs("{}/.local/share/applications/uengine".format(get_home()))
QtWidgets.QMessageBox.information(widget, "提示", "删除完毕!")
except:
traceback.print_exc()
QtWidgets.QMessageBox.critical(widget, "错误", traceback.format_exc())
# 打开 uengine 应用打包器
def OpenUengineDebBuilder():
threading.Thread(target=os.system, args=[f"'{programPath}/uengine-apk-builder' '{ComboInstallPath.currentText()}'"]).start()
# 打开 uengine 根目录
def OpenUengineRootData():
threading.Thread(target=os.system, args=["xdg-open /data/uengine/data/data"]).start()
# 打开 uengine 用户数据目录
def OpenUengineUserData():
threading.Thread(target=os.system, args=["xdg-open ~/安卓应用文件"]).start()
# 终端显示 adb 命令行
def AdbShellShowInTer():
os.system("adb connect 192.168.250.2:5555")
threading.Thread(target=OpenTerminal, args=[f"adb -s 192.168.250.2:5555 shell"]).start()
# 终端显示 adb top
def AdbCPUAndRAWShowInTer():
os.system("adb connect 192.168.250.2:5555")
threading.Thread(target=OpenTerminal, args=[f"adb -s 192.168.250.2:5555 shell top"]).start()
def UengineSettingShow():
threading.Thread(target=os.system, args=["/usr/bin/uengine launch --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings"]).start()
# 杀死 adb 进程
def AdbKillAdbProgress():
os.system("killall adb")
QtWidgets.QMessageBox.information(widget, "提示", "完成!")
# 关闭 adb 服务
def AdbStopServer():
os.system("adb kill-server")
QtWidgets.QMessageBox.information(widget, "提示", "完成!")
# 开启 adb 服务
def AdbStartServer():
os.system("adb start-server")
QtWidgets.QMessageBox.information(widget, "提示", "完成!")
def ReinstallUengine():
threading.Thread(target=OpenTerminal, args=[f"pkexec apt reinstall uengine uengine-android-image uengine-modules-dkms -y && notify-send -i uengine \"安装完毕!\""]).start()
def DelUengineCheck():
if not os.path.exists("/usr/share/uengine/uengine-check-runnable.sh"):
QtWidgets.QMessageBox.information(widget, "提示", "本功能已经被删除,无法重复删除!")
return
if QtWidgets.QMessageBox.warning(widget, "警告", "删除后将无法使用本软件恢复\n如果需要恢复本功能,请重新安装 UEngine!", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Ok) == QtWidgets.QMessageBox.Ok:
threading.Thread(target=OpenTerminal, args=[f"pkexec rm -v /usr/share/uengine/uengine-check-runnable.sh"]).start()
# 使用 adb 连接 uengine
def UengineConnectAdb():
QtWidgets.QMessageBox.information(widget, "提示", subprocess.getoutput("adb connect 192.168.250.2:5555"))
# 允许用户使用 adb
def UengineUseAdb():
# 因为需要 root,所以需要开二号程序
os.system("adb start-server") # 保证有生成文件
os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath, "{}/.android/adbkey.pub".format(get_home()))) # 写入配置
if QtWidgets.QMessageBox.question(widget, "提示", "是否要连接到 UEngine?") == QtWidgets.QMessageBox.Yes:
UengineConnectAdb()
def UengineDoNotUseAdb():
# 因为需要 root,所以需要开二号程序
if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
QtWidgets.QMessageBox.critical(widget, "提示", "你的 uengine 在设置前已经禁用 adb 连接,无需重复设置")
return
threading.Thread(target=os.system, args=["pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 1".format(programPath)]).start()
def UengineRunnerBugUpload():
threading.Thread(target=os.system, args=[programPath + "/uengine-runner-update-bug"]).start()
def AdbConnectDeviceShow():
ShowTextTipsWindow.ShowWindow(subprocess.getoutput("adb devices -l"))
def AdbAndroidInstallAppList():
ShowTextTipsWindow.ShowWindow('''系统应用:
{}
第三方应用:
{}
全部应用以及apk所在路径:
{}'''.format(subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list packages -s"),
subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list package -3"),
subprocess.getoutput("adb -s 192.168.250.2:5555 shell pm list packages -f")))
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 VersionCheck(version1, version2):
return version1 == version2
def ShowHelp():
global webHelp
# 先判断是否能连接服务器,如果能则访问线上版本,否则访问本地的帮助文件
sk = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sk.settimeout(1000)
url = "file://" + programPath + "/Help/index.html"
try:
sk.connect(("uengine-runner.gfdgdxi.top", 80))
url = f"http://uengine-runner.gfdgdxi.top"
except:
traceback.print_exc()
if bad:
# 如果没有安装 QWebEngine,则直接用浏览器打开
webbrowser.open_new_tab(url)
return
# 否则用 QWebEngine 打开
webHelp = QtWebEngineWidgets.QWebEngineView()
webHelp.setWindowTitle("获取程序帮助")
webHelp.setUrl(QtCore.QUrl(url))
webHelp.setWindowIcon(QtGui.QIcon(iconPath))
webHelp.resize(int(webHelp.frameGeometry().width() * 1.3), int(webHelp.frameGeometry().height() * 1.1))
webHelp.show()
def AllowOrDisallowUpdateAndroidApp():
if not os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
if QtWidgets.QMessageBox.question(widget, langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], langFile[lang]["Main"]["MainWindow"]["Answer"]["UseAdbPackageAnswer"]) == QtWidgets.QMessageBox.No:
return
os.system("pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY {}/uengine-useadb 0 '{}'".format(programPath,"{}/.android/adbkey.pub".format(get_home()))) # 写入配
adb = api.Adb("192.168.250.2:5555")
adb.Service.Close()
adb.connect()
if QtWidgets.QMessageBox.question(widget, langFile[lang]["Main"]["MainWindow"]["Answer"]["Title"], message=langFile[lang]["Main"]["MainWindow"]["Answer"]["AllowOrDisallowUpdateAndroidAppAnswer"][int(adb.boolAndroidInstallOtherAppSetting())]) == QtWidgets.QMessageBox.Yes:
adb.setAndroidInstallOtherAppSetting(not adb.boolAndroidInstallOtherAppSetting())
QtWidgets.QMessageBox.information(widget, langFile[lang]["Main"]["MainWindow"]["Information"]["Title"], langFile[lang]["Main"]["MainWindow"]["Answer"]["CompleteInformation"])
def SetHttpProxy():
adb = api.Adb("192.168.250.2:5555")
adb.Service.Close()
adb.connect()
if QtWidgets.QMessageBox.question(widget, "提示", "此功能需要安装 adb 补丁,请保证已经安装然后按下“Yes”") == QtWidgets.QMessageBox.No:
return
proxy = QtWidgets.QInputDialog.getText(widget, "输入代理", "请输入要设置的代理(为空代表不设置代理)")
if proxy[1] == False:
return
if proxy[0] == "":
os.system("adb -s 192.168.250.2:5555 shell settings delete global http_proxy")
os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_host")
os.system("adb -s 192.168.250.2:5555 shell settings delete global global_http_proxy_port")
QtWidgets.QMessageBox.information(widget, "提示", "设置成功!")
else:
os.system(f"adb -s 192.168.250.2:5555 shell settings put global http_proxy \"{proxy[0]}\"")
QtWidgets.QMessageBox.information(widget, "提示", "设置成功!")
class UengineWindowSizeSetting:
setting = None
package = "com.nuts.extremspeedup"
verticalWidth = None
verticalHeighe = None
horizontaltWidth = None
horizontaltHeighe = None
verticalScreen = None
allowFullScreen = None
allowScreenSwitching = None
defaultFullScreen = None
logicalDensityDpi = None
physicalDpi = None
appWidth = None
appHeight = None
logicalWidth = None
logicalHeight = None
lineEdit = {
"verticalWidth": verticalWidth,
"verticalHeighe": verticalHeighe,
"horizontaltWidth": horizontaltWidth,
"horizontaltHeighe": horizontaltHeighe,
"logicalDensityDpi": logicalDensityDpi,
"physicalDpi": physicalDpi,
"appWidth": appWidth,
"appHeight": appHeight,
"logicalWidth": logicalWidth,
"logicalHeight": logicalHeight
}
checkbox = {
"verticalScreen": verticalScreen,
"allowFullScreen": allowFullScreen,
"allowScreenSwitching": allowScreenSwitching,
"defaultFullScreen": defaultFullScreen
}
def ShowWindow():
unfound = False
while True:
if ComboInstallPath.currentText() == "":
choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名")
else:
if GetApkPackageName(ComboInstallPath.currentText()) == None:
choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名", text=ComboInstallPath.currentText())
else:
choose = QtWidgets.QInputDialog.getText(widget, "输入", "请输入需要设置的 Android 应用的包名", text=GetApkPackageName(ComboInstallPath.currentText()))
if not choose[1]:
return
if choose[0] == "":
QtWidgets.QMessageBox.information(widget, "提示", "包名不能为空")
continue
if not os.path.exists(f"/usr/share/uengine/appetc/{choose[0]}.txt"):
if QtWidgets.QMessageBox.question(widget, "提示", "未找到这个包名对应的配置文件,是否要创建一个?") == QtWidgets.QMessageBox.No:
continue
unfound = True
UengineWindowSizeSetting.package = choose[0]
break
UengineWindowSizeSetting.setting = QtWidgets.QMainWindow()
settingWidget = QtWidgets.QWidget()
settingLayout = QtWidgets.QGridLayout()
UengineWindowSizeSetting.verticalWidth = QtWidgets.QLineEdit()
UengineWindowSizeSetting.verticalHeighe = QtWidgets.QLineEdit()
UengineWindowSizeSetting.horizontaltWidth = QtWidgets.QLineEdit()
UengineWindowSizeSetting.horizontaltHeighe = QtWidgets.QLineEdit()
UengineWindowSizeSetting.verticalScreen = QtWidgets.QCheckBox("默认为竖屏")
UengineWindowSizeSetting.allowFullScreen = QtWidgets.QCheckBox("允许全屏")
UengineWindowSizeSetting.allowScreenSwitching = QtWidgets.QCheckBox("允许横竖屏切换")
UengineWindowSizeSetting.defaultFullScreen = QtWidgets.QCheckBox("默认显示最大化")
UengineWindowSizeSetting.logicalDensityDpi = QtWidgets.QLineEdit()
UengineWindowSizeSetting.physicalDpi = QtWidgets.QLineEdit()
UengineWindowSizeSetting.appWidth = QtWidgets.QLineEdit()
UengineWindowSizeSetting.appHeight = QtWidgets.QLineEdit()
UengineWindowSizeSetting.logicalWidth = QtWidgets.QLineEdit()
UengineWindowSizeSetting.logicalHeight = QtWidgets.QLineEdit()
saveButton = QtWidgets.QPushButton("保存设置")
deleButton = QtWidgets.QPushButton("删除设置")
saveButton.clicked.connect(UengineWindowSizeSetting.SaveSetting)
deleButton.clicked.connect(UengineWindowSizeSetting.DeleteSetting)
settingLayout.addWidget(QtWidgets.QLabel("竖屏宽:"), 0, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.verticalWidth, 0, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("竖屏高:"), 1, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.verticalHeighe, 1, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("横屏宽,备选为1280:"), 2, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.horizontaltWidth, 2, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("横屏高,备选为720:"), 3, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.horizontaltHeighe, 3, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("设置默认横屏还是竖屏:"), 4, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.verticalScreen, 4, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("设置是否允许全屏:"), 5, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.allowFullScreen, 5, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("设置是否允许横竖屏切换:"), 6, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.allowScreenSwitching, 6, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("设置是否默认显示最大化:"), 7, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.defaultFullScreen, 7, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("<hr>"), 8, 0, 1, 3)
settingLayout.addWidget(QtWidgets.QLabel("屏幕缩放,数值大则大:"), 9, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.logicalDensityDpi, 9, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("physicalDpi:"), 10, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.physicalDpi, 10, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("appWidth:"), 11, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.appWidth, 11, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("appHeight:"), 12, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.appHeight, 12, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("logicalWidth:"), 13, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.logicalWidth, 13, 1, 1, 2)
settingLayout.addWidget(QtWidgets.QLabel("logicalHeight:"), 14, 0, 1, 1)
settingLayout.addWidget(UengineWindowSizeSetting.logicalHeight, 14, 1, 1, 2)
settingLayout.addWidget(saveButton, 15, 1, 1, 1)
settingLayout.addWidget(deleButton, 15, 2, 1, 1)
UengineWindowSizeSetting.lineEdit = {
"verticalWidth": UengineWindowSizeSetting.verticalWidth,
"verticalHeighe": UengineWindowSizeSetting.verticalHeighe,
"horizontaltWidth": UengineWindowSizeSetting.horizontaltWidth,
"horizontaltHeighe": UengineWindowSizeSetting.horizontaltHeighe,
"logicalDensityDpi": UengineWindowSizeSetting.logicalDensityDpi,
"physicalDpi": UengineWindowSizeSetting.physicalDpi,
"appWidth": UengineWindowSizeSetting.appWidth,
"appHeight": UengineWindowSizeSetting.appHeight,
"logicalWidth": UengineWindowSizeSetting.logicalWidth,
"logicalHeight": UengineWindowSizeSetting.logicalHeight
}
UengineWindowSizeSetting.checkbox = {
"verticalScreen": UengineWindowSizeSetting.verticalScreen,
"allowFullScreen": UengineWindowSizeSetting.allowFullScreen,
"allowScreenSwitching": UengineWindowSizeSetting.allowScreenSwitching,
"defaultFullScreen": UengineWindowSizeSetting.defaultFullScreen
}
settingWidget.setLayout(settingLayout)
UengineWindowSizeSetting.setting.setCentralWidget(settingWidget)
if not unfound: