Fix linting errors in the main code

This commit is contained in:
Veronica Berglyd Olsen
2025-04-07 17:18:43 +02:00
parent dab48d43a5
commit 8ed3bd889d
66 changed files with 434 additions and 344 deletions
+6 -2
View File
@@ -24,9 +24,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from PyQt6.QtCore import QEvent, QObject
from PyQt6.QtGui import QStatusTipEvent, QWheelEvent
from PyQt6.QtWidgets import QWidget
if TYPE_CHECKING:
from PyQt6.QtWidgets import QWidget
class WheelEventFilter(QObject):
@@ -40,7 +44,7 @@ class WheelEventFilter(QObject):
Reference: https://stackoverflow.com/a/17739995/5825851
"""
__slots__ = ("_parent", "_locked")
__slots__ = ("_locked", "_parent")
def __init__(self, parent: QWidget) -> None:
super().__init__(parent=parent)
+5 -3
View File
@@ -27,11 +27,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from __future__ import annotations
from enum import Enum
from typing import TYPE_CHECKING
from PyQt6.QtCore import QModelIndex, QSize, Qt, pyqtSignal, pyqtSlot
from PyQt6.QtGui import QMouseEvent, QWheelEvent
from PyQt6.QtWidgets import (
QApplication, QComboBox, QDialog, QDoubleSpinBox, QLabel, QSpinBox,
QToolButton, QTreeView, QWidget
@@ -40,7 +38,11 @@ from PyQt6.QtWidgets import (
from novelwriter import CONFIG, SHARED
from novelwriter.types import QtMouseLeft, QtMouseMiddle
if TYPE_CHECKING: # pragma: no cover
if TYPE_CHECKING:
from enum import Enum
from PyQt6.QtGui import QMouseEvent, QWheelEvent
from novelwriter.guimain import GuiMain
+1 -1
View File
@@ -113,7 +113,7 @@ class NPagedSideBar(QToolBar):
class _PagedToolButton(QToolButton):
__slots__ = ("_bH", "_tM", "_aH")
__slots__ = ("_aH", "_bH", "_tM")
def __init__(self, parent: QWidget) -> None:
super().__init__(parent=parent)
+2 -2
View File
@@ -44,8 +44,8 @@ class NProgressCircle(QProgressBar):
"""
__slots__ = (
"_text", "_point", "_dRect", "_cRect", "_dPen", "_dBrush",
"_cPen", "_bPen", "_tColor"
"_bPen", "_cPen", "_cRect", "_dBrush", "_dPen", "_dRect", "_point",
"_tColor", "_text",
)
def __init__(self, parent: QWidget, size: int, point: int) -> None:
+1 -1
View File
@@ -35,7 +35,7 @@ logger = logging.getLogger(__name__)
class StatusLED(QAbstractButton):
__slots__ = ("_neutral", "_postitve", "_negative", "_color", "_state")
__slots__ = ("_color", "_negative", "_neutral", "_postitve", "_state")
def __init__(self, sW: int, sH: int, parent: QWidget | None = None) -> None:
super().__init__(parent=parent)
+1 -1
View File
@@ -33,7 +33,7 @@ from novelwriter.types import QtMouseLeft, QtNoPen, QtPaintAntiAlias, QtSizeFixe
class NSwitch(QAbstractButton):
__slots__ = ("_xW", "_xH", "_xR", "_rH", "_rR", "_offset")
__slots__ = ("_offset", "_rH", "_rR", "_xH", "_xR", "_xW")
def __init__(self, parent: QWidget, height: int = 0) -> None:
super().__init__(parent=parent)
+5 -1
View File
@@ -23,8 +23,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from PyQt6.QtCore import pyqtSignal
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QGridLayout, QLabel, QScrollArea, QWidget
from novelwriter.extensions.switch import NSwitch
@@ -33,6 +34,9 @@ from novelwriter.types import (
QtSizeMinimumExpanding
)
if TYPE_CHECKING:
from PyQt6.QtGui import QIcon
class NSwitchBox(QScrollArea):
"""Extension: Switch Box Widget