diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index c8d13477..af81f802 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -59,6 +59,7 @@ class GuiDocEditor(QTextEdit): # Core Elements self.qDocument = self.document() + self.qDocument.setDocumentMargin(self.mainConf.textMargin) self.qDocument.contentsChange.connect(self._docChange) if self.mainConf.spellTool == "enchant": from nw.tools.spellenchant import NWSpellEnchant @@ -90,7 +91,6 @@ class GuiDocEditor(QTextEdit): self.wCounter = WordCounter(self) self.wCounter.finished.connect(self._updateCounts) - self.clearEditor() self.initEditor() logger.debug("DocEditor initialisation complete") @@ -138,7 +138,7 @@ class GuiDocEditor(QTextEdit): docPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) self.setPalette(docPalette) - # Set text fixed width, or alternatively, just margins + # Set default text margins self.qDocument.setDocumentMargin(self.mainConf.textMargin) # Also set the document text options for the document text flow @@ -149,15 +149,14 @@ class GuiDocEditor(QTextEdit): theOpt.setAlignment(Qt.AlignJustify) self.qDocument.setDefaultTextOption(theOpt) + self.hLight.initHighlighter() + # If we have a document open, we should reload it in case the font changed if self.theHandle is not None: tHandle = self.theHandle self.clearEditor() self.loadText(tHandle) - - self.hLight.initHighlighter() - self.hLight.rehighlight() - self.changeWidth() + self.changeWidth() return True @@ -363,7 +362,8 @@ class GuiDocEditor(QTextEdit): def _docChange(self, thePos, charsRemoved, charsAdded): self.lastEdit = time() - self.setDocumentChanged(True) + if not self.docChanged: + self.setDocumentChanged(True) if not self.wcTimer.isActive(): self.wcTimer.start() if self.mainConf.doReplace and not self.hasSelection: diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index 0a8ce1aa..944031be 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -48,6 +48,7 @@ class GuiMain(QMainWindow): def __init__(self): QWidget.__init__(self) + logger.info("Starting %s" % nw.__package__) logger.debug("Initialising GUI ...") self.mainConf = nw.CONFIG self.theTheme = Theme(self) @@ -134,6 +135,7 @@ class GuiMain(QMainWindow): self.initMain() self.asProjTimer.start() self.asDocTimer.start() + self.statusBar.clearStatus() logger.debug("GUI initialisation complete") diff --git a/nw/theme.py b/nw/theme.py index 2197b92d..5b96c59b 100644 --- a/nw/theme.py +++ b/nw/theme.py @@ -161,6 +161,8 @@ class Theme: qApp.setStyleSheet(cssData) qApp.setPalette(self.guiPalette) + logger.info("Loaded theme '%s'" % self.guiTheme) + return True def loadSyntax(self): @@ -199,7 +201,7 @@ class Theme: self.colTagErr = self._loadColour(confParser,cnfSec,"tagerror") self.colRepTag = self._loadColour(confParser,cnfSec,"replacetag") - logger.info("Loaded syntax colour theme '%s'" % self.guiSyntax) + logger.info("Loaded syntax theme '%s'" % self.guiSyntax) return True diff --git a/sample/sampleNovel/nwProject.nwx b/sample/sampleNovel/nwProject.nwx index 6b667a58..0081d96a 100644 --- a/sample/sampleNovel/nwProject.nwx +++ b/sample/sampleNovel/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -9,7 +9,7 @@ True 636b6aa9b697b - bc0cbd2a407f3 + 636b6aa9b697b 581 B @@ -80,7 +80,7 @@ 736 137 6 - 424 + 69 New File