Clean up app construction in main entry point
This commit is contained in:
+18
-18
@@ -216,28 +216,28 @@ def main(sysArgs: list | None = None) -> GuiMain | None:
|
|||||||
|
|
||||||
# Import GUI (after dependency checks), and launch
|
# Import GUI (after dependency checks), and launch
|
||||||
from novelwriter.guimain import GuiMain
|
from novelwriter.guimain import GuiMain
|
||||||
|
|
||||||
if testMode:
|
if testMode:
|
||||||
|
# Only used for testing where the test framework creates the app
|
||||||
CONFIG.loadConfig()
|
CONFIG.loadConfig()
|
||||||
nwGUI = GuiMain()
|
return GuiMain()
|
||||||
return nwGUI
|
|
||||||
|
|
||||||
else:
|
app = QApplication([CONFIG.appName, (f"-style={qtStyle}")])
|
||||||
nwApp = QApplication([CONFIG.appName, (f"-style={qtStyle}")])
|
app.setApplicationName(CONFIG.appName)
|
||||||
nwApp.setApplicationName(CONFIG.appName)
|
app.setApplicationVersion(__version__)
|
||||||
nwApp.setApplicationVersion(__version__)
|
app.setOrganizationDomain(__domain__)
|
||||||
nwApp.setOrganizationDomain(__domain__)
|
app.setOrganizationName(__domain__)
|
||||||
nwApp.setOrganizationName(__domain__)
|
app.setDesktopFileName(CONFIG.appName)
|
||||||
nwApp.setDesktopFileName(CONFIG.appName)
|
|
||||||
|
|
||||||
# Connect the exception handler before making the main GUI
|
# Connect the exception handler before making the main GUI
|
||||||
sys.excepthook = exceptionHandler
|
sys.excepthook = exceptionHandler
|
||||||
|
|
||||||
# Run Config steps that require the QApplication
|
# Run Config steps that require the QApplication
|
||||||
CONFIG.loadConfig()
|
CONFIG.loadConfig()
|
||||||
CONFIG.initLocalisation(nwApp)
|
CONFIG.initLocalisation(app)
|
||||||
|
|
||||||
# Launch main GUI
|
# Launch main GUI
|
||||||
nwGUI = GuiMain()
|
nwGUI = GuiMain()
|
||||||
nwGUI.postLaunchTasks(cmdOpen)
|
nwGUI.postLaunchTasks(cmdOpen)
|
||||||
|
|
||||||
sys.exit(nwApp.exec())
|
sys.exit(app.exec())
|
||||||
|
|||||||
Reference in New Issue
Block a user