-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
79 lines (56 loc) · 1.88 KB
/
main.py
File metadata and controls
79 lines (56 loc) · 1.88 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
import sys
from PyQt5.QtWidgets import QApplication, QDialog
from PyQt5.QtGui import QFont
from ui.main_window import MainWindow
def main():
app = QApplication(sys.argv)
# --- Branding Setup ---
import ctypes
myappid = "zoomstudio.zmanager.v2" # Updated for new version
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
from PyQt5.QtGui import QIcon
app.setWindowIcon(QIcon("assets/icon.png"))
# ----------------------
from PyQt5.QtCore import Qt
app.setLayoutDirection(Qt.RightToLeft)
font = QFont("Segoe UI", 10)
app.setFont(font)
# --- Theme Setup ---
try:
from qfluentwidgets import setTheme, Theme
setTheme(Theme.LIGHT)
except ImportError:
print("qfluentwidgets not found. Skipping theme.")
# Ensure Database Tables Exist
from database.database import engine, Base
Base.metadata.create_all(bind=engine)
# --- Splash Screen ---
from ui.splash_screen_new import ModernSplashScreen
splash = ModernSplashScreen()
splash.show()
# Create a local event loop to wait for splash to finish
from PyQt5.QtCore import QEventLoop
loop = QEventLoop()
splash.finished.connect(loop.quit)
loop.exec_()
# ---------------------
while True:
# 1. Login
from ui.login_page_modern import ModernLoginPage
login = ModernLoginPage()
if login.exec_() == QDialog.Accepted:
user_data = login.user_data
# 2. Main Window
window = MainWindow(user_data)
window.show()
app.exec_() # Blocking until window closes
# 3. Check Logout
if window.logout_requested:
continue # Restart loop
else:
break # Exit App
else:
break # Login Cancelled
sys.exit(0)
if __name__ == "__main__":
main()