Fix a couple of issues discovered by pylance

This commit is contained in:
Veronica Berglyd Olsen
2022-10-19 12:06:57 +02:00
parent e52f0a9e16
commit caf8a75bbc
3 changed files with 11 additions and 9 deletions
+7 -7
View File
@@ -267,8 +267,8 @@ class QSwitch(QAbstractButton):
return self._offset return self._offset
@offset.setter @offset.setter
def offset(self, theOffset): def offset(self, offset):
self._offset = theOffset self._offset = offset
self.update() self.update()
return return
@@ -276,11 +276,11 @@ class QSwitch(QAbstractButton):
# Getters and Setters # Getters and Setters
## ##
def setChecked(self, isChecked): def setChecked(self, checked):
"""Overload setChecked to also alter the offset. """Overload setChecked to also alter the offset.
""" """
super().setChecked(isChecked) super().setChecked(checked)
if isChecked: if checked:
self.offset = self._xW - self._xR self.offset = self._xW - self._xR
else: else:
self.offset = self._xR self.offset = self._xR
@@ -290,10 +290,10 @@ class QSwitch(QAbstractButton):
# Events # Events
## ##
def resizeEvent(self, theEvent): def resizeEvent(self, event):
"""Overload resize to ensure correct offset. """Overload resize to ensure correct offset.
""" """
super().resizeEvent(theEvent) super().resizeEvent(event)
if self.isChecked(): if self.isChecked():
self.offset = self._xW - self._xR self.offset = self._xW - self._xR
else: else:
+1
View File
@@ -201,6 +201,7 @@ class GuiDocSplit(QDialog):
onLine = -1 onLine = -1
hLevel = 0 hLevel = 0
hLabel = aLine.strip()
if aLine.startswith("# ") and spLevel >= 1: if aLine.startswith("# ") and spLevel >= 1:
onLine = lineNo onLine = lineNo
hLevel = 1 hLevel = 1
+3 -2
View File
@@ -44,7 +44,8 @@ def logException():
"""Log the content of an exception message. """Log the content of an exception message.
""" """
exType, exValue, _ = sys.exc_info() exType, exValue, _ = sys.exc_info()
logger.error("%s: %s", exType.__name__, str(exValue)) if exType is not None:
logger.error("%s: %s", exType.__name__, str(exValue))
def formatException(exc): def formatException(exc):
@@ -131,7 +132,7 @@ class NWErrorMessage(QDialog):
try: try:
import lxml import lxml
lxmlVersion = lxml.__version__ lxmlVersion = lxml.__version__ # type: ignore
except Exception: except Exception:
lxmlVersion = "Unknown" lxmlVersion = "Unknown"