Pamhyr2/src/pamhyr.py

46 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os
import locale
from PyQt5.QtCore import QTranslator
from PyQt5.QtWidgets import QApplication
from config import Config
from View.MainWindow import ApplicationWindow
from Model.Study import Study
def main():
conf = Config.load()
app = QApplication(sys.argv)
translator = QTranslator()
lang_file = ""
if conf.lang == "":
# System language
sys_lang = locale.getdefaultlocale()
if "fr" in sys_lang[0]:
lang_file = os.path.dirname(__file__) + "/lang/fr.qm"
elif conf.lang == "fr":
# French
lang_file = os.path.dirname(__file__) + "/lang/fr.qm"
else:
lang_file = ""
# English default language
if lang_file != "":
ok = translator.load(lang_file)
if not ok:
print("failed")
app.installTranslator(translator)
application = ApplicationWindow(conf=conf)
application.show()
sys.exit(int(app.exec_()))
if __name__ == "__main__":
main()