-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch_modern.py
More file actions
65 lines (50 loc) · 1.84 KB
/
launch_modern.py
File metadata and controls
65 lines (50 loc) · 1.84 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
"""
Modern Launcher - Entry point for the new UI
"""
import sys
import os
import argparse
from pathlib import Path
# Add project root to path
sys.path.insert(0, str(Path(__file__).parent))
# Load configuration FIRST (before any imports that use pcfg)
from utils.config import load_config
load_config()
# Import pcfg AFTER load_config to get the initialized value
from utils.config import pcfg
# Now import other modules
from utils import shared
def main():
parser = argparse.ArgumentParser(description='Modern Manga Translator')
parser.add_argument('--proj-dir', default='', type=str, help='Open project directory on startup')
parser.add_argument('--debug', action='store_true', help='Enable debug mode')
args = parser.parse_args()
# Qt imports
from qtpy.QtWidgets import QApplication
from qtpy.QtCore import Qt
from qtpy.QtGui import QFont
# Create application
app = QApplication(sys.argv)
app.setApplicationName("Modern Manga Translator")
app.setApplicationVersion("2.0.0")
# Enable High DPI
if hasattr(Qt, 'AA_EnableHighDpiScaling'):
app.setAttribute(Qt.AA_EnableHighDpiScaling, True)
if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
app.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
# Set default font
font = QFont("Segoe UI", 10)
if not QFont(font).exactMatch():
font = QFont("Microsoft YaHei UI", 10)
app.setFont(font)
# Import main window after config is loaded
from ui.main_window_new import ModernMainWindow
# Set shared paths
shared.PROGRAM_PATH = str(Path(__file__).parent)
shared.LOGGING_PATH = str(Path(__file__).parent / 'logs')
# Create and show main window
window = ModernMainWindow(app, pcfg, open_dir=args.proj_dir)
# Run application
sys.exit(app.exec())
if __name__ == '__main__':
main()