-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathapp.py
More file actions
51 lines (38 loc) · 1.45 KB
/
Copy pathapp.py
File metadata and controls
51 lines (38 loc) · 1.45 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
import multiprocessing
import os
import sys
from PySide6.QtCore import QCoreApplication, QTranslator
from PySide6.QtGui import QGuiApplication, QIcon
import scihub_eva.resources
from scihub_eva.globals.preferences import APPEARANCE_LANGUAGE_KEY
from scihub_eva.globals.versions import (
APPLICATION_NAME,
ORGANIZATION_DOMAIN,
ORGANIZATION_NAME,
)
from scihub_eva.ui.main import UISciHubEVA
from scihub_eva.utils.path_utils import I18N_DIR, IMAGES_DIR
from scihub_eva.utils.preferences_utils import Preferences
from scihub_eva.utils.sys_utils import SYSTEM_LANGUAGE
from scihub_eva.utils.ui_utils import set_ui_env
def main() -> None:
multiprocessing.freeze_support()
set_ui_env()
QCoreApplication.setOrganizationName(ORGANIZATION_NAME)
QCoreApplication.setOrganizationDomain(ORGANIZATION_DOMAIN)
QCoreApplication.setApplicationName(APPLICATION_NAME)
app = QGuiApplication(sys.argv)
lang = Preferences.get_or_default(APPEARANCE_LANGUAGE_KEY, SYSTEM_LANGUAGE)
lang_file_path = (
(I18N_DIR / 'SciHubEVA_{lang}.qm'.format(lang=lang)).resolve().as_posix()
)
if os.path.exists(lang_file_path):
translator = QTranslator()
translator.load(lang_file_path)
app.installTranslator(translator)
icon_file_path = (IMAGES_DIR / 'SciHubEVA-icon.png').resolve().as_posix()
app.setWindowIcon(QIcon(icon_file_path))
UISciHubEVA()
sys.exit(app.exec())
if __name__ == '__main__':
main()