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