Improvements to commenst and logtext
This commit is contained in:
+18
-17
@@ -1441,23 +1441,24 @@ class NWProject():
|
||||
def _deprecatedFiles(self):
|
||||
"""Delete files that are no longer used by novelWriter.
|
||||
"""
|
||||
rmList = []
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.0"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.1"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.2"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.3"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.4"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.5"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.6"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.7"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.8"))
|
||||
rmList.append(path.join(self.projCache, "nwProject.nwx.9"))
|
||||
rmList.append(path.join(self.projMeta, "mainOptions.json"))
|
||||
rmList.append(path.join(self.projMeta, "exportOptions.json"))
|
||||
rmList.append(path.join(self.projMeta, "outlineOptions.json"))
|
||||
rmList.append(path.join(self.projMeta, "timelineOptions.json"))
|
||||
rmList.append(path.join(self.projMeta, "docMergeOptions.json"))
|
||||
rmList.append(path.join(self.projMeta, "sessionLogOptions.json"))
|
||||
rmList = [
|
||||
path.join(self.projCache, "nwProject.nwx.0"),
|
||||
path.join(self.projCache, "nwProject.nwx.1"),
|
||||
path.join(self.projCache, "nwProject.nwx.2"),
|
||||
path.join(self.projCache, "nwProject.nwx.3"),
|
||||
path.join(self.projCache, "nwProject.nwx.4"),
|
||||
path.join(self.projCache, "nwProject.nwx.5"),
|
||||
path.join(self.projCache, "nwProject.nwx.6"),
|
||||
path.join(self.projCache, "nwProject.nwx.7"),
|
||||
path.join(self.projCache, "nwProject.nwx.8"),
|
||||
path.join(self.projCache, "nwProject.nwx.9"),
|
||||
path.join(self.projMeta, "mainOptions.json"),
|
||||
path.join(self.projMeta, "exportOptions.json"),
|
||||
path.join(self.projMeta, "outlineOptions.json"),
|
||||
path.join(self.projMeta, "timelineOptions.json"),
|
||||
path.join(self.projMeta, "docMergeOptions.json"),
|
||||
path.join(self.projMeta, "sessionLogOptions.json"),
|
||||
]
|
||||
|
||||
for rmFile in rmList:
|
||||
if path.isfile(rmFile):
|
||||
|
||||
+4
-4
@@ -84,7 +84,7 @@ class NWTree():
|
||||
if tHandle is None:
|
||||
tHandle = self._makeHandle()
|
||||
|
||||
logger.verbose("Adding entry %s with parent %s" % (str(tHandle), str(pHandle)))
|
||||
logger.verbose("Adding item %s with parent %s" % (str(tHandle), str(pHandle)))
|
||||
|
||||
nwItem.setHandle(tHandle)
|
||||
nwItem.setParent(pHandle)
|
||||
@@ -93,15 +93,15 @@ class NWTree():
|
||||
self._treeOrder.append(tHandle)
|
||||
|
||||
if nwItem.itemType == nwItemType.ROOT:
|
||||
logger.verbose("Entry %s is a root item" % str(tHandle))
|
||||
logger.verbose("Item %s is a root item" % str(tHandle))
|
||||
self._treeRoots.append(tHandle)
|
||||
if nwItem.itemClass == nwItemClass.ARCHIVE:
|
||||
logger.verbose("Entry %s is the archive folder" % str(tHandle))
|
||||
logger.verbose("Item %s is the archive folder" % str(tHandle))
|
||||
self._archRoot = tHandle
|
||||
|
||||
if nwItem.itemType == nwItemType.TRASH:
|
||||
if self._trashRoot is None:
|
||||
logger.verbose("Entry %s is the trash folder" % str(tHandle))
|
||||
logger.verbose("Item %s is the trash folder" % str(tHandle))
|
||||
self._trashRoot = tHandle
|
||||
else:
|
||||
logger.error("Only one trash folder allowed")
|
||||
|
||||
+7
-4
@@ -639,7 +639,8 @@ class GuiDocViewHistory():
|
||||
return
|
||||
|
||||
def _truncateHistory(self, atPos):
|
||||
"""Truncate the navigation history to the given position.
|
||||
"""Truncate the navigation history to the given position. Also
|
||||
enforces a maximum length of the navigation history to 20.
|
||||
"""
|
||||
nSkip = 1 if atPos > 19 else 0
|
||||
|
||||
@@ -652,13 +653,15 @@ class GuiDocViewHistory():
|
||||
return
|
||||
|
||||
def _dumpHistory(self):
|
||||
"""Debug function to dump history. Since it is a for loop, it is
|
||||
skipped entirely if log level isn't VERBOSE.
|
||||
"""Debug function to dump history to the logger. Since it is a
|
||||
for loop, it is skipped entirely if log level isn't VERBOSE.
|
||||
"""
|
||||
if logger.getEffectiveLevel() < logging.DEBUG:
|
||||
for i, (h, p) in enumerate(zip(self._navHistory, self._posHistory)):
|
||||
logger.verbose(
|
||||
"History: %s %2d %13s %5d" % (">" if i == self._currPos else " ", i, h, p)
|
||||
"History %02d: %s %13s [x:%d]" % (
|
||||
i + 1, ">" if i == self._currPos else " ", h, p
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
+2
-2
@@ -584,7 +584,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
always make sure items with a parent have had their parent item
|
||||
sent first.
|
||||
"""
|
||||
logger.debug("Building project tree ...")
|
||||
logger.debug("Building the project tree ...")
|
||||
self.clear()
|
||||
iCount = 0
|
||||
|
||||
@@ -592,7 +592,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
iCount += 1
|
||||
self._addTreeItem(nwItem)
|
||||
|
||||
logger.debug("%d items added to project tree" % iCount)
|
||||
logger.debug("%d items added to the project tree" % iCount)
|
||||
return True
|
||||
|
||||
def getSelectedHandle(self):
|
||||
|
||||
Reference in New Issue
Block a user