Improved the tab handling and added the same fix to the build tool
This commit is contained in:
+25
-2
@@ -551,7 +551,6 @@ class GuiBuildNovel(QDialog):
|
||||
isNone |= theItem.itemClass == nwItemClass.NO_CLASS
|
||||
isNone |= theItem.itemClass == nwItemClass.TRASH
|
||||
isNone |= theItem.parHandle == self.theProject.projTree.trashRoot()
|
||||
isNone |= theItem.parHandle == self.theProject.projTree.archiveRoot()
|
||||
isNone |= theItem.parHandle is None
|
||||
isNote = theItem.itemLayout == nwItemLayout.NOTE
|
||||
isNovel = not isNone and not isNote
|
||||
@@ -563,6 +562,10 @@ class GuiBuildNovel(QDialog):
|
||||
if isNovel and not novelFiles:
|
||||
return False
|
||||
|
||||
rootItem = self.theProject.projTree.getRootItem(theItem.itemHandle)
|
||||
if rootItem.itemClass == nwItemClass.ARCHIVE:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def _saveDocument(self, theFormat):
|
||||
@@ -1014,13 +1017,33 @@ class GuiBuildNovelDocView(QTextBrowser):
|
||||
theText = "".join(theText)
|
||||
|
||||
self.buildTime = timeStamp
|
||||
sPos = self.verticalScrollBar().value()
|
||||
|
||||
theText = theText.replace(" ", " "*4)
|
||||
# Refresh the tab stops
|
||||
if self.mainConf.verQtValue >= 51000:
|
||||
self.setTabStopDistance(self.mainConf.getTabWidth())
|
||||
else:
|
||||
self.setTabStopWidth(self.mainConf.getTabWidth())
|
||||
|
||||
theText = theText.replace("\t", "!!tab!!")
|
||||
theText = theText.replace("<del>", "<span style='text-decoration: line-through;'>")
|
||||
theText = theText.replace("</del>", "</span>")
|
||||
self.setHtml(theText)
|
||||
|
||||
while self.find("!!tab!!"):
|
||||
theCursor = self.textCursor()
|
||||
theCursor.insertText("\t")
|
||||
|
||||
self.verticalScrollBar().setValue(sPos)
|
||||
self._updateBuildAge()
|
||||
|
||||
# This forces a repaint of the text, It's a hack to fix an occational
|
||||
# issue where the find/replace above interfers with the rendering and
|
||||
# leaves parts of the document blank.
|
||||
textWidth = self.qDocument.textWidth()
|
||||
self.qDocument.setTextWidth(textWidth - 5)
|
||||
self.qDocument.setTextWidth(textWidth)
|
||||
|
||||
return
|
||||
|
||||
def setStyleSheet(self, theStyles=[]):
|
||||
|
||||
Reference in New Issue
Block a user