diff --git a/nw/__init__.py b/nw/__init__.py
index a66a888b..2271157a 100644
--- a/nw/__init__.py
+++ b/nw/__init__.py
@@ -36,7 +36,7 @@ from PyQt5.QtWidgets import QApplication, QErrorMessage
from nw.config import Config
-__package__ = "novelWriter"
+__package__ = "nw"
__author__ = "Veronica Berglyd Olsen"
__copyright__ = "Copyright 2018–2020, Veronica Berglyd Olsen"
__license__ = "GPLv3"
@@ -45,7 +45,7 @@ __hexversion__ = "0x001002f0"
__date__ = "2020-07-29"
__maintainer__ = "Veronica Berglyd Olsen"
__email__ = "code@vkbo.net"
-__status__ = "Pre-Release"
+__status__ = "Beta"
__url__ = "https://github.com/vkbo/novelWriter"
__issuesurl__ = "https://github.com/vkbo/novelWriter/issues"
__domain__ = "novelwriter.io"
@@ -90,7 +90,6 @@ CONFIG = Config()
def main(sysArgs=None):
"""Parses command line, sets up logging, and launches main GUI.
"""
-
if sysArgs is None:
sysArgs = sys.argv[1:]
@@ -111,7 +110,7 @@ def main(sysArgs=None):
]
helpMsg = (
- "{appname} {version} ({status} {date})\n"
+ "novelWriter {version} ({status} {date})\n"
"{copyright}\n"
"\n"
"This program is distributed in the hope that it will be useful,\n"
@@ -132,7 +131,6 @@ def main(sysArgs=None):
" --data= Alternative user data path.\n"
" --testmode Do not display GUI. Used by the test suite.\n"
).format(
- appname = __package__,
version = __version__,
status = __status__,
copyright = __copyright__,
@@ -167,7 +165,9 @@ def main(sysArgs=None):
print(helpMsg)
sys.exit()
elif inOpt in ("-v", "--version"):
- print("%s %s Version %s [%s]" % (__package__,__status__,__version__,__date__))
+ print("novelWriter %s Version %s [%s]" % (
+ __status__, __version__, __date__)
+ )
sys.exit()
elif inOpt == "--info":
debugLevel = logging.INFO
@@ -197,7 +197,7 @@ def main(sysArgs=None):
CONFIG.cmdOpen = cmdOpen
# Set Logging
- logFmt = logging.Formatter(fmt=logFormat, datefmt="%Y-%m-%d %H:%M:%S", style="{")
+ logFmt = logging.Formatter(fmt=logFormat, style="{")
if not logFile == "" and toFile:
if path.isfile(logFile+".bak"):
@@ -217,8 +217,8 @@ def main(sysArgs=None):
logger.addHandler(cHandle)
logger.setLevel(debugLevel)
- logger.info("Starting %s %s (%s) %s" % (
- __package__, __version__, __hexversion__, __date__
+ logger.info("Starting novelWriter %s (%s) %s" % (
+ __version__, __hexversion__, __date__
))
# Check Packages and Versions
@@ -252,10 +252,10 @@ def main(sysArgs=None):
errMsg.setMinimumWidth(500)
errMsg.setMinimumHeight(300)
errMsg.showMessage((
- "ERROR: %s cannot start due to the following issues:
"
+ "ERROR: novelWriter cannot start due to the following issues:
"
" - %s
Exiting."
) % (
- __package__, "
- ".join(errorData)
+ "
- ".join(errorData)
))
errApp.exec_()
sys.exit(1)
@@ -268,13 +268,43 @@ def main(sysArgs=None):
if testMode:
nwGUI = GuiMain()
return nwGUI
+
else:
- nwApp = QApplication([__package__,("-style=%s" % qtStyle)])
- nwApp.setApplicationName(__package__)
+ nwApp = QApplication([CONFIG.appName, ("-style=%s" % qtStyle)])
+ nwApp.setApplicationName(CONFIG.appName)
nwApp.setApplicationVersion(__version__)
nwApp.setWindowIcon(QIcon(CONFIG.appIcon))
- nwApp.setOrganizationDomain("novelwriter.io")
- nwGUI = GuiMain()
- sys.exit(nwApp.exec_())
+ nwApp.setOrganizationDomain(__domain__)
+
+ try:
+ nwGUI = GuiMain()
+ sys.exit(nwApp.exec_())
+
+ except Exception:
+ # novelWriter has crashed!
+ from traceback import print_tb, format_tb
+
+ eInfo = sys.exc_info()
+ logger.critical("%s: %s" % (eInfo[0].__name__, eInfo[1]))
+ print_tb(eInfo[2])
+
+ del nwApp
+
+ errApp = QApplication([])
+ errMsg = QErrorMessage()
+ errMsg.setWindowTitle("Critical Error")
+ errMsg.setMinimumWidth(500)
+ errMsg.setMinimumHeight(300)
+ errMsg.showMessage((
+ "
%s:
%s
Traceback:
%s
Shutting down ...
" + ) % (eInfo[0].__name__, eInfo[1], "{credits:s}
" ).format( - name = nw.__package__, + name = self.mainConf.appName, copyright = nw.__copyright__, website = nw.__url__, domain = nw.__domain__, diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index 84a336eb..43b95385 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -258,7 +258,7 @@ class GuiMainMenu(QMenuBar): # Project > Exit self.aExitNW = QAction("Exit", self) - self.aExitNW.setStatusTip("Exit %s" % nw.__package__) + self.aExitNW.setStatusTip("Exit %s" % self.mainConf.appName) self.aExitNW.setShortcut("Ctrl+Q") self.aExitNW.triggered.connect(self._menuExit) self.projMenu.addAction(self.aExitNW) @@ -804,8 +804,8 @@ class GuiMainMenu(QMenuBar): self.helpMenu = self.addMenu("&Help") # Help > About - self.aAboutNW = QAction("About %s" % nw.__package__, self) - self.aAboutNW.setStatusTip("About %s" % nw.__package__) + self.aAboutNW = QAction("About %s" % self.mainConf.appName, self) + self.aAboutNW.setStatusTip("About %s" % self.mainConf.appName) self.aAboutNW.triggered.connect(self._showAbout) self.helpMenu.addAction(self.aAboutNW) diff --git a/nw/gui/preferences.py b/nw/gui/preferences.py index 0882b089..6bb39033 100644 --- a/nw/gui/preferences.py +++ b/nw/gui/preferences.py @@ -108,7 +108,7 @@ class GuiPreferences(PagedDialog): msgBox = QMessageBox() msgBox.information( self, "Preferences", - "Some changes will not be applied until %s has been restarted." % nw.__package__ + "Some changes will not be applied until novelWriter has been restarted." ) if validEntries: @@ -154,7 +154,7 @@ class GuiConfigEditGeneralTab(QWidget): self.mainForm.addRow( "Main GUI theme", self.selectTheme, - "Changing this requires restarting %s." % nw.__package__ + "Changing this requires restarting novelWriter." ) ## Select Icon Theme @@ -170,7 +170,7 @@ class GuiConfigEditGeneralTab(QWidget): self.mainForm.addRow( "Main icon theme", self.selectIcons, - "Changing this requires restarting %s." % nw.__package__ + "Changing this requires restarting novelWriter." ) ## Dark Icons @@ -193,7 +193,7 @@ class GuiConfigEditGeneralTab(QWidget): self.mainForm.addRow( "Font family", self.guiFont, - "Changing this requires restarting %s." % nw.__package__, + "Changing this requires restarting novelWriter.", theButton = self.fontButton ) @@ -206,7 +206,7 @@ class GuiConfigEditGeneralTab(QWidget): self.mainForm.addRow( "Font size", self.guiFontSize, - "Changing this requires restarting %s." % nw.__package__, + "Changing this requires restarting novelWriter.", theUnit = "pt" ) diff --git a/nw/guimain.py b/nw/guimain.py index f2a4cb3f..6ea48c9b 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -220,7 +220,7 @@ class GuiMain(QMainWindow): else: self.manageProjects() - logger.debug("%s is ready ..." % nw.__package__) + logger.debug("novelWriter is ready ...") return @@ -384,13 +384,13 @@ class GuiMain(QMainWindow): msgBox = QMessageBox() msgRes = msgBox.warning( self, "Project Locked", ( - "The project is already open by another instance of %s, and is " - "therefore locked. Override lock and continue anyway?