Skip to content

Commit

Permalink
Clean up app construction in main entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo committed May 20, 2024
1 parent a6eb951 commit d6b4019
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions novelwriter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,28 +216,28 @@ def main(sysArgs: list | None = None) -> GuiMain | None:

# Import GUI (after dependency checks), and launch
from novelwriter.guimain import GuiMain

if testMode:
# Only used for testing where the test framework creates the app
CONFIG.loadConfig()
nwGUI = GuiMain()
return nwGUI
return GuiMain()

else:
nwApp = QApplication([CONFIG.appName, (f"-style={qtStyle}")])
nwApp.setApplicationName(CONFIG.appName)
nwApp.setApplicationVersion(__version__)
nwApp.setOrganizationDomain(__domain__)
nwApp.setOrganizationName(__domain__)
nwApp.setDesktopFileName(CONFIG.appName)
app = QApplication([CONFIG.appName, (f"-style={qtStyle}")])
app.setApplicationName(CONFIG.appName)
app.setApplicationVersion(__version__)
app.setOrganizationDomain(__domain__)
app.setOrganizationName(__domain__)
app.setDesktopFileName(CONFIG.appName)

# Connect the exception handler before making the main GUI
sys.excepthook = exceptionHandler
# Connect the exception handler before making the main GUI
sys.excepthook = exceptionHandler

# Run Config steps that require the QApplication
CONFIG.loadConfig()
CONFIG.initLocalisation(nwApp)
# Run Config steps that require the QApplication
CONFIG.loadConfig()
CONFIG.initLocalisation(app)

# Launch main GUI
nwGUI = GuiMain()
nwGUI.postLaunchTasks(cmdOpen)
# Launch main GUI
nwGUI = GuiMain()
nwGUI.postLaunchTasks(cmdOpen)

sys.exit(nwApp.exec())
sys.exit(app.exec())

0 comments on commit d6b4019

Please sign in to comment.