-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (37 loc) · 1.37 KB
/
Copy pathmain.py
File metadata and controls
50 lines (37 loc) · 1.37 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
import logging
import shutil
import sys
from PySide6 import QtGui
from PySide6.QtWidgets import QApplication, QMessageBox
from utils.environment import Environment
from utils.i18n import Translator
from utils.sentiment import Sentiment
from view.screen_authentification import ScreenAuthentification
def add_fonts():
QtGui.QFontDatabase.addApplicationFont(Environment.resource_path('static/fonts/Junge.ttf'))
QtGui.QFontDatabase.addApplicationFont(Environment.resource_path('static/fonts/Outfit.ttf'))
def try_delete_tmp_dir():
try:
tmp_path = Environment.resource_path('tmp')
shutil.rmtree(tmp_path)
except Exception:
pass
if __name__ == '__main__':
try:
Translator.initialize('pl')
app = QApplication(sys.argv)
add_fonts()
app.setWindowIcon(QtGui.QIcon(Environment.resource_path('static/images/logo.png')))
logging.disable(logging.CRITICAL)
login_screen = ScreenAuthentification()
try:
sentiment = Sentiment()
except Exception as e:
# noinspection PyArgumentList
QMessageBox.critical(None, Translator.translate('WindowTitles.Error'),
Translator.translate('Errors.SentimentModelLoadingError'))
login_screen.show()
app.exec()
try_delete_tmp_dir()
except KeyboardInterrupt:
exit(0)