-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
46 lines (34 loc) · 1.41 KB
/
Copy pathapp.py
File metadata and controls
46 lines (34 loc) · 1.41 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
import sys
from PySide6.QtGui import QFontDatabase, QFont
from PySide6.QtWidgets import QApplication
from lib.components.main_window import MainWindow
from lib.stores.theme_store import theme_store
def main():
app = QApplication(sys.argv)
# Optionally, set environment variables for scaling
theme_store.app = app
app.setApplicationName('App')
app.setApplicationVersion('1.0.0')
# Fonts laden
font_id = QFontDatabase.addApplicationFont("assets/fonts/Roboto-Regular.ttf") # default
QFontDatabase.addApplicationFont("assets/fonts/Roboto-Bold.ttf")
QFontDatabase.addApplicationFont("assets/fonts/Raleway-SemiBold-Light.ttf")
QFontDatabase.addApplicationFont("assets/fonts/Raleway-SemiBold-Regular.ttf")
if font_id != -1: # Check if the font was loaded successfully
family = QFontDatabase.applicationFontFamilies(font_id)[0] # Get the font family name
custom_font = QFont(family)
app.setFont(custom_font) # Apply font globally
else:
print("Failed to load the font!")
# Create and show the main window
main_window = MainWindow()
main_window.show()
sys.exit(app.exec())
if __name__ == "__main__":
# Set DPI Awareness
# Initialize ThemeManager and detect system theme
if theme_store.dark_mode:
sys.argv += ['-platform', 'windows:darkmode=2']
else:
sys.argv += ['-platform', 'windows:darkmode=0']
main()