-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (34 loc) · 1.61 KB
/
app.py
File metadata and controls
38 lines (34 loc) · 1.61 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
"""Pythonator - Python Bot Runner."""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from PyQt6.QtGui import QIcon, QColor, QPalette
from PyQt6.QtWidgets import QApplication, QStyleFactory
from config import STYLE
from main_window import MainWindow
def dark_palette() -> QPalette:
pal = QPalette()
dark, darker, light, mid, accent = QColor(24,24,24), QColor(18,18,18), QColor(220,220,220), QColor(35,35,35), QColor(70,130,220)
for role, color in [(QPalette.ColorRole.Window, dark), (QPalette.ColorRole.WindowText, light),
(QPalette.ColorRole.Base, darker), (QPalette.ColorRole.AlternateBase, dark), (QPalette.ColorRole.Text, light),
(QPalette.ColorRole.Button, mid), (QPalette.ColorRole.ButtonText, light),
(QPalette.ColorRole.Highlight, accent), (QPalette.ColorRole.HighlightedText, QColor(255,255,255)),
(QPalette.ColorRole.ToolTipBase, dark), (QPalette.ColorRole.ToolTipText, light),
(QPalette.ColorRole.Link, accent), (QPalette.ColorRole.LinkVisited, QColor(180,130,220)),
(QPalette.ColorRole.PlaceholderText, QColor(128,128,128))]:
pal.setColor(role, color)
return pal
def main() -> int:
app = QApplication(sys.argv)
app.setStyle(QStyleFactory.create("Fusion"))
app.setPalette(dark_palette())
font = app.font(); font.setPointSize(10); app.setFont(font)
app.setStyleSheet(STYLE)
try: app.setWindowIcon(QIcon("icon.ico"))
except: pass
window = MainWindow()
try: window.setWindowIcon(QIcon("icon.ico"))
except: pass
window.show()
return app.exec()
if __name__ == "__main__":
sys.exit(main())