-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathmain.py
executable file
·40 lines (30 loc) · 1.3 KB
/
main.py
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
#! .venv/bin/python3
# Copyright 2023-2024, by Julien Cegarra & Benoît Valéry. All rights reserved.
# Institut National Universitaire Champollion (Albi, France).
# License : CeCILL, version 2.1 (see the LICENSE file)
import gettext, sys
from pathlib import Path
# Read and install the specified language iso
# The LOCALE_PATH constant can't be set into constants.py because
# the latter must be translated itself
LOCALE_PATH = Path('.', 'locales')
# Only language is accessed manually from the config.ini to avoid circular imports
# (i.e., utils needing translation needing utils and so on)
language_iso = [l for l in open('config.ini', 'r').readlines()
if 'language=' in l][0].split('=')[-1].strip()
language = gettext.translation('openmatb', LOCALE_PATH, [language_iso])
language.install()
# Only after language installation, import core modules (they must be translated)
from core import Scheduler, ReplayScheduler
from core.constants import REPLAY_MODE
from core.window import Window
class OpenMATB:
def __init__(self):
# The MATB window must be borderless (for non-fullscreen mode)
Window(style=Window.WINDOW_STYLE_DIALOG, resizable = True)
if REPLAY_MODE:
ReplayScheduler()
else:
Scheduler()
if __name__ == '__main__':
app = OpenMATB()