A few GUI tweaks

This commit is contained in:
Veronica K. B. Olsen
2019-06-15 22:19:52 +02:00
parent 6a6c0418ea
commit 21b7e882ac
4 changed files with 15 additions and 11 deletions
+7 -7
View File
@@ -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:
+2
View File
@@ -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")
+3 -1
View File
@@ -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
+3 -3
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.5" fileVersion="1.0" timeStamp="2019-06-12 20:54:46">
<novelWriterXML appVersion="0.1.5" fileVersion="1.0" timeStamp="2019-06-15 22:17:54">
<project>
<name>Sample Project</name>
<title>Sample Project</title>
@@ -9,7 +9,7 @@
<settings>
<spellCheck>True</spellCheck>
<lastEdited>636b6aa9b697b</lastEdited>
<lastViewed>bc0cbd2a407f3</lastViewed>
<lastViewed>636b6aa9b697b</lastViewed>
<lastWordCount>581</lastWordCount>
<autoReplace>
<A>B</A>
@@ -80,7 +80,7 @@
<charCount>736</charCount>
<wordCount>137</wordCount>
<paraCount>6</paraCount>
<cursorPos>424</cursorPos>
<cursorPos>69</cursorPos>
</item>
<item handle="bc0cbd2a407f3" order="2" parent="e7ded148d6e4a">
<name>New File</name>