Added a lot of comments to functions in the source code

This commit is contained in:
Veronica K. B. Olsen
2020-05-24 16:42:28 +02:00
parent e1ce93416c
commit c865dbd59b
21 changed files with 273 additions and 82 deletions
+10 -2
View File
@@ -75,6 +75,9 @@ class GuiDocHighlighter(QSyntaxHighlighter):
return
def initHighlighter(self):
"""Initialise the syntax highlighter, setting all the colour
rules and building the regexes.
"""
logger.debug("Setting up highlighting rules")
@@ -205,14 +208,21 @@ class GuiDocHighlighter(QSyntaxHighlighter):
##
def setDict(self, theDict):
"""Set the dictionary object for spell check underlines lookup.
"""
self.theDict = theDict
return True
def setSpellCheck(self, theMode):
"""Enable/disable the real time spell checker.
"""
self.spellCheck = theMode
return True
def setHandle(self, theHandle):
"""Set the handle of the currently highlighted document. This is
needed for the index lookup for validating tags and references.
"""
self.theHandle = theHandle
return True
@@ -226,7 +236,6 @@ class GuiDocHighlighter(QSyntaxHighlighter):
is significantly faster than running the regex checks we use for
text paragraphs.
"""
if self.theHandle is None or not theText:
return
@@ -317,7 +326,6 @@ class GuiDocHighlighter(QSyntaxHighlighter):
"""Generate a valid character format to be applied to the text
that is to be highlighted.
"""
theFormat = QTextCharFormat()
if fmtCol is not None:
-2
View File
@@ -51,7 +51,6 @@ class OptionState():
def loadSettings(self):
"""Load the options dictionary from the project settings file.
"""
if self.theProject.projMeta is None:
return False
@@ -76,7 +75,6 @@ class OptionState():
def saveSettings(self):
"""Save the options dictionary to the project settings file.
"""
if self.theProject.projMeta is None:
return False
+3 -1
View File
@@ -45,7 +45,9 @@ class WordCounter(QThread):
return
def run(self):
"""Overloaded run function for the word counter, forwarding the
call to the function that does the actual counting.
"""
theText = self.theParent.getText()
cC, wC, pC = countWords(theText)