diff --git a/nw/__init__.py b/nw/__init__.py index d8543237..dd8d2579 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -35,16 +35,16 @@ from PyQt5.QtWidgets import QApplication, QErrorMessage from nw.error import exceptionHandler from nw.config import Config -# +## # Version Scheme # ================ # Generally follows PEP 440 # Hex Version: -# - Digit 1,2 : Major Version (01, 02, 03) -# = Digit 3,4 : Minor Version (01, 09, 10, 99) -# - Digit 5,6 : Patch Version (01, 09, 10, 99) +# - Digit 1,2 : Major Version (01-ff) +# = Digit 3,4 : Minor Version (01-ff) +# - Digit 5,6 : Patch Version (01-ff) # = Digit 7 : Release Type (a: aplha, b: beta, c: candidate, f: final) -# - Digit 8 : Release Number (0-9) +# - Digit 8 : Release Number (0-f) # # Example : Full Short Description # ------------------------------------------------------------------------- @@ -55,7 +55,7 @@ from nw.config import Config # 0x010200f0 : 1.2 1.2 Final release # 0x010200f1 : 1.2-post1 1.2.post1 Post release, but not a code patch! # 0x010201f0 : 1.2.1 1.2.1 Patch release -# +## __package__ = "nw" __copyright__ = "Copyright 2018–2021, Veronica Berglyd Olsen" @@ -79,7 +79,7 @@ __credits__ = [ "Marian Lückhof (contributor, tester)" ] -# +## # Logging # ========= # Standard used for logging levels in novelWriter: @@ -90,7 +90,7 @@ __credits__ = [ # ----------- SPAM Threshold : Output above should be minimal ----------------- # DEBUG Use for descriptions of main program flow # VERBOSE Use for outputting values and program flow details -# +## # Add verbose logging level VERBOSE = 5 @@ -104,10 +104,9 @@ logging.Logger.verbose = logVerbose # Initiating logging logger = logging.getLogger(__name__) -# +## # Main Program -# ============== -# +## # Load the main config as a global object CONFIG = Config() @@ -142,15 +141,14 @@ def main(sysArgs=None): "GNU General Public License for more details.\n" "\n" "Usage:\n" - " -h, --help Print this message.\n" - " -v, --version Print program version and exit.\n" - " --info Print additional runtime information.\n" - " --debug Print debug output. Includes --info.\n" - " --verbose Increase verbosity of debug output. Includes --debug.\n" - " --style= Sets Qt5 style flag. Defaults to 'Fusion'.\n" - " --config= Alternative config file.\n" - " --data= Alternative user data path.\n" - " --testmode Do not display GUI. Used by the test suite.\n" + " -h, --help Print this message.\n" + " -v, --version Print program version and exit.\n" + " --info Print additional runtime information.\n" + " --debug Print debug output. Includes --info.\n" + " --verbose Increase verbosity of debug output. Includes --debug.\n" + " --style= Sets Qt5 style flag. Defaults to 'Fusion'.\n" + " --config= Alternative config file.\n" + " --data= Alternative user data path.\n" ).format( version = __version__, status = __status__, @@ -205,7 +203,6 @@ def main(sysArgs=None): testMode = True # Set Config Options - CONFIG.showGUI = not testMode CONFIG.debugInfo = debugLevel < logging.INFO CONFIG.cmdOpen = cmdOpen @@ -292,7 +289,12 @@ def main(sysArgs=None): # Connect the exception handler before making the main GUI sys.excepthook = exceptionHandler + # Launch main GUI nwGUI = GuiMain() + if not nwGUI.hasProject: + nwGUI.showProjectLoadDialog() + nwGUI.releaseNotes() + sys.exit(nwApp.exec_()) # END Function main diff --git a/nw/config.py b/nw/config.py index c1519f61..61a173f1 100644 --- a/nw/config.py +++ b/nw/config.py @@ -56,7 +56,6 @@ class Config: self.appHandle = self.appName.lower() # Debug Settings - self.showGUI = True # Allow blocking the GUI (disabled for testing) self.debugInfo = False # True if log level is DEBUG or VERBOSE # Config Error Handling diff --git a/nw/guimain.py b/nw/guimain.py index 96657628..e48987bc 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -275,20 +275,10 @@ class GuiMain(QMainWindow): logger.debug("GUI initialisation complete") - # Check if a project path was provided at command line, and if - # not, open the project manager instead. + # If a project path was provided at command line, open it if self.mainConf.cmdOpen is not None: logger.debug("Opening project from additional command line option") self.openProject(self.mainConf.cmdOpen) - else: - if self.mainConf.showGUI: - self.showProjectLoadDialog() - - # Show the latest release notes, if they haven't been shown before - if hexToInt(self.mainConf.lastNotes) < hexToInt(nw.__hexversion__): - if self.mainConf.showGUI: - self.showAboutNWDialog(showNotes=True) - self.mainConf.lastNotes = nw.__hexversion__ logger.debug("novelWriter is ready ...") self.setStatus("novelWriter is ready ...") @@ -322,6 +312,15 @@ class GuiMain(QMainWindow): self.asDocTimer.setInterval(int(self.mainConf.autoSaveDoc*1000)) return True + def releaseNotes(self): + """Determine whether release notes need to be shown, and show + them by calling the About dialog. + """ + if hexToInt(self.mainConf.lastNotes) < hexToInt(nw.__hexversion__): + self.mainConf.lastNotes = nw.__hexversion__ + self.showAboutNWDialog(showNotes=True) + return + ## # Project Actions ## diff --git a/tests/dummy.py b/tests/dummy.py index daf0e070..9a74bb61 100644 --- a/tests/dummy.py +++ b/tests/dummy.py @@ -21,6 +21,9 @@ class DummyMain(): return + def releaseNotes(self): + return + def makeAlert(self, theMessage, theLevel): print("%s: %s" % (str(theLevel), theMessage)) self.lastAlert = str(theMessage)