Fix a couple of issues discovered by pylance
This commit is contained in:
@@ -267,8 +267,8 @@ class QSwitch(QAbstractButton):
|
||||
return self._offset
|
||||
|
||||
@offset.setter
|
||||
def offset(self, theOffset):
|
||||
self._offset = theOffset
|
||||
def offset(self, offset):
|
||||
self._offset = offset
|
||||
self.update()
|
||||
return
|
||||
|
||||
@@ -276,11 +276,11 @@ class QSwitch(QAbstractButton):
|
||||
# Getters and Setters
|
||||
##
|
||||
|
||||
def setChecked(self, isChecked):
|
||||
def setChecked(self, checked):
|
||||
"""Overload setChecked to also alter the offset.
|
||||
"""
|
||||
super().setChecked(isChecked)
|
||||
if isChecked:
|
||||
super().setChecked(checked)
|
||||
if checked:
|
||||
self.offset = self._xW - self._xR
|
||||
else:
|
||||
self.offset = self._xR
|
||||
@@ -290,10 +290,10 @@ class QSwitch(QAbstractButton):
|
||||
# Events
|
||||
##
|
||||
|
||||
def resizeEvent(self, theEvent):
|
||||
def resizeEvent(self, event):
|
||||
"""Overload resize to ensure correct offset.
|
||||
"""
|
||||
super().resizeEvent(theEvent)
|
||||
super().resizeEvent(event)
|
||||
if self.isChecked():
|
||||
self.offset = self._xW - self._xR
|
||||
else:
|
||||
|
||||
@@ -201,6 +201,7 @@ class GuiDocSplit(QDialog):
|
||||
|
||||
onLine = -1
|
||||
hLevel = 0
|
||||
hLabel = aLine.strip()
|
||||
if aLine.startswith("# ") and spLevel >= 1:
|
||||
onLine = lineNo
|
||||
hLevel = 1
|
||||
|
||||
@@ -44,7 +44,8 @@ def logException():
|
||||
"""Log the content of an exception message.
|
||||
"""
|
||||
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):
|
||||
@@ -131,7 +132,7 @@ class NWErrorMessage(QDialog):
|
||||
|
||||
try:
|
||||
import lxml
|
||||
lxmlVersion = lxml.__version__
|
||||
lxmlVersion = lxml.__version__ # type: ignore
|
||||
except Exception:
|
||||
lxmlVersion = "Unknown"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user