Remove verbose logging (#1191)
This commit is contained in:
@@ -72,32 +72,6 @@ __helpurl__ = "https://github.com/vkbo/novelWriter/discussions"
|
|||||||
__releaseurl__ = "https://github.com/vkbo/novelWriter/releases/latest"
|
__releaseurl__ = "https://github.com/vkbo/novelWriter/releases/latest"
|
||||||
__docurl__ = "https://novelwriter.readthedocs.io"
|
__docurl__ = "https://novelwriter.readthedocs.io"
|
||||||
|
|
||||||
##
|
|
||||||
# Logging
|
|
||||||
# =========
|
|
||||||
# Standard used for logging levels in novelWriter:
|
|
||||||
# CRITICAL Use for errors that result in termination of the program
|
|
||||||
# ERROR Use when an action fails, but execution continues
|
|
||||||
# WARNING When something unexpected, but non-critical happens
|
|
||||||
# INFO Any useful user information like open, save, exit initiated
|
|
||||||
# ----------- 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
|
|
||||||
logging.addLevelName(VERBOSE, "VERBOSE")
|
|
||||||
|
|
||||||
|
|
||||||
def logVerbose(self, message, *args, **kws):
|
|
||||||
if self.isEnabledFor(VERBOSE):
|
|
||||||
self._log(VERBOSE, message, args, **kws)
|
|
||||||
|
|
||||||
|
|
||||||
logging.Logger.verbose = logVerbose
|
|
||||||
|
|
||||||
# Initiating logging
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -122,7 +96,6 @@ def main(sysArgs=None):
|
|||||||
"version",
|
"version",
|
||||||
"info",
|
"info",
|
||||||
"debug",
|
"debug",
|
||||||
"verbose",
|
|
||||||
"style=",
|
"style=",
|
||||||
"config=",
|
"config=",
|
||||||
"data=",
|
"data=",
|
||||||
@@ -143,7 +116,6 @@ def main(sysArgs=None):
|
|||||||
" -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"
|
|
||||||
" --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"
|
||||||
@@ -181,9 +153,6 @@ def main(sysArgs=None):
|
|||||||
elif inOpt == "--debug":
|
elif inOpt == "--debug":
|
||||||
logLevel = logging.DEBUG
|
logLevel = logging.DEBUG
|
||||||
logFormat = "[{asctime:}] {filename:>17}:{lineno:<4d} {levelname:8} {message:}"
|
logFormat = "[{asctime:}] {filename:>17}:{lineno:<4d} {levelname:8} {message:}"
|
||||||
elif inOpt == "--verbose":
|
|
||||||
logLevel = VERBOSE
|
|
||||||
logFormat = "[{asctime:}] {filename:>17}:{lineno:<4d} {levelname:8} {message:}"
|
|
||||||
elif inOpt == "--style":
|
elif inOpt == "--style":
|
||||||
qtStyle = inArg
|
qtStyle = inArg
|
||||||
elif inOpt == "--config":
|
elif inOpt == "--config":
|
||||||
|
|||||||
@@ -291,8 +291,8 @@ class Config:
|
|||||||
self.nwLangPath = os.path.join(self.assetPath, "i18n")
|
self.nwLangPath = os.path.join(self.assetPath, "i18n")
|
||||||
|
|
||||||
logger.debug("Assets: %s", self.assetPath)
|
logger.debug("Assets: %s", self.assetPath)
|
||||||
logger.verbose("App path: %s", self.appPath)
|
logger.debug("App path: %s", self.appPath)
|
||||||
logger.verbose("Last path: %s", self.lastPath)
|
logger.debug("Last path: %s", self.lastPath)
|
||||||
|
|
||||||
# If the config and data folders don't not exist, create them
|
# If the config and data folders don't not exist, create them
|
||||||
# This assumes that the os config and data folders exist
|
# This assumes that the os config and data folders exist
|
||||||
@@ -704,7 +704,7 @@ class Config:
|
|||||||
"""
|
"""
|
||||||
if thePath in self.recentProj:
|
if thePath in self.recentProj:
|
||||||
del self.recentProj[thePath]
|
del self.recentProj[thePath]
|
||||||
logger.verbose("Removed recent: %s", thePath)
|
logger.debug("Removed recent: %s", thePath)
|
||||||
self.saveRecentCache()
|
self.saveRecentCache()
|
||||||
else:
|
else:
|
||||||
logger.error("Unknown recent: %s", thePath)
|
logger.error("Unknown recent: %s", thePath)
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class NWIndex:
|
|||||||
|
|
||||||
self._indexChange = round(time())
|
self._indexChange = round(time())
|
||||||
|
|
||||||
logger.verbose("Index loaded in %.3f ms", (time() - tStart)*1000)
|
logger.debug("Index loaded in %.3f ms", (time() - tStart)*1000)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ class NWIndex:
|
|||||||
logException()
|
logException()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.verbose("Index saved in %.3f ms", (time() - tStart)*1000)
|
logger.debug("Index saved in %.3f ms", (time() - tStart)*1000)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ class NWIndex:
|
|||||||
# Prune no longer used tags
|
# Prune no longer used tags
|
||||||
for tTag, isActive in itemTags.items():
|
for tTag, isActive in itemTags.items():
|
||||||
if not isActive:
|
if not isActive:
|
||||||
logger.verbose("Deleting removed tag '%s'", tTag)
|
logger.debug("Deleting removed tag '%s'", tTag)
|
||||||
del self._tagsIndex[tTag]
|
del self._tagsIndex[tTag]
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ class NWProject:
|
|||||||
|
|
||||||
legacyList = [] # Cleanup is done later
|
legacyList = [] # Cleanup is done later
|
||||||
for projItem in os.listdir(self.projPath):
|
for projItem in os.listdir(self.projPath):
|
||||||
logger.verbose("Project contains: %s", projItem)
|
logger.debug("Project contains: %s", projItem)
|
||||||
if projItem.startswith("data_") and len(projItem) == 6:
|
if projItem.startswith("data_") and len(projItem) == 6:
|
||||||
legacyList.append(projItem)
|
legacyList.append(projItem)
|
||||||
|
|
||||||
@@ -474,7 +474,7 @@ class NWProject:
|
|||||||
self.clearProject()
|
self.clearProject()
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
logger.verbose("Project is not locked")
|
logger.debug("Project is not locked")
|
||||||
|
|
||||||
# Open The Project XML File
|
# Open The Project XML File
|
||||||
# =========================
|
# =========================
|
||||||
@@ -511,8 +511,8 @@ class NWProject:
|
|||||||
hexVersion = xRoot.attrib.get("hexVersion", "0x0")
|
hexVersion = xRoot.attrib.get("hexVersion", "0x0")
|
||||||
fileVersion = xRoot.attrib.get("fileVersion", self.tr("Unknown"))
|
fileVersion = xRoot.attrib.get("fileVersion", self.tr("Unknown"))
|
||||||
|
|
||||||
logger.verbose("XML root is '%s'", nwxRoot)
|
logger.debug("XML root is '%s'", nwxRoot)
|
||||||
logger.verbose("File version is '%s'", fileVersion)
|
logger.debug("File version is '%s'", fileVersion)
|
||||||
|
|
||||||
# Check File Type
|
# Check File Type
|
||||||
# ===============
|
# ===============
|
||||||
@@ -594,15 +594,15 @@ class NWProject:
|
|||||||
continue
|
continue
|
||||||
if xItem.tag == "name":
|
if xItem.tag == "name":
|
||||||
self.projName = simplified(checkString(xItem.text, ""))
|
self.projName = simplified(checkString(xItem.text, ""))
|
||||||
logger.verbose("Working Title: '%s'", self.projName)
|
logger.info("Project Name: '%s'", self.projName)
|
||||||
elif xItem.tag == "title":
|
elif xItem.tag == "title":
|
||||||
self.bookTitle = simplified(checkString(xItem.text, ""))
|
self.bookTitle = simplified(checkString(xItem.text, ""))
|
||||||
logger.verbose("Title is '%s'", self.bookTitle)
|
logger.info("Project Title: '%s'", self.bookTitle)
|
||||||
elif xItem.tag == "author":
|
elif xItem.tag == "author":
|
||||||
author = simplified(checkString(xItem.text, ""))
|
author = simplified(checkString(xItem.text, ""))
|
||||||
if author:
|
if author:
|
||||||
self.bookAuthors.append(author)
|
self.bookAuthors.append(author)
|
||||||
logger.verbose("Author: '%s'", author)
|
logger.debug("Author: '%s'", author)
|
||||||
elif xItem.tag == "saveCount":
|
elif xItem.tag == "saveCount":
|
||||||
self.saveCount = checkInt(xItem.text, 0)
|
self.saveCount = checkInt(xItem.text, 0)
|
||||||
elif xItem.tag == "autoCount":
|
elif xItem.tag == "autoCount":
|
||||||
@@ -680,7 +680,7 @@ class NWProject:
|
|||||||
# Check the project tree consistency
|
# Check the project tree consistency
|
||||||
for tItem in self._projTree:
|
for tItem in self._projTree:
|
||||||
tHandle = tItem.itemHandle
|
tHandle = tItem.itemHandle
|
||||||
logger.verbose("Checking item '%s'", tHandle)
|
logger.debug("Checking item '%s'", tHandle)
|
||||||
if not self._projTree.updateItemData(tHandle):
|
if not self._projTree.updateItemData(tHandle):
|
||||||
logger.error("There was a problem item '%s', and it has been removed", tHandle)
|
logger.error("There was a problem item '%s', and it has been removed", tHandle)
|
||||||
del self._projTree[tHandle] # The file will be re-added as orphaned
|
del self._projTree[tHandle] # The file will be re-added as orphaned
|
||||||
|
|||||||
@@ -89,20 +89,20 @@ class NWTree:
|
|||||||
logger.warning("Duplicate handle '%s' detected, skipping", tHandle)
|
logger.warning("Duplicate handle '%s' detected, skipping", tHandle)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.verbose("Adding item '%s' with parent '%s'", str(tHandle), str(pHandle))
|
logger.debug("Adding item '%s' with parent '%s'", str(tHandle), str(pHandle))
|
||||||
|
|
||||||
nwItem.setHandle(tHandle)
|
nwItem.setHandle(tHandle)
|
||||||
nwItem.setParent(pHandle)
|
nwItem.setParent(pHandle)
|
||||||
|
|
||||||
if nwItem.isRootType():
|
if nwItem.isRootType():
|
||||||
logger.verbose("Item '%s' is a root item", str(tHandle))
|
logger.debug("Item '%s' is a root item", str(tHandle))
|
||||||
self._treeRoots[tHandle] = nwItem
|
self._treeRoots[tHandle] = nwItem
|
||||||
if nwItem.itemClass == nwItemClass.ARCHIVE:
|
if nwItem.itemClass == nwItemClass.ARCHIVE:
|
||||||
logger.verbose("Item '%s' is the archive folder", str(tHandle))
|
logger.debug("Item '%s' is the archive folder", str(tHandle))
|
||||||
self._archRoot = tHandle
|
self._archRoot = tHandle
|
||||||
elif nwItem.itemClass == nwItemClass.TRASH:
|
elif nwItem.itemClass == nwItemClass.TRASH:
|
||||||
if self._trashRoot is None:
|
if self._trashRoot is None:
|
||||||
logger.verbose("Item '%s' is the trash folder", str(tHandle))
|
logger.debug("Item '%s' is the trash folder", str(tHandle))
|
||||||
self._trashRoot = tHandle
|
self._trashRoot = tHandle
|
||||||
else:
|
else:
|
||||||
logger.error("Only one trash folder allowed")
|
logger.error("Only one trash folder allowed")
|
||||||
@@ -349,7 +349,7 @@ class NWTree:
|
|||||||
# Save the temp list
|
# Save the temp list
|
||||||
self._treeOrder = tmpOrder
|
self._treeOrder = tmpOrder
|
||||||
self._setTreeChanged(True)
|
self._setTreeChanged(True)
|
||||||
logger.verbose("Project tree order updated")
|
logger.debug("Project tree order updated")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ class NWTree:
|
|||||||
"""Generate a unique item handle. In the event that the key
|
"""Generate a unique item handle. In the event that the key
|
||||||
already exists, generate a new one.
|
already exists, generate a new one.
|
||||||
"""
|
"""
|
||||||
logger.verbose("Generating new handle")
|
logger.debug("Generating new handle")
|
||||||
handle = f"{random.getrandbits(52):013x}"
|
handle = f"{random.getrandbits(52):013x}"
|
||||||
if handle in self._projTree:
|
if handle in self._projTree:
|
||||||
logger.warning("Duplicate handle encountered! Retrying ...")
|
logger.warning("Duplicate handle encountered! Retrying ...")
|
||||||
|
|||||||
@@ -267,8 +267,8 @@ class QSwitch(QAbstractButton):
|
|||||||
return self._offset
|
return self._offset
|
||||||
|
|
||||||
@offset.setter
|
@offset.setter
|
||||||
def offset(self, theOffset):
|
def offset(self, offset):
|
||||||
self._offset = theOffset
|
self._offset = offset
|
||||||
self.update()
|
self.update()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -276,11 +276,11 @@ class QSwitch(QAbstractButton):
|
|||||||
# Getters and Setters
|
# Getters and Setters
|
||||||
##
|
##
|
||||||
|
|
||||||
def setChecked(self, isChecked):
|
def setChecked(self, checked):
|
||||||
"""Overload setChecked to also alter the offset.
|
"""Overload setChecked to also alter the offset.
|
||||||
"""
|
"""
|
||||||
super().setChecked(isChecked)
|
super().setChecked(checked)
|
||||||
if isChecked:
|
if checked:
|
||||||
self.offset = self._xW - self._xR
|
self.offset = self._xW - self._xR
|
||||||
else:
|
else:
|
||||||
self.offset = self._xR
|
self.offset = self._xR
|
||||||
@@ -290,10 +290,10 @@ class QSwitch(QAbstractButton):
|
|||||||
# Events
|
# Events
|
||||||
##
|
##
|
||||||
|
|
||||||
def resizeEvent(self, theEvent):
|
def resizeEvent(self, event):
|
||||||
"""Overload resize to ensure correct offset.
|
"""Overload resize to ensure correct offset.
|
||||||
"""
|
"""
|
||||||
super().resizeEvent(theEvent)
|
super().resizeEvent(event)
|
||||||
if self.isChecked():
|
if self.isChecked():
|
||||||
self.offset = self._xW - self._xR
|
self.offset = self._xW - self._xR
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ class GuiDocSplit(QDialog):
|
|||||||
|
|
||||||
onLine = -1
|
onLine = -1
|
||||||
hLevel = 0
|
hLevel = 0
|
||||||
|
hLabel = aLine.strip()
|
||||||
if aLine.startswith("# ") and spLevel >= 1:
|
if aLine.startswith("# ") and spLevel >= 1:
|
||||||
onLine = lineNo
|
onLine = lineNo
|
||||||
hLevel = 1
|
hLevel = 1
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ class GuiProjectLoad(QDialog):
|
|||||||
def _doOpenRecent(self):
|
def _doOpenRecent(self):
|
||||||
"""Close the dialog window with a recent project selected.
|
"""Close the dialog window with a recent project selected.
|
||||||
"""
|
"""
|
||||||
logger.verbose("GuiProjectLoad open button clicked")
|
|
||||||
self._saveSettings()
|
self._saveSettings()
|
||||||
|
|
||||||
self.openPath = None
|
self.openPath = None
|
||||||
@@ -183,7 +182,6 @@ class GuiProjectLoad(QDialog):
|
|||||||
def _doBrowse(self):
|
def _doBrowse(self):
|
||||||
"""Browse for a folder path.
|
"""Browse for a folder path.
|
||||||
"""
|
"""
|
||||||
logger.verbose("GuiProjectLoad browse button clicked")
|
|
||||||
extFilter = [
|
extFilter = [
|
||||||
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
|
self.tr("novelWriter Project File ({0})").format(nwFiles.PROJ_FILE),
|
||||||
self.tr("All files ({0})").format("*"),
|
self.tr("All files ({0})").format("*"),
|
||||||
@@ -203,7 +201,6 @@ class GuiProjectLoad(QDialog):
|
|||||||
def _doCancel(self):
|
def _doCancel(self):
|
||||||
"""Close the dialog window without doing anything.
|
"""Close the dialog window without doing anything.
|
||||||
"""
|
"""
|
||||||
logger.verbose("GuiProjectLoad close button clicked")
|
|
||||||
self.openPath = None
|
self.openPath = None
|
||||||
self.openState = self.NONE_STATE
|
self.openState = self.NONE_STATE
|
||||||
self.close()
|
self.close()
|
||||||
@@ -212,7 +209,6 @@ class GuiProjectLoad(QDialog):
|
|||||||
def _doNewProject(self):
|
def _doNewProject(self):
|
||||||
"""Create a new project.
|
"""Create a new project.
|
||||||
"""
|
"""
|
||||||
logger.verbose("GuiProjectLoad new project button clicked")
|
|
||||||
self._saveSettings()
|
self._saveSettings()
|
||||||
self.openPath = None
|
self.openPath = None
|
||||||
self.openState = self.NEW_STATE
|
self.openState = self.NEW_STATE
|
||||||
|
|||||||
@@ -96,8 +96,6 @@ class GuiProjectSettings(PagedDialog):
|
|||||||
def _doSave(self):
|
def _doSave(self):
|
||||||
"""Save settings and close dialog.
|
"""Save settings and close dialog.
|
||||||
"""
|
"""
|
||||||
logger.verbose("GuiProjectSettings save button clicked")
|
|
||||||
|
|
||||||
projName = self.tabMain.editName.text()
|
projName = self.tabMain.editName.text()
|
||||||
bookTitle = self.tabMain.editTitle.text()
|
bookTitle = self.tabMain.editTitle.text()
|
||||||
bookAuthors = self.tabMain.editAuthors.toPlainText()
|
bookAuthors = self.tabMain.editAuthors.toPlainText()
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ def logException():
|
|||||||
"""Log the content of an exception message.
|
"""Log the content of an exception message.
|
||||||
"""
|
"""
|
||||||
exType, exValue, _ = sys.exc_info()
|
exType, exValue, _ = sys.exc_info()
|
||||||
logger.error("%s: %s", exType.__name__, str(exValue))
|
if exType is not None:
|
||||||
|
logger.error("%s: %s", exType.__name__, str(exValue))
|
||||||
|
|
||||||
|
|
||||||
def formatException(exc):
|
def formatException(exc):
|
||||||
@@ -131,7 +132,7 @@ class NWErrorMessage(QDialog):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import lxml
|
import lxml
|
||||||
lxmlVersion = lxml.__version__
|
lxmlVersion = lxml.__version__ # type: ignore
|
||||||
except Exception:
|
except Exception:
|
||||||
lxmlVersion = "Unknown"
|
lxmlVersion = "Unknown"
|
||||||
|
|
||||||
|
|||||||
@@ -664,7 +664,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
if theBlock:
|
if theBlock:
|
||||||
self.setCursorPosition(theBlock.position())
|
self.setCursorPosition(theBlock.position())
|
||||||
self.docFooter.updateLineCount()
|
self.docFooter.updateLineCount()
|
||||||
logger.verbose("Cursor moved to line %d", theLine)
|
logger.debug("Cursor moved to line %d", theLine)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -718,7 +718,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
if not self._bigDoc:
|
if not self._bigDoc:
|
||||||
self.spellCheckDocument()
|
self.spellCheckDocument()
|
||||||
|
|
||||||
logger.verbose("Spell check is set to '%s'", str(theMode))
|
logger.debug("Spell check is set to '%s'", str(theMode))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -728,7 +728,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
of Qt 5.13, is to clear the text and put it back. This clears
|
of Qt 5.13, is to clear the text and put it back. This clears
|
||||||
the undo stack, so we only do it for big documents.
|
the undo stack, so we only do it for big documents.
|
||||||
"""
|
"""
|
||||||
logger.verbose("Running spell checker")
|
logger.debug("Running spell checker")
|
||||||
if self._spellCheck:
|
if self._spellCheck:
|
||||||
bfTime = time()
|
bfTime = time()
|
||||||
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
|
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||||
@@ -763,7 +763,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
logger.error("Not a document action")
|
logger.error("Not a document action")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.verbose("Requesting action: %s", theAction.name)
|
logger.debug("Requesting action: %s", theAction.name)
|
||||||
|
|
||||||
self._allowAutoReplace(False)
|
self._allowAutoReplace(False)
|
||||||
if theAction == nwDocAction.UNDO:
|
if theAction == nwDocAction.UNDO:
|
||||||
@@ -944,7 +944,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
logger.error("Invalid keyword '%s'", keyWord)
|
logger.error("Invalid keyword '%s'", keyWord)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.verbose("Inserting keyword '%s'", keyWord)
|
logger.debug("Inserting keyword '%s'", keyWord)
|
||||||
theState = self.insertNewBlock("%s: " % keyWord)
|
theState = self.insertNewBlock("%s: " % keyWord)
|
||||||
|
|
||||||
return theState
|
return theState
|
||||||
@@ -1172,7 +1172,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
spellCheck &= theWord != ""
|
spellCheck &= theWord != ""
|
||||||
|
|
||||||
if spellCheck:
|
if spellCheck:
|
||||||
logger.verbose("Looking up '%s' in the dictionary", theWord)
|
logger.debug("Looking up '%s' in the dictionary", theWord)
|
||||||
spellCheck &= not self.spEnchant.checkWord(theWord)
|
spellCheck &= not self.spEnchant.checkWord(theWord)
|
||||||
|
|
||||||
if spellCheck:
|
if spellCheck:
|
||||||
@@ -1238,11 +1238,11 @@ class GuiDocEditor(QTextEdit):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if self.wCounterDoc.isRunning():
|
if self.wCounterDoc.isRunning():
|
||||||
logger.verbose("Word counter is busy")
|
logger.debug("Word counter is busy")
|
||||||
return
|
return
|
||||||
|
|
||||||
if time() - self._lastEdit < 5 * self.wcInterval:
|
if time() - self._lastEdit < 5 * self.wcInterval:
|
||||||
logger.verbose("Running word counter")
|
logger.debug("Running word counter")
|
||||||
self.mainGui.threadPool.start(self.wCounterDoc)
|
self.mainGui.threadPool.start(self.wCounterDoc)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -1254,7 +1254,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
if self._docHandle is None or self._nwItem is None:
|
if self._docHandle is None or self._nwItem is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.verbose("Updating word count")
|
logger.debug("Updating word count")
|
||||||
|
|
||||||
self._charCount = cCount
|
self._charCount = cCount
|
||||||
self._wordCount = wCount
|
self._wordCount = wCount
|
||||||
@@ -1297,7 +1297,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if self.wCounterSel.isRunning():
|
if self.wCounterSel.isRunning():
|
||||||
logger.verbose("Selection word counter is busy")
|
logger.debug("Selection word counter is busy")
|
||||||
return
|
return
|
||||||
|
|
||||||
self.mainGui.threadPool.start(self.wCounterSel)
|
self.mainGui.threadPool.start(self.wCounterSel)
|
||||||
@@ -1311,7 +1311,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
if self._docHandle is None or self._nwItem is None:
|
if self._docHandle is None or self._nwItem is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.verbose("User selectee %d words", wCount)
|
logger.debug("User selectee %d words", wCount)
|
||||||
self.docFooter.updateCounts(wCount=wCount, cCount=cCount)
|
self.docFooter.updateCounts(wCount=wCount, cCount=cCount)
|
||||||
self.wcTimerSel.stop()
|
self.wcTimerSel.stop()
|
||||||
|
|
||||||
@@ -1329,11 +1329,11 @@ class GuiDocEditor(QTextEdit):
|
|||||||
QPointF(theSize.width(), theSize.height()), Qt.FuzzyHit
|
QPointF(theSize.width(), theSize.height()), Qt.FuzzyHit
|
||||||
)
|
)
|
||||||
if self._queuePos <= thePos:
|
if self._queuePos <= thePos:
|
||||||
logger.verbose("Allowed cursor move to %d <= %d", self._queuePos, thePos)
|
logger.debug("Allowed cursor move to %d <= %d", self._queuePos, thePos)
|
||||||
self.setCursorPosition(self._queuePos)
|
self.setCursorPosition(self._queuePos)
|
||||||
self._queuePos = None
|
self._queuePos = None
|
||||||
else:
|
else:
|
||||||
logger.verbose("Denied cursor move to %d > %d", self._queuePos, thePos)
|
logger.debug("Denied cursor move to %d > %d", self._queuePos, thePos)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1520,7 +1520,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
theCursor.endEditBlock()
|
theCursor.endEditBlock()
|
||||||
theCursor.setPosition(theCursor.selectionEnd())
|
theCursor.setPosition(theCursor.selectionEnd())
|
||||||
self.setTextCursor(theCursor)
|
self.setTextCursor(theCursor)
|
||||||
logger.verbose(
|
logger.debug(
|
||||||
"Replaced occurrence of '%s' with '%s' on line %d",
|
"Replaced occurrence of '%s' with '%s' on line %d",
|
||||||
searchFor, replWith, theCursor.blockNumber()
|
searchFor, replWith, theCursor.blockNumber()
|
||||||
)
|
)
|
||||||
@@ -1898,10 +1898,10 @@ class GuiDocEditor(QTextEdit):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if loadTag:
|
if loadTag:
|
||||||
logger.verbose("Attempting to follow tag '%s'", theWord)
|
logger.debug("Attempting to follow tag '%s'", theWord)
|
||||||
self.loadDocumentTagRequest.emit(theWord, nwDocMode.VIEW)
|
self.loadDocumentTagRequest.emit(theWord, nwDocMode.VIEW)
|
||||||
else:
|
else:
|
||||||
logger.verbose("Potential tag '%s'", theWord)
|
logger.debug("Potential tag '%s'", theWord)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -2431,7 +2431,6 @@ class GuiDocEditSearch(QFrame):
|
|||||||
self.searchBox.selectAll()
|
self.searchBox.selectAll()
|
||||||
if self.isRegEx:
|
if self.isRegEx:
|
||||||
self._alertSearchValid(True)
|
self._alertSearchValid(True)
|
||||||
logger.verbose("Setting search text to '%s'", theText)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def setReplaceText(self, theText):
|
def setReplaceText(self, theText):
|
||||||
@@ -2945,7 +2944,7 @@ class GuiDocEditFooter(QWidget):
|
|||||||
"""
|
"""
|
||||||
self._docHandle = tHandle
|
self._docHandle = tHandle
|
||||||
if self._docHandle is None:
|
if self._docHandle is None:
|
||||||
logger.verbose("No handle set, so clearing the editor footer")
|
logger.debug("No handle set, so clearing the editor footer")
|
||||||
self._theItem = None
|
self._theItem = None
|
||||||
else:
|
else:
|
||||||
self._theItem = self.theProject.tree[self._docHandle]
|
self._theItem = self.theProject.tree[self._docHandle]
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
"""Wrapper function for various document actions on the current
|
"""Wrapper function for various document actions on the current
|
||||||
document.
|
document.
|
||||||
"""
|
"""
|
||||||
logger.verbose("Requesting action: '%s'", theAction.name)
|
logger.debug("Requesting action: '%s'", theAction.name)
|
||||||
if self._docHandle is None:
|
if self._docHandle is None:
|
||||||
logger.error("No document open")
|
logger.error("No document open")
|
||||||
return False
|
return False
|
||||||
@@ -264,7 +264,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
if not isinstance(tAnchor, str):
|
if not isinstance(tAnchor, str):
|
||||||
return False
|
return False
|
||||||
if tAnchor.startswith("#"):
|
if tAnchor.startswith("#"):
|
||||||
logger.verbose("Moving to anchor '%s'", tAnchor)
|
logger.debug("Moving to anchor '%s'", tAnchor)
|
||||||
self.setSource(QUrl(tAnchor))
|
self.setSource(QUrl(tAnchor))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
theBlock = self.document().findBlockByLineNumber(theLine)
|
theBlock = self.document().findBlockByLineNumber(theLine)
|
||||||
if theBlock:
|
if theBlock:
|
||||||
self.setCursorPosition(theBlock.position())
|
self.setCursorPosition(theBlock.position())
|
||||||
logger.verbose("Cursor moved to line %d", theLine)
|
logger.debug("Cursor moved to line %d", theLine)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def setScrollPosition(self, thePos):
|
def setScrollPosition(self, thePos):
|
||||||
@@ -396,7 +396,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
"""Process a clicked link internally in the document.
|
"""Process a clicked link internally in the document.
|
||||||
"""
|
"""
|
||||||
theLink = theURL.url()
|
theLink = theURL.url()
|
||||||
logger.verbose("Clicked link: '%s'", theLink)
|
logger.debug("Clicked link: '%s'", theLink)
|
||||||
if len(theLink) > 0:
|
if len(theLink) > 0:
|
||||||
theBits = theLink.split("=")
|
theBits = theLink.split("=")
|
||||||
if len(theBits) == 2:
|
if len(theBits) == 2:
|
||||||
@@ -578,7 +578,7 @@ class GuiDocViewHistory:
|
|||||||
def clear(self):
|
def clear(self):
|
||||||
"""Clear the view history.
|
"""Clear the view history.
|
||||||
"""
|
"""
|
||||||
logger.verbose("View history cleared")
|
logger.debug("View history cleared")
|
||||||
self._navHistory = []
|
self._navHistory = []
|
||||||
self._posHistory = []
|
self._posHistory = []
|
||||||
self._currPos = -1
|
self._currPos = -1
|
||||||
@@ -592,7 +592,7 @@ class GuiDocViewHistory:
|
|||||||
"""
|
"""
|
||||||
if self._currPos >= 0 and self._currPos < len(self._navHistory):
|
if self._currPos >= 0 and self._currPos < len(self._navHistory):
|
||||||
if tHandle == self._navHistory[self._currPos]:
|
if tHandle == self._navHistory[self._currPos]:
|
||||||
logger.verbose("Not updating view hsitory")
|
logger.debug("Not updating view hsitory")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self._truncateHistory(self._currPos)
|
self._truncateHistory(self._currPos)
|
||||||
@@ -607,7 +607,7 @@ class GuiDocViewHistory:
|
|||||||
|
|
||||||
self._dumpHistory()
|
self._dumpHistory()
|
||||||
|
|
||||||
logger.verbose("Added '%s' to view history", tHandle)
|
logger.debug("Added '%s' to view history", tHandle)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -616,7 +616,7 @@ class GuiDocViewHistory:
|
|||||||
"""
|
"""
|
||||||
newPos = self._currPos + 1
|
newPos = self._currPos + 1
|
||||||
if newPos < len(self._navHistory):
|
if newPos < len(self._navHistory):
|
||||||
logger.verbose("Move forward in view history")
|
logger.debug("Move forward in view history")
|
||||||
self._prevPos = self._currPos
|
self._prevPos = self._currPos
|
||||||
self._updateScrollBar()
|
self._updateScrollBar()
|
||||||
|
|
||||||
@@ -634,7 +634,7 @@ class GuiDocViewHistory:
|
|||||||
"""
|
"""
|
||||||
newPos = self._currPos - 1
|
newPos = self._currPos - 1
|
||||||
if newPos >= 0:
|
if newPos >= 0:
|
||||||
logger.verbose("Move backward in view history")
|
logger.debug("Move backward in view history")
|
||||||
self._prevPos = self._currPos
|
self._prevPos = self._currPos
|
||||||
self._updateScrollBar()
|
self._updateScrollBar()
|
||||||
|
|
||||||
@@ -680,11 +680,11 @@ class GuiDocViewHistory:
|
|||||||
|
|
||||||
def _dumpHistory(self):
|
def _dumpHistory(self):
|
||||||
"""Debug function to dump history to the logger. Since it is a
|
"""Debug function to dump history to the logger. Since it is a
|
||||||
for loop, it is skipped entirely if log level isn't VERBOSE.
|
for loop, it is skipped entirely if log level isn't DEBUG.
|
||||||
"""
|
"""
|
||||||
if logger.getEffectiveLevel() < logging.DEBUG:
|
if logger.getEffectiveLevel() == logging.DEBUG:
|
||||||
for i, (h, p) in enumerate(zip(self._navHistory, self._posHistory)):
|
for i, (h, p) in enumerate(zip(self._navHistory, self._posHistory)):
|
||||||
logger.verbose(
|
logger.debug(
|
||||||
"History %02d: %s %13s [x:%d]" % (
|
"History %02d: %s %13s [x:%d]" % (
|
||||||
i + 1, ">" if i == self._currPos else " ", h, p
|
i + 1, ">" if i == self._currPos else " ", h, p
|
||||||
)
|
)
|
||||||
@@ -1104,7 +1104,7 @@ class GuiDocViewFooter(QWidget):
|
|||||||
def _doToggleSticky(self, theState):
|
def _doToggleSticky(self, theState):
|
||||||
"""Toggle the sticky flag for the reference panel.
|
"""Toggle the sticky flag for the reference panel.
|
||||||
"""
|
"""
|
||||||
logger.verbose("Reference sticky is %s", str(theState))
|
logger.debug("Reference sticky is %s", str(theState))
|
||||||
self.docViewer.stickyRef = theState
|
self.docViewer.stickyRef = theState
|
||||||
if not theState and self.docViewer.docHandle() is not None:
|
if not theState and self.docViewer.docHandle() is not None:
|
||||||
self.viewMeta.refreshReferences(self.docViewer.docHandle())
|
self.viewMeta.refreshReferences(self.docViewer.docHandle())
|
||||||
@@ -1199,7 +1199,7 @@ class GuiDocViewDetails(QScrollArea):
|
|||||||
"""Capture the link-click and forward it to the document viewer
|
"""Capture the link-click and forward it to the document viewer
|
||||||
class for handling.
|
class for handling.
|
||||||
"""
|
"""
|
||||||
logger.verbose("Clicked link: '%s'", theLink)
|
logger.debug("Clicked link: '%s'", theLink)
|
||||||
if len(theLink) == 21:
|
if len(theLink) == 21:
|
||||||
tHandle = theLink[:13]
|
tHandle = theLink[:13]
|
||||||
tAnchor = theLink[13:]
|
tAnchor = theLink[13:]
|
||||||
|
|||||||
@@ -443,14 +443,14 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
def refreshTree(self, rootHandle=None, overRide=False):
|
def refreshTree(self, rootHandle=None, overRide=False):
|
||||||
"""Called whenever the Novel tab is activated.
|
"""Called whenever the Novel tab is activated.
|
||||||
"""
|
"""
|
||||||
logger.verbose("Requesting refresh of the novel tree")
|
logger.debug("Requesting refresh of the novel tree")
|
||||||
if rootHandle is None:
|
if rootHandle is None:
|
||||||
rootHandle = self.theProject.tree.findRoot(nwItemClass.NOVEL)
|
rootHandle = self.theProject.tree.findRoot(nwItemClass.NOVEL)
|
||||||
|
|
||||||
treeChanged = self.mainGui.projView.changedSince(self._lastBuild)
|
treeChanged = self.mainGui.projView.changedSince(self._lastBuild)
|
||||||
indexChanged = self.theProject.index.rootChangedSince(rootHandle, self._lastBuild)
|
indexChanged = self.theProject.index.rootChangedSince(rootHandle, self._lastBuild)
|
||||||
if not (treeChanged or indexChanged or overRide):
|
if not (treeChanged or indexChanged or overRide):
|
||||||
logger.verbose("No changes have been made to the novel index")
|
logger.debug("No changes have been made to the novel index")
|
||||||
return
|
return
|
||||||
|
|
||||||
selItem = self.selectedItems()
|
selItem = self.selectedItems()
|
||||||
@@ -519,7 +519,7 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
tItem.setBackground(self.C_EXTRA, self.palette().base())
|
tItem.setBackground(self.C_EXTRA, self.palette().base())
|
||||||
tItem.setBackground(self.C_MORE, self.palette().base())
|
tItem.setBackground(self.C_MORE, self.palette().base())
|
||||||
|
|
||||||
logger.verbose("Highlighted Novel Tree in %.3f ms", (time() - tStart)*1000)
|
logger.debug("Highlighted Novel Tree in %.3f ms", (time() - tStart)*1000)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
"""
|
"""
|
||||||
self.clearContent()
|
self.clearContent()
|
||||||
tStart = time()
|
tStart = time()
|
||||||
logger.verbose("Building novel tree for root item '%s'", rootHandle)
|
logger.debug("Building novel tree for root item '%s'", rootHandle)
|
||||||
|
|
||||||
novStruct = self.theProject.index.novelStructure(rootHandle=rootHandle, skipExcl=True)
|
novStruct = self.theProject.index.novelStructure(rootHandle=rootHandle, skipExcl=True)
|
||||||
for tKey, tHandle, sTitle, novIdx in novStruct:
|
for tKey, tHandle, sTitle, novIdx in novStruct:
|
||||||
@@ -636,7 +636,7 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
|
|
||||||
self.setActiveHandle(self._actHandle)
|
self.setActiveHandle(self._actHandle)
|
||||||
|
|
||||||
logger.verbose("Novel Tree built in %.3f ms", (time() - tStart)*1000)
|
logger.debug("Novel Tree built in %.3f ms", (time() - tStart)*1000)
|
||||||
self._lastBuild = time()
|
self._lastBuild = time()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ class GuiOutlineTree(QTreeWidget):
|
|||||||
# was last built, we rebuild the tree from the updated index.
|
# was last built, we rebuild the tree from the updated index.
|
||||||
indexChanged = self.theProject.index.rootChangedSince(rootHandle, self._lastBuild)
|
indexChanged = self.theProject.index.rootChangedSince(rootHandle, self._lastBuild)
|
||||||
if not (novelChanged or indexChanged or overRide):
|
if not (novelChanged or indexChanged or overRide):
|
||||||
logger.verbose("No changes have been made to the novel index")
|
logger.debug("No changes have been made to the novel index")
|
||||||
return
|
return
|
||||||
|
|
||||||
self._populateTree(rootHandle)
|
self._populateTree(rootHandle)
|
||||||
@@ -554,11 +554,9 @@ class GuiOutlineTree(QTreeWidget):
|
|||||||
"""Receive the changes to column visibility forwarded by the
|
"""Receive the changes to column visibility forwarded by the
|
||||||
column selection menu.
|
column selection menu.
|
||||||
"""
|
"""
|
||||||
logger.verbose("User toggled Outline column '%s'", theItem.name)
|
|
||||||
if theItem in self._colIdx:
|
if theItem in self._colIdx:
|
||||||
self.setColumnHidden(self._colIdx[theItem], not isChecked)
|
self.setColumnHidden(self._colIdx[theItem], not isChecked)
|
||||||
self._saveHeaderState()
|
self._saveHeaderState()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ class GuiProjectToolBar(QWidget):
|
|||||||
def buildQuickLinkMenu(self):
|
def buildQuickLinkMenu(self):
|
||||||
"""Build the quick link menu.
|
"""Build the quick link menu.
|
||||||
"""
|
"""
|
||||||
logger.verbose("Rebuilding quick links menu")
|
logger.debug("Rebuilding quick links menu")
|
||||||
|
|
||||||
self.mQuick.clear()
|
self.mQuick.clear()
|
||||||
for n, (tHandle, nwItem) in enumerate(self.theProject.tree.iterRoots(None)):
|
for n, (tHandle, nwItem) in enumerate(self.theProject.tree.iterRoots(None)):
|
||||||
@@ -615,7 +615,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
tHandle = self.getSelectedHandle()
|
tHandle = self.getSelectedHandle()
|
||||||
trItem = self._getTreeItem(tHandle)
|
trItem = self._getTreeItem(tHandle)
|
||||||
if trItem is None:
|
if trItem is None:
|
||||||
logger.verbose("No item selected")
|
logger.debug("No item selected")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
pItem = trItem.parent()
|
pItem = trItem.parent()
|
||||||
@@ -760,7 +760,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
logger.info("Action cancelled by user")
|
logger.info("Action cancelled by user")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.verbose("Deleting %d file(s) from Trash", nTrash)
|
logger.debug("Deleting %d file(s) from Trash", nTrash)
|
||||||
for tHandle in reversed(self.getTreeFromHandle(trashHandle)):
|
for tHandle in reversed(self.getTreeFromHandle(trashHandle)):
|
||||||
if tHandle == trashHandle:
|
if tHandle == trashHandle:
|
||||||
continue
|
continue
|
||||||
@@ -986,7 +986,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
srcOK = isinstance(srcItem, QTreeWidgetItem)
|
srcOK = isinstance(srcItem, QTreeWidgetItem)
|
||||||
dstOk = isinstance(dstItem, QTreeWidgetItem)
|
dstOk = isinstance(dstItem, QTreeWidgetItem)
|
||||||
if not srcOK or not dstOk or dstIndex is None:
|
if not srcOK or not dstOk or dstIndex is None:
|
||||||
logger.verbose("No tree move to undo")
|
logger.debug("No tree move to undo")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if srcItem not in self._treeMap.values():
|
if srcItem not in self._treeMap.values():
|
||||||
|
|||||||
+13
-13
@@ -142,8 +142,8 @@ class GuiTheme:
|
|||||||
self.guiDPI = qApp.primaryScreen().logicalDotsPerInchX()
|
self.guiDPI = qApp.primaryScreen().logicalDotsPerInchX()
|
||||||
self.guiScale = qApp.primaryScreen().logicalDotsPerInchX()/96.0
|
self.guiScale = qApp.primaryScreen().logicalDotsPerInchX()/96.0
|
||||||
self.mainConf.guiScale = self.guiScale
|
self.mainConf.guiScale = self.guiScale
|
||||||
logger.verbose("GUI DPI: %.1f", self.guiDPI)
|
logger.debug("GUI DPI: %.1f", self.guiDPI)
|
||||||
logger.verbose("GUI Scale: %.2f", self.guiScale)
|
logger.debug("GUI Scale: %.2f", self.guiScale)
|
||||||
|
|
||||||
# Fonts
|
# Fonts
|
||||||
self.guiFont = qApp.font()
|
self.guiFont = qApp.font()
|
||||||
@@ -160,12 +160,12 @@ class GuiTheme:
|
|||||||
self.guiFontFixed.setPointSizeF(0.95*self.fontPointSize)
|
self.guiFontFixed.setPointSizeF(0.95*self.fontPointSize)
|
||||||
self.guiFontFixed.setFamily(QFontDatabase.systemFont(QFontDatabase.FixedFont).family())
|
self.guiFontFixed.setFamily(QFontDatabase.systemFont(QFontDatabase.FixedFont).family())
|
||||||
|
|
||||||
logger.verbose("GUI Font Family: %s", self.guiFont.family())
|
logger.debug("GUI Font Family: %s", self.guiFont.family())
|
||||||
logger.verbose("GUI Font Point Size: %.2f", self.fontPointSize)
|
logger.debug("GUI Font Point Size: %.2f", self.fontPointSize)
|
||||||
logger.verbose("GUI Font Pixel Size: %d", self.fontPixelSize)
|
logger.debug("GUI Font Pixel Size: %d", self.fontPixelSize)
|
||||||
logger.verbose("GUI Base Icon Size: %d", self.baseIconSize)
|
logger.debug("GUI Base Icon Size: %d", self.baseIconSize)
|
||||||
logger.verbose("Text 'N' Height: %d", self.textNHeight)
|
logger.debug("Text 'N' Height: %d", self.textNHeight)
|
||||||
logger.verbose("Text 'N' Width: %d", self.textNWidth)
|
logger.debug("Text 'N' Width: %d", self.textNWidth)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ class GuiTheme:
|
|||||||
|
|
||||||
confParser = NWConfigParser()
|
confParser = NWConfigParser()
|
||||||
for themeKey, themePath in self._availThemes.items():
|
for themeKey, themePath in self._availThemes.items():
|
||||||
logger.verbose("Checking theme config for '%s'", themeKey)
|
logger.debug("Checking theme config for '%s'", themeKey)
|
||||||
themeName = _loadInternalName(confParser, themePath)
|
themeName = _loadInternalName(confParser, themePath)
|
||||||
if themeName:
|
if themeName:
|
||||||
self._themeList.append((themeKey, themeName))
|
self._themeList.append((themeKey, themeName))
|
||||||
@@ -375,7 +375,7 @@ class GuiTheme:
|
|||||||
|
|
||||||
confParser = NWConfigParser()
|
confParser = NWConfigParser()
|
||||||
for syntaxKey, syntaxPath in self._availSyntax.items():
|
for syntaxKey, syntaxPath in self._availSyntax.items():
|
||||||
logger.verbose("Checking theme syntax for '%s'", syntaxKey)
|
logger.debug("Checking theme syntax for '%s'", syntaxKey)
|
||||||
syntaxName = _loadInternalName(confParser, syntaxPath)
|
syntaxName = _loadInternalName(confParser, syntaxPath)
|
||||||
if syntaxName:
|
if syntaxName:
|
||||||
self._syntaxList.append((syntaxKey, syntaxName))
|
self._syntaxList.append((syntaxKey, syntaxName))
|
||||||
@@ -561,7 +561,7 @@ class GuiIcons:
|
|||||||
iconPath = os.path.join(self._themePath, iconFile)
|
iconPath = os.path.join(self._themePath, iconFile)
|
||||||
if os.path.isfile(iconPath):
|
if os.path.isfile(iconPath):
|
||||||
self._themeMap[iconName] = iconPath
|
self._themeMap[iconName] = iconPath
|
||||||
logger.verbose("Icon slot '%s' using file '%s'", iconName, iconFile)
|
logger.debug("Icon slot '%s' using file '%s'", iconName, iconFile)
|
||||||
else:
|
else:
|
||||||
logger.error("Icon file '%s' not in theme folder", iconFile)
|
logger.error("Icon file '%s' not in theme folder", iconFile)
|
||||||
|
|
||||||
@@ -680,7 +680,7 @@ class GuiIcons:
|
|||||||
if not os.path.isdir(themePath):
|
if not os.path.isdir(themePath):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logger.verbose("Checking icon theme config for '%s'", themeDir)
|
logger.debug("Checking icon theme config for '%s'", themeDir)
|
||||||
themeConf = os.path.join(themePath, self._confName)
|
themeConf = os.path.join(themePath, self._confName)
|
||||||
themeName = _loadInternalName(confParser, themeConf)
|
themeName = _loadInternalName(confParser, themeConf)
|
||||||
if themeName:
|
if themeName:
|
||||||
@@ -728,7 +728,7 @@ class GuiIcons:
|
|||||||
# Otherwise, we load from the theme folder
|
# Otherwise, we load from the theme folder
|
||||||
if iconKey in self._themeMap:
|
if iconKey in self._themeMap:
|
||||||
relPath = os.path.relpath(self._themeMap[iconKey], self._iconPath)
|
relPath = os.path.relpath(self._themeMap[iconKey], self._iconPath)
|
||||||
logger.verbose("Loading: %s", relPath)
|
logger.debug("Loading: %s", relPath)
|
||||||
return QIcon(self._themeMap[iconKey])
|
return QIcon(self._themeMap[iconKey])
|
||||||
|
|
||||||
# If we didn't find one, give up and return an empty icon
|
# If we didn't find one, give up and return an empty icon
|
||||||
|
|||||||
+3
-13
@@ -666,21 +666,18 @@ class GuiMain(QMainWindow):
|
|||||||
logger.debug("Viewing document, but no handle provided")
|
logger.debug("Viewing document, but no handle provided")
|
||||||
|
|
||||||
if self.docEditor.hasFocus():
|
if self.docEditor.hasFocus():
|
||||||
logger.verbose("Trying editor document")
|
|
||||||
tHandle = self.docEditor.docHandle()
|
tHandle = self.docEditor.docHandle()
|
||||||
|
|
||||||
if tHandle is not None:
|
if tHandle is not None:
|
||||||
self.saveDocument()
|
self.saveDocument()
|
||||||
else:
|
else:
|
||||||
logger.verbose("Trying selected document")
|
|
||||||
tHandle = self.projView.getSelectedHandle()
|
tHandle = self.projView.getSelectedHandle()
|
||||||
|
|
||||||
if tHandle is None:
|
if tHandle is None:
|
||||||
logger.verbose("Trying last viewed document")
|
|
||||||
tHandle = self.theProject.lastViewed
|
tHandle = self.theProject.lastViewed
|
||||||
|
|
||||||
if tHandle is None:
|
if tHandle is None:
|
||||||
logger.verbose("No document to view, giving up")
|
logger.debug("No document to view, giving up")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Make sure main tab is in Editor view
|
# Make sure main tab is in Editor view
|
||||||
@@ -851,7 +848,7 @@ class GuiMain(QMainWindow):
|
|||||||
if tItem is None: # pragma: no cover
|
if tItem is None: # pragma: no cover
|
||||||
continue # This is a bug trap
|
continue # This is a bug trap
|
||||||
|
|
||||||
logger.verbose("Indexing '%s'", tItem.itemName)
|
logger.debug("Indexing '%s'", tItem.itemName)
|
||||||
if self.theProject.index.reIndexHandle(tItem.itemHandle):
|
if self.theProject.index.reIndexHandle(tItem.itemHandle):
|
||||||
# Update Word Counts
|
# Update Word Counts
|
||||||
self.projView.propagateCount(tItem.itemHandle, tItem.wordCount, countChildren=True)
|
self.projView.propagateCount(tItem.itemHandle, tItem.wordCount, countChildren=True)
|
||||||
@@ -1524,7 +1521,6 @@ class GuiMain(QMainWindow):
|
|||||||
if not self.hasProject:
|
if not self.hasProject:
|
||||||
self.statusBar.setProjectStats(0, 0)
|
self.statusBar.setProjectStats(0, 0)
|
||||||
|
|
||||||
logger.verbose("Updating total word count")
|
|
||||||
self.theProject.updateWordCounts()
|
self.theProject.updateWordCounts()
|
||||||
if self.mainConf.incNotesWCount:
|
if self.mainConf.incNotesWCount:
|
||||||
currWords = self.theProject.currWCount
|
currWords = self.theProject.currWCount
|
||||||
@@ -1561,13 +1557,9 @@ class GuiMain(QMainWindow):
|
|||||||
def _mainStackChanged(self, stIndex):
|
def _mainStackChanged(self, stIndex):
|
||||||
"""Activated when the main window tab is changed.
|
"""Activated when the main window tab is changed.
|
||||||
"""
|
"""
|
||||||
if stIndex == self.idxEditorView:
|
if stIndex == self.idxOutlineView:
|
||||||
logger.verbose("Editor View activated")
|
|
||||||
elif stIndex == self.idxOutlineView:
|
|
||||||
logger.verbose("Outline View activated")
|
|
||||||
if self.hasProject:
|
if self.hasProject:
|
||||||
self.outlineView.refreshTree()
|
self.outlineView.refreshTree()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot(int)
|
@pyqtSlot(int)
|
||||||
@@ -1577,11 +1569,9 @@ class GuiMain(QMainWindow):
|
|||||||
sHandle = None
|
sHandle = None
|
||||||
|
|
||||||
if stIndex == self.idxProjView:
|
if stIndex == self.idxProjView:
|
||||||
logger.verbose("Project Tree View activated")
|
|
||||||
sHandle = self.projView.getSelectedHandle()
|
sHandle = self.projView.getSelectedHandle()
|
||||||
|
|
||||||
elif stIndex == self.idxNovelView:
|
elif stIndex == self.idxNovelView:
|
||||||
logger.verbose("Novel Tree View activated")
|
|
||||||
if self.hasProject:
|
if self.hasProject:
|
||||||
self.novelView.refreshTree()
|
self.novelView.refreshTree()
|
||||||
sHandle, _ = self.novelView.getSelectedHandle()
|
sHandle, _ = self.novelView.getSelectedHandle()
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ class ProjWizardFolderPage(QWizardPage):
|
|||||||
|
|
||||||
setPath = os.path.abspath(os.path.expanduser(self.projPath.text()))
|
setPath = os.path.abspath(os.path.expanduser(self.projPath.text()))
|
||||||
parPath = os.path.dirname(setPath)
|
parPath = os.path.dirname(setPath)
|
||||||
logger.verbose("Path is: %s", setPath)
|
logger.debug("Path is: %s", setPath)
|
||||||
if parPath and not os.path.isdir(parPath):
|
if parPath and not os.path.isdir(parPath):
|
||||||
self.errLabel.setText(self.tr(
|
self.errLabel.setText(self.tr(
|
||||||
"Error: A project folder cannot be created using this path."
|
"Error: A project folder cannot be created using this path."
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ class GuiWritingStats(QDialog):
|
|||||||
if inLine.startswith("#"):
|
if inLine.startswith("#"):
|
||||||
if inLine.startswith("# Offset"):
|
if inLine.startswith("# Offset"):
|
||||||
self.wordOffset = checkInt(inLine[9:].strip(), 0)
|
self.wordOffset = checkInt(inLine[9:].strip(), 0)
|
||||||
logger.verbose(
|
logger.debug(
|
||||||
"Initial word count when log was started is %d" % self.wordOffset
|
"Initial word count when log was started is %d" % self.wordOffset
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -111,12 +111,6 @@ def testBaseInit_Options(monkeypatch, tmpDir):
|
|||||||
assert novelwriter.logger.getEffectiveLevel() == logging.DEBUG
|
assert novelwriter.logger.getEffectiveLevel() == logging.DEBUG
|
||||||
assert nwGUI.closeMain() == "closeMain"
|
assert nwGUI.closeMain() == "closeMain"
|
||||||
|
|
||||||
nwGUI = novelwriter.main(
|
|
||||||
["--testmode", "--verbose", "--config=%s" % tmpDir, "--data=%s" % tmpDir]
|
|
||||||
)
|
|
||||||
assert novelwriter.logger.getEffectiveLevel() == 5
|
|
||||||
assert nwGUI.closeMain() == "closeMain"
|
|
||||||
|
|
||||||
# Help and Version
|
# Help and Version
|
||||||
with pytest.raises(SystemExit) as ex:
|
with pytest.raises(SystemExit) as ex:
|
||||||
nwGUI = novelwriter.main(
|
nwGUI = novelwriter.main(
|
||||||
|
|||||||
Reference in New Issue
Block a user