Fix annotation errors

This commit is contained in:
Veronica Berglyd Olsen
2024-04-09 17:01:05 +02:00
parent 99c4b0acd0
commit c1154682b5
19 changed files with 60 additions and 44 deletions
+4 -4
View File
@@ -381,7 +381,7 @@ class GuiDocEditor(QPlainTextEdit):
return
def loadText(self, tHandle: str, tLine=None) -> bool:
def loadText(self, tHandle: str, tLine: int | None = None) -> bool:
"""Load text from a document into the editor. If we have an I/O
error, we must handle this and clear the editor so that we don't
risk overwriting the file if it exists. This can for instance
@@ -1080,7 +1080,7 @@ class GuiDocEditor(QPlainTextEdit):
return
@pyqtSlot()
def _cursorMoved(self):
def _cursorMoved(self) -> None:
"""Triggered when the cursor moved in the editor."""
self.docFooter.updateLineCount(self.textCursor())
return
@@ -2186,7 +2186,7 @@ class MetaCompleter(QMenu):
# Internal Functions
##
def _emitComplete(self, pos: int, length: int, value: str):
def _emitComplete(self, pos: int, length: int, value: str) -> None:
"""Emit the signal to indicate a selection has been made."""
self.complete.emit(pos, length, value)
return
@@ -2967,7 +2967,7 @@ class GuiDocEditHeader(QWidget):
# Events
##
def mousePressEvent(self, event: QMouseEvent):
def mousePressEvent(self, event: QMouseEvent) -> None:
"""Capture a click on the title and ensure that the item is
selected in the project tree.
"""
+1 -1
View File
@@ -344,7 +344,7 @@ class GuiNovelToolBar(QWidget):
# Internal Functions
##
def _addLastColAction(self, colType, actionLabel) -> None:
def _addLastColAction(self, colType: NovelTreeColumn, actionLabel: str) -> None:
"""Add a column selection entry to the last column menu."""
aLast = self.mLastCol.addAction(actionLabel)
aLast.setCheckable(True)
+3 -3
View File
@@ -190,7 +190,7 @@ class GuiOutlineView(QWidget):
return
@pyqtSlot(str)
def _rootItemChanged(self, tHandle) -> None:
def _rootItemChanged(self, tHandle: str) -> None:
"""Handle root novel changed or needs to be refreshed."""
self.outlineTree.refreshTree(rootHandle=(tHandle or None), overRide=True)
return
@@ -428,7 +428,7 @@ class GuiOutlineTree(QTreeWidget):
##
@property
def hiddenColumns(self):
def hiddenColumns(self) -> dict[nwOutline, bool]:
return self._colHidden
##
@@ -586,7 +586,7 @@ class GuiOutlineTree(QTreeWidget):
# Internal Functions
##
def _loadHeaderState(self):
def _loadHeaderState(self) -> None:
"""Load the state of the main tree header, that is, column order
and column width.
"""
+1 -1
View File
@@ -453,7 +453,7 @@ class GuiProjectToolBar(QWidget):
def _buildRootMenu(self) -> None:
"""Build the rood folder menu."""
def addClass(itemClass):
def addClass(itemClass: nwItemClass) -> None:
aNew = self.mAddRoot.addAction(trConst(nwLabels.CLASS_NAME[itemClass]))
aNew.setIcon(SHARED.theme.getIcon(nwLabels.CLASS_ICON[itemClass]))
aNew.triggered.connect(lambda: self.projTree.newTreeItem(nwItemType.ROOT, itemClass))