Spell check comments and docstrings

This commit is contained in:
Veronica Berglyd Olsen
2023-07-20 23:25:49 +02:00
parent e773884c29
commit 4dfa51855e
45 changed files with 122 additions and 175 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ from novelwriter.config import Config
# - Digit 1,2 : Major Version (01-ff)
# - Digit 3,4 : Minor Version (01-ff)
# - Digit 5,6 : Patch Version (01-ff)
# - Digit 7 : Release Type (a: aplha, b: beta, c: candidate, f: final)
# - Digit 7 : Release Type (a: alpha, b: beta, c: candidate, f: final)
# - Digit 8 : Release Number (0-f)
#
# Example : Full Short Description
+1 -1
View File
@@ -257,7 +257,7 @@ def formatTime(t: int) -> str:
def simplified(text: str) -> str:
"""Take a string and strip leading and trailing whitespaces, and
replace all occurences of (multiple) whitespaces with a 0x20 space.
replace all occurrences of (multiple) whitespaces with a 0x20 space.
"""
return " ".join(str(text).strip().split())
+3 -3
View File
@@ -109,7 +109,7 @@ class Config:
# Size Settings
self._mainWinSize = [1200, 650] # Last size of the main GUI window
self._prefsWinSize = [700, 615] # Last size of the Preferences dialog
self._projLoadCols = [280, 60, 160] # Last columns withs of the Project Load dialog
self._projLoadCols = [280, 60, 160] # Last columns widths of the Project Load dialog
self._mainPanePos = [300, 800] # Last position of the main window splitter
self._viewPanePos = [500, 150] # Last position of the document viewer splitter
self._outlnPanePos = [500, 150] # Last position of the outline panel splitter
@@ -135,7 +135,7 @@ class Config:
self.autoSelect = True # Auto-select word when applying format with no selection
self.doJustify = False # Justify text
self.showTabsNSpaces = False # Show tabs and spaces in edior
self.showTabsNSpaces = False # Show tabs and spaces in editor
self.showLineEndings = False # Show line endings in editor
self.showMultiSpaces = True # Highlight multiple spaces in the text
@@ -781,7 +781,7 @@ class Config:
return checkVal
def _checkOptionalPackages(self):
"""Cheks if we have the optional packages used by some features.
"""Check if we have the optional packages used by some features.
"""
try:
import enchant # noqa: F401
+3 -3
View File
@@ -42,8 +42,8 @@ class nwConst:
FMT_DSTAMP = "%Y-%m-%d" # Date only format
# Various Hard Limits
MAX_DOCSIZE = 5000000 # Maxium size of a single document
MAX_BUILDSIZE = 10000000 # Maxium size of a project build
MAX_DOCSIZE = 5000000 # Maximum size of a single document
MAX_BUILDSIZE = 10000000 # Maximum size of a project build
# URLs
URL_WEB = "https://novelwriter.io"
@@ -358,7 +358,7 @@ class nwUnicode:
U_PERMIL = "\u2030" # Per mille sign
U_DEGREE = "\u00b0" # Degree symbol
U_MINUS = "\u2212" # Minus sign
U_TIMES = "\u00d7" # Multiplaction sign
U_TIMES = "\u00d7" # Multiplication sign
U_DIVIDE = "\u00f7" # Division sign
# Arrows
+1 -1
View File
@@ -493,7 +493,7 @@ class BuildCollection:
return
def builds(self) -> Iterable[tuple[str, str]]:
"""Iterate over all avaiable builds."""
"""Iterate over all available builds."""
for buildID in self._builds:
yield buildID, self._builds[buildID].get("name", "")
return
+1 -1
View File
@@ -309,7 +309,7 @@ class DocDuplicator:
class ProjectBuilder:
"""A class to build a new project from a set of user-defined
parameter provided by the New Projecty Wizard.
parameter provided by the New Project Wizard.
"""
def __init__(self, mainGui: GuiMain) -> None:
+1 -1
View File
@@ -87,7 +87,7 @@ class NWDocument:
def readDocument(self, isOrphan: bool = False) -> str | None:
"""Read the document specified by the handle set in the
contructor, capturing potential file system errors and parse
constructor, capturing potential file system errors and parse
meta data. If the document doesn't exist on disk, return an
empty string. If something went wrong, return None.
"""
+1 -1
View File
@@ -730,7 +730,7 @@ class TagsIndex:
class ItemIndex:
"""Core: Item Index Wrapper Class
A wrapper object holding the indexed items. This is a warapper
A wrapper object holding the indexed items. This is a wrapper
class around a single storage dictionary with a set of utility
functions for setting and accessing the index data. Each indexed
item is stored in an IndexItem object, which again holds an
+1 -1
View File
@@ -67,7 +67,7 @@ class NWProject(QObject):
self._storage = NWStorage(self) # The project storage handler
self._data = NWProjectData(self) # The project settings
self._tree = NWTree(self) # The project tree
self._index = NWIndex(self) # The projecty index
self._index = NWIndex(self) # The project index
self._session = NWSessionLog(self) # The session record
# Data Cache
+1 -1
View File
@@ -252,7 +252,7 @@ class NWProjectData:
return
def setEditTime(self, value: Any):
"""Set tyje edit time from last session."""
"""Set the edit time from last session."""
self._editTime = checkInt(value, 0)
self.theProject.setProjectChanged(True)
return
+4 -4
View File
@@ -97,12 +97,12 @@ class ProjectXMLReader:
1.4 Introduces a more compact format for storing items. All settings
aside from name are now attributes. This format also changes the
way satus and importance labels are stored. This format was only
way status and importance labels are stored. This format was only
a part of version 2.0 RC 1
1.5 The actual format released for 2.0. It moves last used handles
and title formats into a key/value format similar to auto-
replace, status and imporetance. It adds the heading value to
replace, status and importance. It adds the heading value to
the content item meta entry. It also moves meta data related to
the project or the content into their respective section nodes
as attributes. The id attribute was also added to the project.
@@ -452,7 +452,7 @@ class ProjectXMLReader:
def _parseDictKeyText(self, xItem: ET.Element) -> dict:
"""Parse a dictionary stored with key as an attribute and the
value as the text porperty.
value as the text property.
"""
result = {}
for xEntry in xItem:
@@ -462,7 +462,7 @@ class ProjectXMLReader:
def _parseDictTagText(self, xItem):
"""Parse a dictionary stored with key as the tag and the value
as the text porperty.
as the text property.
"""
return {xNode.tag: checkString(xNode.text, "") for xNode in xItem}
+1 -1
View File
@@ -66,7 +66,7 @@ class NWSessionLog:
##
def startSession(self):
"""Start the writng session."""
"""Start the writing session."""
self._start = time()
return
+2 -2
View File
@@ -110,7 +110,7 @@ class NWStorage:
"""
inPath = Path(path).resolve()
if inPath.is_file():
# The path should not point to an exisitng file,
# The path should not point to an existing file,
# but it can point to a folder containing files
inPath = inPath.parent
@@ -313,7 +313,7 @@ class NWStorage:
if not checkLegacy:
# The legacy content check is only needed for project folder
# storage, so if it is not expected to be that, there's no
# need for the remaning checks.
# need for the remaining checks.
return True
legacy = _LegacyStorage(self._project)
+1 -1
View File
@@ -147,7 +147,7 @@ class ToOdt(Tokenizer):
self._dLanguage = "en"
self._dCountry = "GB"
# Text Margings
# Text Margins
self._mTopTitle = "0.423cm"
self._mTopHead1 = "0.423cm"
self._mTopHead2 = "0.353cm"
+1 -1
View File
@@ -126,7 +126,7 @@ class NWTree:
return None
def pack(self) -> list[dict]:
"""Pack the content of the tree into a list of doctionaries of
"""Pack the content of the tree into a list of dictionaries of
items. In the order defined by the _treeOrder list.
"""
tree = []
+1 -1
View File
@@ -122,7 +122,7 @@ class NSwitchBox(QScrollArea):
def _bumpIndex(self):
"""Increase the index counter and make sure only the last
columns is stretcing.
columns is stretching.
"""
self._content.setRowStretch(self._index, 0)
self._content.setRowStretch(self._index + 1, 1)
+2 -2
View File
@@ -417,7 +417,7 @@ class GuiDocEditor(QTextEdit):
self.setDocumentChanged(False)
qApp.restoreOverrideCursor()
# This is a hack to fix invisble cursor on an empty document
# This is a hack to fix invisible cursor on an empty document
if self.document().characterCount() <= 1:
self.setPlainText("\n")
self.setPlainText("")
@@ -1001,7 +1001,7 @@ class GuiDocEditor(QTextEdit):
We need to intercept a few key sequences:
* The return and enter keys redirect here even if the search
box has focus. Since we need these keys to continue search,
we block any further interaction here while ithas focus.
we block any further interaction here while it has focus.
* The undo/redo/select all sequences bypass the docAction
pathway from the menu, so we redirect them back from here.
* We also handle automatic scrolling here.
+2 -2
View File
@@ -83,7 +83,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
def initHighlighter(self):
"""Initialise the syntax highlighter, setting all the colour
rules and building the regexes.
rules and building the RegExes.
"""
logger.debug("Setting up highlighting rules")
@@ -255,7 +255,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
##
def rehighlightByType(self, theType):
"""Loop through all blocks and rehighlight those of a given
"""Loop through all blocks and re-highlight those of a given
content type.
"""
qDoc = self.document()
+1 -1
View File
@@ -456,7 +456,7 @@ class GuiDocViewer(QTextBrowser):
theCursor.select(selMode)
if selMode == QTextCursor.BlockUnderCursor:
# This selection mode also selects the preceding oaragraph
# This selection mode also selects the preceding paragraph
# separator, which we want to avoid.
posS = theCursor.selectionStart()
posE = theCursor.selectionEnd()
+1 -1
View File
@@ -1,7 +1,7 @@
"""
novelWriter GUI Novel Tree
============================
GUI classe for the main window novel tree
GUI class for the main window novel tree
File History:
Created: 2020-12-20 [1.1rc1] GuiNovelTree
+1 -1
View File
@@ -281,7 +281,7 @@ class GuiOutlineToolBar(QToolBar):
return
def populateNovelList(self):
"""Relaod the content of the novel list.
"""Reload the content of the novel list.
"""
self.novelValue.updateList(includeAll=True)
return
+1 -1
View File
@@ -432,7 +432,7 @@ class GuiProjectToolBar(QWidget):
@pyqtSlot(str)
def _treeSelectionChanged(self, tHandle):
"""Toggle the visibility of the new item enties for novel
"""Toggle the visibility of the new item entries for novel
documents. They should only be visible if novel documents can
actually be added.
"""
+2 -2
View File
@@ -232,7 +232,7 @@ class GuiManuscript(QDialog):
def closeEvent(self, event):
"""Capture the user closing the window so we can save GUI
settings. We also check that we don't have a build settings
diralog open.
dialog open.
"""
self._saveSettings()
for obj in self.children():
@@ -430,7 +430,7 @@ class GuiManuscript(QDialog):
bItem = self._buildMap.get(build.buildID, None)
if isinstance(bItem, QListWidgetItem):
bItem.setText(build.name)
else: # Propbably a new item
else: # Probably a new item
self._updateBuildsList()
return