Projekt

Obecné

Profil

Stáhnout (1.16 KB) Statistiky
| Větev: | Tag: | Revize:
1
import logging
2

    
3
from PyQt5.QtCore import QSettings, QCoreApplication
4
from PyQt5.QtWidgets import QApplication
5

    
6
from aswi2021vochomurka.view.main_view import MainView
7

    
8

    
9
class Application(QApplication):
10
    def __init__(self, sys_argv):
11
        init_logger()
12
        init_settings()
13
        super(Application, self).__init__(sys_argv)
14
        logging.info('App started')
15
        self.main_view = MainView()
16
        self.main_view.show()
17

    
18

    
19
def init_logger():
20
    logging.basicConfig(
21
        level=logging.DEBUG,
22
        filename='data/app.log',
23
        format='%(asctime)s %(name)s: %(levelname)-8s %(message)s',
24
        datefmt='%y-%m-%d %H:%M',
25
        filemode='w+'
26
    )
27

    
28
    formatter = logging.Formatter('%(asctime)s %(name)s: %(levelname)-8s %(message)s')
29
    console = logging.StreamHandler()
30
    console.setFormatter(formatter)
31
    console.setLevel(logging.INFO)
32
    logging.getLogger('').addHandler(console)
33

    
34
    logging.getLogger('apscheduler').setLevel(logging.WARNING)
35
    logging.getLogger('matplotlib').setLevel(logging.WARNING)
36

    
37

    
38
def init_settings():
39
    QSettings.setDefaultFormat(QSettings.IniFormat)
40
    QSettings.setPath(QSettings.IniFormat, QSettings.SystemScope, '.')
(2-2/4)