diff --git a/engine/start.py b/engine/start.py index 0cff81f..32eaae9 100644 --- a/engine/start.py +++ b/engine/start.py @@ -126,6 +126,12 @@ else: logger.info("PATHS: {}".format(PATHS)) +from PyQt5.QtWidgets import QApplication +#Construct QAppliction before constantsAndCOnfigs, which has the fontDB +QtGui.QGuiApplication.setDesktopSettingsAware(False) #We need our own font so the user interface stays predictable +QtGui.QGuiApplication.setDesktopFileName(PATHS["desktopfile"]) +qtApp = QApplication(sys.argv) +setPaletteAndFont(qtApp) def exitWithMessage(message:str): @@ -133,12 +139,10 @@ def exitWithMessage(message:str): if sys.stdout.isatty(): sys.exit(title + ": " + message) else: - from PyQt5.QtWidgets import QMessageBox, QApplication - #This is the start file for the Qt client so we know at least that Qt is installed and use that for a warning. - qErrorApp = QApplication(sys.argv) - setPaletteAndFont(qErrorApp) - QMessageBox.critical(qErrorApp.desktop(), title, message) - qErrorApp.quit() + from PyQt5.QtWidgets import QMessageBox + #This is the start file for the Qt client so we know at least that Qt is installed and use that for a warning. + QMessageBox.critical(qtApp.desktop(), title, message) + qtApp.quit() sys.exit(title + ": " + message) def setProcessName(executableName): diff --git a/qtgui/mainwindow.py b/qtgui/mainwindow.py index a04be19..0d5467c 100644 --- a/qtgui/mainwindow.py +++ b/qtgui/mainwindow.py @@ -31,7 +31,7 @@ logger.info(f"PyQt Version: {QtCore.PYQT_VERSION_STR}") #Engine from engine.config import METADATA #includes METADATA only. No other environmental setup is executed. -from engine.start import PATHS +from engine.start import PATHS, qtApp import engine.api as api #This loads the engine and starts a session. #Qt @@ -52,11 +52,6 @@ from .settings import SettingsDialog api.eventLoop = EventLoop() -#Construct QAppliction before constantsAndCOnfigs, which has the fontDB -QtGui.QGuiApplication.setDesktopSettingsAware(False) #We need our own font so the user interface stays predictable -QtGui.QGuiApplication.setDesktopFileName(PATHS["desktopfile"]) -qtApp = QtWidgets.QApplication(sysargv) - #Setup the translator before classes are set up. Otherwise we can't use non-template translation. #to test use LANGUAGE=de_DE.UTF-8 . not LANG= language = QtCore.QLocale().languageToString(QtCore.QLocale().language())