-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
1232 lines (1101 loc) · 51.9 KB
/
app.py
File metadata and controls
1232 lines (1101 loc) · 51.9 KB
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
import sys
import os
import time
import platform
import psutil
import logging
import subprocess
from datetime import datetime
from PyQt6.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout,
QHBoxLayout, QPushButton, QLabel, QFileDialog,
QTabWidget, QLineEdit, QSpinBox, QComboBox,
QCheckBox, QGroupBox, QScrollArea, QTextEdit,
QProgressBar, QMessageBox, QSplitter, QFrame,
QStackedWidget, QToolButton, QMenu, QSystemTrayIcon)
from PyQt6.QtCore import (Qt, QPropertyAnimation, QEasingCurve, QPoint,
QTimer, QThread, pyqtSignal, QSize, QRect, QSettings)
from PyQt6.QtGui import (QFont, QIcon, QPalette, QColor, QFontDatabase,
QPixmap, QAction, QGradient, QLinearGradient, QPainter, QPen)
import PyInstaller.__main__
import shutil
from pathlib import Path
import qtawesome as qta
# Translation dictionaries
TRANSLATIONS = {
"en": {
"window_title": "PyExe Builder Professional",
"main_tab": "Main",
"metadata_tab": "Metadata",
"dependencies_tab": "Dependencies",
"advanced_tab": "Advanced",
"settings_tab": "Settings",
"build_console": "Build Console",
"system_info": "System Information",
"python_script": "Python Script",
"browse": "Browse",
"output_options": "Output Options",
"app_name": "Application Name:",
"output_dir": "Output Directory:",
"icon": "Icon:",
"build_options": "Build Options",
"one_file": "One File",
"no_console": "No Console",
"admin_access": "Request Admin Access",
"auto_deps": "Auto-install from requirements.txt",
"build_exe": "Build Executable",
"company_details": "Company Details",
"company_name": "Company Name",
"version": "Version (e.g., 1.0.0)",
"copyright": "Copyright Information",
"trademark": "Trademark Information",
"product_details": "Product Details",
"product_name": "Product Name",
"product_desc": "Product Description",
"hidden_imports": "Hidden Imports",
"binary_deps": "Binary Dependencies",
"data_files": "Data Files",
"debug_mode": "Debug Mode",
"strip": "Strip Binaries",
"upx": "Use UPX Compression",
"clean": "Clean Build",
"runtime_options": "Runtime Options",
"disable_windowed": "Disable Windowed Traceback",
"key": "Encryption Key (optional)",
"theme": "Theme:",
"language": "Language:",
"font_size": "Font Size:",
"animations": "Enable Animations",
"anti_aliasing": "Enable Anti-Aliasing",
"ready": "Ready",
"starting_build": "Starting build process...",
"build_success": "Build completed successfully!",
"build_failed": "Build failed: {}",
"no_script": "Please select a Python script!",
},
"ja": {
"window_title": "PyExeビルダープロフェッショナル",
"main_tab": "メイン",
"metadata_tab": "メタデータ",
"dependencies_tab": "依存関係",
"advanced_tab": "高度",
"settings_tab": "設定",
"build_console": "ビルドコンソール",
"system_info": "システム情報",
"python_script": "Pythonスクリプト",
"browse": "参照",
"output_options": "出力オプション",
"app_name": "アプリケーション名:",
"output_dir": "出力ディレクトリ:",
"icon": "アイコン:",
"build_options": "ビルドオプション",
"one_file": "単一ファイル",
"no_console": "コンソールなし",
"admin_access": "管理者アクセスを要求",
"auto_deps": "requirements.txtから自動インストール",
"build_exe": "実行可能ファイルをビルド",
"company_details": "会社詳細",
"company_name": "会社名",
"version": "バージョン (例: 1.0.0)",
"copyright": "著作権情報",
"trademark": "商標情報",
"product_details": "製品詳細",
"product_name": "製品名",
"product_desc": "製品説明",
"hidden_imports": "隠しインポート",
"binary_deps": "バイナリ依存関係",
"data_files": "データファイル",
"debug_mode": "デバッグモード",
"strip": "バイナリを剥がす",
"upx": "UPX圧縮を使用",
"clean": "クリーンビルド",
"runtime_options": "ランタイムオプション",
"disable_windowed": "ウィンドウ付きトレースバックを無効化",
"key": "暗号化キー (任意)",
"theme": "テーマ:",
"language": "言語:",
"font_size": "フォントサイズ:",
"animations": "アニメーションを有効化",
"anti_aliasing": "アンチエイリアシングを有効化",
"ready": "準備完了",
"starting_build": "ビルドプロセスを開始...",
"build_success": "ビルドが正常に完了しました!",
"build_failed": "ビルドに失敗しました: {}",
"no_script": "Pythonスクリプトを選択してください!",
},
"ko": {
"window_title": "PyExe 빌더 프로페셔널",
"main_tab": "메인",
"metadata_tab": "메타데이터",
"dependencies_tab": "종속성",
"advanced_tab": "고급",
"settings_tab": "설정",
"build_console": "빌드 콘솔",
"system_info": "시스템 정보",
"python_script": "파이썬 스크립트",
"browse": "찾아보기",
"output_options": "출력 옵션",
"app_name": "애플리케이션 이름:",
"output_dir": "출력 디렉토리:",
"icon": "아이콘:",
"build_options": "빌드 옵션",
"one_file": "단일 파일",
"no_console": "콘솔 없음",
"admin_access": "관리자 권한 요청",
"auto_deps": "requirements.txt에서 자동 설치",
"build_exe": "실행 파일 빌드",
"company_details": "회사 세부사항",
"company_name": "회사 이름",
"version": "버전 (예: 1.0.0)",
"copyright": "저작권 정보",
"trademark": "상표 정보",
"product_details": "제품 세부사항",
"product_name": "제품 이름",
"product_desc": "제품 설명",
"hidden_imports": "숨겨진 가져오기",
"binary_deps": "바이너리 종속성",
"data_files": "데이터 파일",
"debug_mode": "디버그 모드",
"strip": "바이너리 제거",
"upx": "UPX 압축 사용",
"clean": "클린 빌드",
"runtime_options": "런타임 옵션",
"disable_windowed": "창 추적 비활성화",
"key": "암호화 키 (선택 사항)",
"theme": "테마:",
"language": "언어:",
"font_size": "글꼴 크기:",
"animations": "애니메이션 활성화",
"anti_aliasing": "안티 앨리어싱 활성화",
"ready": "준비 완료",
"starting_build": "빌드 프로세스 시작...",
"build_success": "빌드가 성공적으로 완료되었습니다!",
"build_failed": "빌드 실패: {}",
"no_script": "파이썬 스크립트를 선택하세요!",
},
"fil": {
"window_title": "PyExe Builder Propesyonal",
"main_tab": "Pangunahin",
"metadata_tab": "Metadata",
"dependencies_tab": "Mga Depende",
"advanced_tab": "Advanced",
"settings_tab": "Mga Setting",
"build_console": "Build Console",
"system_info": "Impormasyon ng Sistema",
"python_script": "Python Script",
"browse": "Mag-browse",
"output_options": "Mga Opsyon sa Output",
"app_name": "Pangalan ng Aplikasyon:",
"output_dir": "Direktoryo ng Output:",
"icon": "Icon:",
"build_options": "Mga Opsyon sa Build",
"one_file": "Isang File",
"no_console": "Walang Console",
"admin_access": "Humiling ng Access ng Admin",
"auto_deps": "Auto-install mula sa requirements.txt",
"build_exe": "I-build ang Executable",
"company_details": "Mga Detalye ng Kompanya",
"company_name": "Pangalan ng Kompanya",
"version": "Bersyon (hal. 1.0.0)",
"copyright": "Impormasyon sa Copyright",
"trademark": "Impormasyon sa Trademark",
"product_details": "Mga Detalye ng Produkto",
"product_name": "Pangalan ng Produkto",
"product_desc": "Deskripsyon ng Produkto",
"hidden_imports": "Mga Hidden Imports",
"binary_deps": "Mga Binary Dependencies",
"data_files": "Mga Data File",
"debug_mode": "Debug Mode",
"strip": "Hubarin ang mga Binary",
"upx": "Gumamit ng UPX Compression",
"clean": "Malinis na Build",
"runtime_options": "Mga Opsyon sa Runtime",
"disable_windowed": "Huwag Paganahin ang Windowed Traceback",
"key": "Encryption Key (opsyonal)",
"theme": "Tema:",
"language": "Wika:",
"font_size": "Laki ng Font:",
"animations": "Paganahin ang mga Animation",
"anti_aliasing": "Paganahin ang Anti-Aliasing",
"ready": "Handa na",
"starting_build": "Sinimulan ang proseso ng build...",
"build_success": "Matagumpay na natapos ang build!",
"build_failed": "Nabigo ang build: {}",
"no_script": "Pumili ng Python script!",
}
}
# Theme definitions (unchanged)
THEMES = {
"Dark Soft": {
"background": "#1E2A44",
"gradient_start": "#1E2A44",
"gradient_end": "#2E3B55",
"text": "#D9E1E8",
"border": "#3A4971",
"button": "#4A5A88",
"button_hover": "#5A6A98",
"button_pressed": "#3A4971",
"console_bg": "#1A1A1A",
"console_border": "#2A2A2A",
},
"Midnight Blue": {
"background": "#0A192F",
"gradient_start": "#0A192F",
"gradient_end": "#172A45",
"text": "#FFFFFF",
"border": "#1A237E",
"button": "#1A237E",
"button_hover": "#283593",
"button_pressed": "#0D1752",
"console_bg": "#1A1A1A",
"console_border": "#2A2A2A",
},
"Slate Gray": {
"background": "#2F3E46",
"gradient_start": "#2F3E46",
"gradient_end": "#354F52",
"text": "#CAD2C5",
"border": "#52796F",
"button": "#52796F",
"button_hover": "#84A98C",
"button_pressed": "#354F52",
"console_bg": "#1A1A1A",
"console_border": "#2A2A2A",
},
"Deep Forest": {
"background": "#1F2A33",
"gradient_start": "#1F2A33",
"gradient_end": "#2A3B44",
"text": "#E0E7D7",
"border": "#3E5A61",
"button": "#4A7066",
"button_hover": "#5A8377",
"button_pressed": "#3E5A61",
"console_bg": "#1A1A1A",
"console_border": "#2A2A2A",
},
"Velvet Night": {
"background": "#2A1E3B",
"gradient_start": "#2A1E3B",
"gradient_end": "#3B2A4F",
"text": "#E8D9F0",
"border": "#5A3E71",
"button": "#6A4A88",
"button_hover": "#7A5A98",
"button_pressed": "#5A3E71",
"console_bg": "#1A1A1A",
"console_border": "#2A2A2A",
},
"Charcoal Glow": {
"background": "#2D2D2D",
"gradient_start": "#2D2D2D",
"gradient_end": "#3D3D3D",
"text": "#E0E0E0",
"border": "#4A4A4A",
"button": "#5A5A5A",
"button_hover": "#6A6A6A",
"button_pressed": "#4A4A4A",
"console_bg": "#1A1A1A",
"console_border": "#2A2A2A",
}
}
class ConsoleOutput(QTextEdit):
def __init__(self, parent=None):
super().__init__(parent)
self.setReadOnly(True)
def append_message(self, msg, level="INFO"):
colors = {"INFO": "#00ff00", "WARNING": "#ffff00", "ERROR": "#ff0000", "DEBUG": "#00ffff"}
timestamp = datetime.now().strftime("%H:%M:%S")
formatted_msg = f'<span style="color: {colors[level]}">[{timestamp}] [{level}] {msg}</span>'
self.append(formatted_msg)
self.verticalScrollBar().setValue(self.verticalScrollBar().maximum())
class MetadataTab(QWidget):
def __init__(self, lang="en"):
super().__init__()
self.lang = lang
layout = QVBoxLayout(self)
self.company_group = QGroupBox(TRANSLATIONS[lang]["company_details"])
company_layout = QVBoxLayout()
self.company_name = QLineEdit()
self.company_name.setPlaceholderText(TRANSLATIONS[lang]["company_name"])
company_layout.addWidget(self.company_name)
self.company_version = QLineEdit()
self.company_version.setPlaceholderText(TRANSLATIONS[lang]["version"])
company_layout.addWidget(self.company_version)
self.copyright = QLineEdit()
self.copyright.setPlaceholderText(TRANSLATIONS[lang]["copyright"])
company_layout.addWidget(self.copyright)
self.trademark = QLineEdit()
self.trademark.setPlaceholderText(TRANSLATIONS[lang]["trademark"])
company_layout.addWidget(self.trademark)
self.company_group.setLayout(company_layout)
layout.addWidget(self.company_group)
self.product_group = QGroupBox(TRANSLATIONS[lang]["product_details"])
product_layout = QVBoxLayout()
self.product_name = QLineEdit()
self.product_name.setPlaceholderText(TRANSLATIONS[lang]["product_name"])
product_layout.addWidget(self.product_name)
self.product_desc = QTextEdit()
self.product_desc.setPlaceholderText(TRANSLATIONS[lang]["product_desc"])
self.product_desc.setMaximumHeight(100)
product_layout.addWidget(self.product_desc)
self.product_group.setLayout(product_layout)
layout.addWidget(self.product_group)
class DependenciesTab(QWidget):
def __init__(self, lang="en"):
super().__init__()
self.lang = lang
layout = QVBoxLayout(self)
self.imports_group = QGroupBox(TRANSLATIONS[lang]["hidden_imports"])
imports_layout = QVBoxLayout()
self.hidden_imports = QTextEdit()
self.hidden_imports.setPlaceholderText(TRANSLATIONS[lang]["hidden_imports"])
imports_layout.addWidget(self.hidden_imports)
self.imports_group.setLayout(imports_layout)
layout.addWidget(self.imports_group)
self.binary_group = QGroupBox(TRANSLATIONS[lang]["binary_deps"])
binary_layout = QVBoxLayout()
self.binary_files = QTextEdit()
self.binary_files.setPlaceholderText(TRANSLATIONS[lang]["binary_deps"])
binary_layout.addWidget(self.binary_files)
self.binary_group.setLayout(binary_layout)
layout.addWidget(self.binary_group)
self.data_group = QGroupBox(TRANSLATIONS[lang]["data_files"])
data_layout = QVBoxLayout()
self.data_files = QTextEdit()
self.data_files.setPlaceholderText(TRANSLATIONS[lang]["data_files"])
data_layout.addWidget(self.data_files)
self.data_group.setLayout(data_layout)
layout.addWidget(self.data_group)
class AdvancedOptionsTab(QWidget):
def __init__(self, lang="en"):
super().__init__()
self.lang = lang
layout = QVBoxLayout(self)
self.build_group = QGroupBox(TRANSLATIONS[lang]["build_options"])
build_layout = QVBoxLayout()
self.debug_mode = QCheckBox(TRANSLATIONS[lang]["debug_mode"])
build_layout.addWidget(self.debug_mode)
self.strip = QCheckBox(TRANSLATIONS[lang]["strip"])
build_layout.addWidget(self.strip)
self.upx = QCheckBox(TRANSLATIONS[lang]["upx"])
build_layout.addWidget(self.upx)
self.clean = QCheckBox(TRANSLATIONS[lang]["clean"])
build_layout.addWidget(self.clean)
self.build_group.setLayout(build_layout)
layout.addWidget(self.build_group)
self.runtime_group = QGroupBox(TRANSLATIONS[lang]["runtime_options"])
runtime_layout = QVBoxLayout()
self.disable_windowed = QCheckBox(TRANSLATIONS[lang]["disable_windowed"])
runtime_layout.addWidget(self.disable_windowed)
self.key = QLineEdit()
self.key.setPlaceholderText(TRANSLATIONS[lang]["key"])
runtime_layout.addWidget(self.key)
self.runtime_group.setLayout(runtime_layout)
layout.addWidget(self.runtime_group)
class SettingsTab(QWidget):
def __init__(self, lang="en", update_callback=None):
super().__init__()
self.lang = lang
self.update_callback = update_callback
layout = QVBoxLayout(self)
self.theme_group = QGroupBox("Appearance")
theme_layout = QVBoxLayout()
self.theme_label = QLabel(TRANSLATIONS[lang]["theme"])
self.theme_combo = QComboBox()
self.theme_combo.addItems(THEMES.keys())
self.theme_combo.currentTextChanged.connect(self.update_callback)
theme_layout.addWidget(self.theme_label)
theme_layout.addWidget(self.theme_combo)
self.theme_group.setLayout(theme_layout)
layout.addWidget(self.theme_group)
self.lang_group = QGroupBox("Localization")
lang_layout = QVBoxLayout()
self.lang_label = QLabel(TRANSLATIONS[lang]["language"])
self.lang_combo = QComboBox()
self.lang_combo.addItems(["English", "Japanese", "Korean", "Filipino"])
self.lang_combo.currentTextChanged.connect(self.update_callback)
lang_layout.addWidget(self.lang_label)
lang_layout.addWidget(self.lang_combo)
self.lang_group.setLayout(lang_layout)
layout.addWidget(self.lang_group)
self.font_group = QGroupBox("Typography")
font_layout = QHBoxLayout()
self.font_label = QLabel(TRANSLATIONS[lang]["font_size"])
self.font_size = QSpinBox()
self.font_size.setRange(8, 24)
self.font_size.setValue(12)
self.font_size.valueChanged.connect(self.update_callback)
font_layout.addWidget(self.font_label)
font_layout.addWidget(self.font_size)
self.font_group.setLayout(font_layout)
layout.addWidget(self.font_group)
self.misc_group = QGroupBox("Miscellaneous")
misc_layout = QVBoxLayout()
self.animations = QCheckBox(TRANSLATIONS[lang]["animations"])
self.animations.setChecked(True)
self.animations.stateChanged.connect(self.update_callback)
self.anti_aliasing = QCheckBox(TRANSLATIONS[lang]["anti_aliasing"])
self.anti_aliasing.setChecked(True)
self.anti_aliasing.stateChanged.connect(self.update_callback)
misc_layout.addWidget(self.animations)
misc_layout.addWidget(self.anti_aliasing)
self.misc_group.setLayout(misc_layout)
layout.addWidget(self.misc_group)
class SystemInfoWidget(QWidget):
def __init__(self, lang="en"):
super().__init__()
layout = QVBoxLayout(self)
info_text = f"""
{TRANSLATIONS[lang]["system_info"]}:
OS: {platform.system()} {platform.release()}
Python: {platform.python_version()}
CPU: {platform.processor()}
Memory: {psutil.virtual_memory().total / (1024**3):.1f} GB
"""
self.info_label = QLabel(info_text)
self.info_label.setStyleSheet("color: #a0a0a0; font-size: 10px;")
layout.addWidget(self.info_label)
class RequirementsScanner(QThread):
progress = pyqtSignal(int)
message = pyqtSignal(str, str)
finished = pyqtSignal(list)
def __init__(self, script_path):
super().__init__()
self.script_dir = os.path.dirname(script_path)
def run(self):
requirements_file = os.path.join(self.script_dir, "requirements.txt")
dependencies = []
if os.path.exists(requirements_file):
self.message.emit(TRANSLATIONS["en"]["starting_build"], "INFO")
try:
with open(requirements_file, 'r') as f:
lines = f.readlines()
total_lines = len(lines)
for i, line in enumerate(lines):
dep = line.strip()
if dep and not dep.startswith('#'):
dependencies.append(dep)
self.progress.emit(int((i + 1) / total_lines * 100))
self.message.emit(f"Found {len(dependencies)} dependencies in requirements.txt", "INFO")
except Exception as e:
self.message.emit(f"Failed to read requirements.txt: {str(e)}", "ERROR")
else:
self.message.emit("No requirements.txt found in script directory", "WARNING")
self.finished.emit(dependencies)
def resource_path(relative_path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)
else:
return os.path.join(os.path.dirname(__file__), relative_path)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.settings = QSettings("VoxDroid", "PyExeBuilder")
self.load_settings()
self.setWindowTitle(TRANSLATIONS[self.lang]["window_title"])
self.setMinimumSize(1200, 800)
self.setup_ui()
self.apply_theme()
self.setup_tray()
self.setWindowIcon(QIcon(resource_path("icon.ico")))
logging.basicConfig(level=logging.DEBUG)
self.logger = logging.getLogger(__name__)
def load_settings(self):
self.lang = self.settings.value("lang", "en", str)
self.theme = self.settings.value("theme", "Dark Soft", str)
self.font_size = self.settings.value("font_size", 12, int)
self.animations_enabled = self.settings.value("animations", True, bool)
self.anti_aliasing_enabled = self.settings.value("anti_aliasing", True, bool)
self.is_building = False
def save_settings(self):
self.settings.setValue("lang", self.lang)
self.settings.setValue("theme", self.theme)
self.settings.setValue("font_size", self.font_size)
self.settings.setValue("animations", self.animations_enabled)
self.settings.setValue("anti_aliasing", self.anti_aliasing_enabled)
self.settings.sync()
def closeEvent(self, event):
self.save_settings()
super().closeEvent(event)
def setup_tray(self):
self.tray_icon = QSystemTrayIcon(self)
self.tray_icon.setIcon(qta.icon("fa5s.cogs"))
tray_menu = QMenu()
show_action = QAction("Show", self)
quit_action = QAction("Exit", self)
show_action.triggered.connect(self.show)
quit_action.triggered.connect(QApplication.quit)
tray_menu.addAction(show_action)
tray_menu.addAction(quit_action)
self.tray_icon.setContextMenu(tray_menu)
self.tray_icon.show()
def apply_theme(self):
theme = THEMES[self.theme]
gradient = QLinearGradient(0, 0, 0, self.height())
gradient.setColorAt(0, QColor(theme["gradient_start"]))
gradient.setColorAt(1, QColor(theme["gradient_end"]))
palette = self.palette()
palette.setBrush(QPalette.ColorRole.Window, gradient)
self.setPalette(palette)
stylesheet = f"""
QMainWindow {{
background-color: {theme["background"]};
}}
QTabWidget::pane {{
border: none;
background-color: transparent;
}}
QTabBar::tab {{
background-color: {theme["border"]};
color: {theme["text"]};
padding: 12px 24px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
margin: 2px;
font-family: 'Poppins';
font-size: {self.font_size}px;
}}
QTabBar::tab:selected {{
background-color: {theme["button"]};
}}
QLabel {{
color: {theme["text"]};
font-family: 'Poppins';
font-size: {self.font_size}px;
}}
QLineEdit, QTextEdit, QSpinBox, QComboBox {{
background-color: {theme["border"]};
color: {theme["text"]};
border: 1px solid {theme["button"]};
border-radius: 6px;
padding: 6px;
font-family: 'Poppins';
font-size: {self.font_size}px;
}}
QGroupBox {{
color: {theme["text"]};
font-family: 'Poppins';
border: 1px solid {theme["button"]};
border-radius: 6px;
margin-top: 12px;
font-size: {self.font_size}px;
}}
QCheckBox {{
color: {theme["text"]};
font-family: 'Poppins';
font-size: {self.font_size}px;
}}
QProgressBar {{
border: 2px solid {theme["button"]};
border-radius: 6px;
text-align: center;
color: {theme["text"]};
font-family: 'Poppins';
font-size: {self.font_size}px;
}}
QProgressBar::chunk {{
background-color: {theme["button"]};
}}
QPushButton {{
background-color: {theme["button"]};
color: {theme["text"]};
border: none;
border-radius: 6px;
padding: 15px;
font-family: 'Poppins';
font-size: {self.font_size}px;
min-width: 100px;
min-height: 40px;
}}
QPushButton:hover {{
background-color: {theme["button_hover"]};
}}
QPushButton:pressed {{
background-color: {theme["button_pressed"]};
}}
QPushButton:disabled {{
background-color: #666666;
color: #aaaaaa;
}}
QTextEdit {{
background-color: {theme["console_bg"]};
border: 1px solid {theme["console_border"]};
border-radius: 6px;
}}
#footer {{
background-color: {theme["border"]};
border-top: 1px solid {theme["button"]};
}}
"""
self.setStyleSheet(stylesheet)
if self.animations_enabled:
self.animate_tabs()
def animate_tabs(self):
for i in range(self.tabs.count()):
tab = self.tabs.widget(i)
anim = QPropertyAnimation(tab, b"pos")
anim.setDuration(300)
anim.setStartValue(QPoint(0, -20))
anim.setEndValue(QPoint(0, 0))
anim.setEasingCurve(QEasingCurve.Type.OutCubic)
anim.start()
def setup_ui(self):
QFontDatabase.addApplicationFont("assets/fonts/Poppins-Regular.ttf")
central_widget = QWidget()
self.setCentralWidget(central_widget)
main_layout = QVBoxLayout(central_widget)
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.setSpacing(0)
# Navigation bar (top, horizontal, stretched)
self.tabs = QTabWidget()
self.tabs.setTabPosition(QTabWidget.TabPosition.North)
self.tabs.setMovable(False)
self.tabs.setDocumentMode(True)
main_tab = self.create_main_tab()
self.tabs.addTab(main_tab, qta.icon("fa5s.home"), TRANSLATIONS[self.lang]["main_tab"])
self.metadata_tab = MetadataTab(self.lang)
self.tabs.addTab(self.metadata_tab, qta.icon("fa5s.info-circle"), TRANSLATIONS[self.lang]["metadata_tab"])
self.dependencies_tab = DependenciesTab(self.lang)
self.tabs.addTab(self.dependencies_tab, qta.icon("fa5s.link"), TRANSLATIONS[self.lang]["dependencies_tab"])
self.advanced_tab = AdvancedOptionsTab(self.lang)
self.tabs.addTab(self.advanced_tab, qta.icon("fa5s.cog"), TRANSLATIONS[self.lang]["advanced_tab"])
self.settings_tab = SettingsTab(self.lang, self.update_settings)
self.settings_tab.theme_combo.setCurrentText(self.theme)
self.settings_tab.lang_combo.setCurrentText({"en": "English", "ja": "Japanese", "ko": "Korean", "fil": "Filipino"}[self.lang])
self.settings_tab.font_size.setValue(self.font_size)
self.settings_tab.animations.setChecked(self.animations_enabled)
self.settings_tab.anti_aliasing.setChecked(self.anti_aliasing_enabled)
self.tabs.addTab(self.settings_tab, qta.icon("fa5s.sliders-h"), TRANSLATIONS[self.lang]["settings_tab"])
main_layout.addWidget(self.tabs)
# Content area (splitter)
content_widget = QWidget()
content_layout = QHBoxLayout(content_widget)
# Left side (tab content)
self.left_widget = QWidget()
left_layout = QVBoxLayout(self.left_widget)
left_layout.addWidget(self.tabs)
# Right side (build console and system info)
self.right_widget = QWidget()
right_layout = QVBoxLayout(self.right_widget)
self.console_group = QGroupBox(TRANSLATIONS[self.lang]["build_console"])
console_layout = QVBoxLayout()
self.console = ConsoleOutput()
console_layout.addWidget(self.console)
self.console_group.setLayout(console_layout)
right_layout.addWidget(self.console_group)
self.system_info = SystemInfoWidget(self.lang)
right_layout.addWidget(self.system_info)
content_layout.addWidget(self.left_widget, 2)
content_layout.addWidget(self.right_widget, 1)
main_layout.addWidget(content_widget)
# Footer (single-line)
self.footer_widget = QWidget()
self.footer_widget.setObjectName("footer")
footer_layout = QHBoxLayout(self.footer_widget)
footer_layout.setContentsMargins(10, 5, 10, 5)
self.status_label = QLabel(TRANSLATIONS[self.lang]["ready"])
self.status_label.setStyleSheet("color: #a0a0a0; font-size: 12px;")
footer_layout.addWidget(self.status_label)
footer_layout.addStretch()
self.dev_info = QLabel("PyExe Builder v1.0.0 by VoxDroid - github.com/VoxDroid")
self.dev_info.setStyleSheet("color: #a0a0a0; font-size: 12px;")
footer_layout.addWidget(self.dev_info)
main_layout.addWidget(self.footer_widget)
def create_main_tab(self):
main_tab = QWidget()
main_layout = QVBoxLayout(main_tab)
self.script_group = QGroupBox(TRANSLATIONS[self.lang]["python_script"])
script_layout = QHBoxLayout()
self.script_path = QLineEdit()
self.browse_script = QPushButton(qta.icon("fa5s.folder-open"), TRANSLATIONS[self.lang]["browse"])
self.browse_script.clicked.connect(lambda: self.browse_file(self.script_path, "Python Files (*.py)"))
script_layout.addWidget(self.script_path)
script_layout.addWidget(self.browse_script)
self.script_group.setLayout(script_layout)
main_layout.addWidget(self.script_group)
self.output_group = QGroupBox(TRANSLATIONS[self.lang]["output_options"])
output_layout = QVBoxLayout()
name_layout = QHBoxLayout()
self.name_label = QLabel(TRANSLATIONS[self.lang]["app_name"])
self.app_name = QLineEdit()
name_layout.addWidget(self.name_label)
name_layout.addWidget(self.app_name)
output_layout.addLayout(name_layout)
dir_layout = QHBoxLayout()
self.dir_label = QLabel(TRANSLATIONS[self.lang]["output_dir"])
self.output_dir = QLineEdit()
self.browse_dir = QPushButton(qta.icon("fa5s.folder"), TRANSLATIONS[self.lang]["browse"])
self.browse_dir.clicked.connect(self.browse_output_dir)
dir_layout.addWidget(self.dir_label)
dir_layout.addWidget(self.output_dir)
dir_layout.addWidget(self.browse_dir)
output_layout.addLayout(dir_layout)
icon_layout = QHBoxLayout()
self.icon_label = QLabel(TRANSLATIONS[self.lang]["icon"])
self.icon_path = QLineEdit()
self.browse_icon = QPushButton(qta.icon("fa5s.image"), TRANSLATIONS[self.lang]["browse"])
self.browse_icon.clicked.connect(lambda: self.browse_file(self.icon_path, "Icon Files (*.ico)"))
icon_layout.addWidget(self.icon_label)
icon_layout.addWidget(self.icon_path)
icon_layout.addWidget(self.browse_icon)
output_layout.addLayout(icon_layout)
self.output_group.setLayout(output_layout)
main_layout.addWidget(self.output_group)
self.build_group = QGroupBox(TRANSLATIONS[self.lang]["build_options"])
build_layout = QVBoxLayout()
self.one_file = QCheckBox(TRANSLATIONS[self.lang]["one_file"])
self.one_file.setChecked(True)
self.no_console = QCheckBox(TRANSLATIONS[self.lang]["no_console"])
self.admin_access = QCheckBox(TRANSLATIONS[self.lang]["admin_access"])
self.auto_deps = QCheckBox(TRANSLATIONS[self.lang]["auto_deps"])
self.auto_deps.setChecked(True)
build_layout.addWidget(self.one_file)
build_layout.addWidget(self.no_console)
build_layout.addWidget(self.admin_access)
build_layout.addWidget(self.auto_deps)
self.build_group.setLayout(build_layout)
main_layout.addWidget(self.build_group)
self.progress_bar = QProgressBar()
main_layout.addWidget(self.progress_bar)
self.build_button = QPushButton(qta.icon("fa5s.play"), TRANSLATIONS[self.lang]["build_exe"])
self.build_button.setMinimumHeight(50)
self.build_button.clicked.connect(self.build_executable)
main_layout.addWidget(self.build_button)
main_layout.addStretch()
return main_tab
def browse_file(self, line_edit, file_filter):
file_path, _ = QFileDialog.getOpenFileName(self, "Select File", "", file_filter)
if file_path:
line_edit.setText(file_path)
def browse_output_dir(self):
dir_path = QFileDialog.getExistingDirectory(self, "Select Output Directory")
if dir_path:
self.output_dir.setText(dir_path)
def update_settings(self):
current_tab = self.tabs.currentIndex()
self.theme = self.settings_tab.theme_combo.currentText()
lang_map = {"English": "en", "Japanese": "ja", "Korean": "ko", "Filipino": "fil"}
self.lang = lang_map[self.settings_tab.lang_combo.currentText()]
self.font_size = self.settings_tab.font_size.value()
self.animations_enabled = self.settings_tab.animations.isChecked()
self.anti_aliasing_enabled = self.settings_tab.anti_aliasing.isChecked()
self.apply_theme()
self.update_ui_text()
self.save_settings()
self.tabs.setCurrentIndex(current_tab)
def update_ui_text(self):
self.setWindowTitle(TRANSLATIONS[self.lang]["window_title"])
self.tabs.setTabText(0, TRANSLATIONS[self.lang]["main_tab"])
self.tabs.setTabText(1, TRANSLATIONS[self.lang]["metadata_tab"])
self.tabs.setTabText(2, TRANSLATIONS[self.lang]["dependencies_tab"])
self.tabs.setTabText(3, TRANSLATIONS[self.lang]["advanced_tab"])
self.tabs.setTabText(4, TRANSLATIONS[self.lang]["settings_tab"])
if hasattr(self, 'status_label'):
self.status_label.setText(TRANSLATIONS[self.lang]["ready"])
if hasattr(self, 'dev_info'):
self.dev_info.setText("PyExe Builder v1.0.0 by VoxDroid - github.com/VoxDroid")
# Update Main Tab
widget = self.tabs.widget(0)
if widget:
self.script_group.setTitle(TRANSLATIONS[self.lang]["python_script"])
self.output_group.setTitle(TRANSLATIONS[self.lang]["output_options"])
self.build_group.setTitle(TRANSLATIONS[self.lang]["build_options"])
self.name_label.setText(TRANSLATIONS[self.lang]["app_name"])
self.dir_label.setText(TRANSLATIONS[self.lang]["output_dir"])
self.icon_label.setText(TRANSLATIONS[self.lang]["icon"])
self.one_file.setText(TRANSLATIONS[self.lang]["one_file"])
self.no_console.setText(TRANSLATIONS[self.lang]["no_console"])
self.admin_access.setText(TRANSLATIONS[self.lang]["admin_access"])
self.auto_deps.setText(TRANSLATIONS[self.lang]["auto_deps"])
self.build_button.setText(TRANSLATIONS[self.lang]["build_exe"])
# Explicitly update all Browse buttons
self.browse_script.setText(TRANSLATIONS[self.lang]["browse"])
self.browse_dir.setText(TRANSLATIONS[self.lang]["browse"])
self.browse_icon.setText(TRANSLATIONS[self.lang]["browse"])
# Update Metadata Tab
if hasattr(self, 'metadata_tab'):
self.metadata_tab.lang = self.lang
self.metadata_tab.company_group.setTitle(TRANSLATIONS[self.lang]["company_details"])
self.metadata_tab.product_group.setTitle(TRANSLATIONS[self.lang]["product_details"])
self.metadata_tab.company_name.setPlaceholderText(TRANSLATIONS[self.lang]["company_name"])
self.metadata_tab.company_version.setPlaceholderText(TRANSLATIONS[self.lang]["version"])
self.metadata_tab.copyright.setPlaceholderText(TRANSLATIONS[self.lang]["copyright"])
self.metadata_tab.trademark.setPlaceholderText(TRANSLATIONS[self.lang]["trademark"])
self.metadata_tab.product_name.setPlaceholderText(TRANSLATIONS[self.lang]["product_name"])
self.metadata_tab.product_desc.setPlaceholderText(TRANSLATIONS[self.lang]["product_desc"])
# Update Dependencies Tab
if hasattr(self, 'dependencies_tab'):
self.dependencies_tab.lang = self.lang
self.dependencies_tab.imports_group.setTitle(TRANSLATIONS[self.lang]["hidden_imports"])
self.dependencies_tab.binary_group.setTitle(TRANSLATIONS[self.lang]["binary_deps"])
self.dependencies_tab.data_group.setTitle(TRANSLATIONS[self.lang]["data_files"])
self.dependencies_tab.hidden_imports.setPlaceholderText(TRANSLATIONS[self.lang]["hidden_imports"])
self.dependencies_tab.binary_files.setPlaceholderText(TRANSLATIONS[self.lang]["binary_deps"])
self.dependencies_tab.data_files.setPlaceholderText(TRANSLATIONS[self.lang]["data_files"])
# Update Advanced Tab
if hasattr(self, 'advanced_tab'):
self.advanced_tab.lang = self.lang
self.advanced_tab.build_group.setTitle(TRANSLATIONS[self.lang]["build_options"])
self.advanced_tab.runtime_group.setTitle(TRANSLATIONS[self.lang]["runtime_options"])
self.advanced_tab.debug_mode.setText(TRANSLATIONS[self.lang]["debug_mode"])
self.advanced_tab.strip.setText(TRANSLATIONS[self.lang]["strip"])
self.advanced_tab.upx.setText(TRANSLATIONS[self.lang]["upx"])
self.advanced_tab.clean.setText(TRANSLATIONS[self.lang]["clean"])
self.advanced_tab.disable_windowed.setText(TRANSLATIONS[self.lang]["disable_windowed"])
self.advanced_tab.key.setPlaceholderText(TRANSLATIONS[self.lang]["key"])
# Update Settings Tab
if hasattr(self, 'settings_tab'):
self.settings_tab.lang = self.lang
self.settings_tab.theme_label.setText(TRANSLATIONS[self.lang]["theme"])
self.settings_tab.lang_label.setText(TRANSLATIONS[self.lang]["language"])
self.settings_tab.font_label.setText(TRANSLATIONS[self.lang]["font_size"])
self.settings_tab.animations.setText(TRANSLATIONS[self.lang]["animations"])
self.settings_tab.anti_aliasing.setText(TRANSLATIONS[self.lang]["anti_aliasing"])
# Update Console and System Info
if hasattr(self, 'console_group'):
self.console_group.setTitle(TRANSLATIONS[self.lang]["build_console"])
if hasattr(self, 'system_info'):
self.system_info.info_label.setText(f"""
{TRANSLATIONS[self.lang]["system_info"]}:
OS: {platform.system()} {platform.release()}
Python: {platform.python_version()}
CPU: {platform.processor()}
Memory: {psutil.virtual_memory().total / (1024**3):.1f} GB
""")
def create_version_file(self, config):
version_file_content = """
# UTF-8
#
# For more details about fixed file info 'ffi' see:
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
VSVersionInfo(
ffi=FixedFileInfo(
filevers=({version_tuple}),
prodvers=({version_tuple}),
mask=0x3f,
flags=0x0,
OS=0x40004,
fileType=0x1,
subtype=0x0,
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringTable(
u'040904B0',
[StringStruct(u'CompanyName', u'{company_name}'),
StringStruct(u'FileDescription', u'{product_desc}'),
StringStruct(u'FileVersion', u'{company_version}'),
StringStruct(u'LegalCopyright', u'{copyright}'),
StringStruct(u'LegalTrademarks', u'{trademark}'),
StringStruct(u'ProductName', u'{product_name}'),
StringStruct(u'ProductVersion', u'{company_version}')])
]),
VarFileInfo([VarStruct(u'Translation', [0x0409, 1200])])
]
)
"""