-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
78 lines (67 loc) · 2.12 KB
/
Copy pathapp.py
File metadata and controls
78 lines (67 loc) · 2.12 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
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QPalette, QColor
import sys
import os
import logging
import logging.config
import yaml
from controllers.controller import Controller
from models.model import Model
from views.view import View
def setup_logging(
default_path='resources/logger_config.yaml',
default_level=logging.DEBUG,
env_key='LOG_CFG'
):
"""
Setup logging configuration
"""
path = default_path
value = os.getenv(env_key, None)
if value:
path = value
if os.path.exists(path):
with open(path, 'rt') as f:
config = yaml.safe_load(f.read())
logging.config.dictConfig(config)
else:
logging.basicConfig(level=default_level)
class App(QApplication):
"""
The application
"""
def __init__(self, sys_argv):
super(App, self).__init__(sys_argv)
self.model = Model()
self.controller = Controller(self.model)
self.view = View(self.model, self.controller)
self.view.show()
# self.view.showFullScreen()
self.view.setWindowTitle("App")
def setTheme(app):
"""
Setup app theme
"""
# app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
app.setStyle('Fusion')
palette = QPalette()
palette.setColor(QPalette.Window, QColor(53, 53, 53))
palette.setColor(QPalette.WindowText, Qt.white)
palette.setColor(QPalette.Base, QColor(15,15,15))
palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
palette.setColor(QPalette.ToolTipBase, Qt.white)
palette.setColor(QPalette.ToolTipText, Qt.white)
palette.setColor(QPalette.Text, Qt.white)
palette.setColor(QPalette.Button, QColor(53, 53, 53))
palette.setColor(QPalette.ButtonText, Qt.white)
palette.setColor(QPalette.BrightText, Qt.red)
palette.setColor(QPalette.Highlight, QColor(255, 202, 5).lighter())
palette.setColor(QPalette.HighlightedText, Qt.black)
app.setPalette(palette)
if __name__ == '__main__':
setup_logging()
logger = logging.getLogger(__name__)
app = App(sys.argv)
setTheme(app)
sys.exit(app.exec_())