-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
48 lines (37 loc) · 1.25 KB
/
main.py
File metadata and controls
48 lines (37 loc) · 1.25 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
"""MailProcessor – entry point."""
import sys
from PySide6.QtWidgets import QApplication
from PySide6.QtCore import Qt
import config as cfg_module
from i18n import set_language
def main():
# High-DPI
QApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
)
app = QApplication(sys.argv)
app.setQuitOnLastWindowClosed(False)
app.setApplicationName("MailProcessor")
app.setOrganizationName("lukisch")
cfg = cfg_module.load()
set_language(cfg.language)
if cfg.first_run:
from installer import InstallerWizard
wizard = InstallerWizard(cfg)
result = wizard.exec()
if result != InstallerWizard.DialogCode.Accepted:
sys.exit(0)
# Reload config (wizard saved it)
cfg = cfg_module.load()
set_language(cfg.language)
from tray import MailProcessorTray
tray = MailProcessorTray(cfg)
if not tray.isSystemTrayAvailable():
from PySide6.QtWidgets import QMessageBox
QMessageBox.critical(None, "MailProcessor",
"System Tray ist auf diesem System nicht verfügbar.")
sys.exit(1)
tray.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()