Clean up warnings and deprecations in extensions and formats

This commit is contained in:
Veronica Berglyd Olsen
2025-01-13 00:38:50 +01:00
parent ca2943775d
commit a60e0b3c87
6 changed files with 67 additions and 82 deletions
+4 -11
View File
@@ -28,7 +28,6 @@ import logging
from PyQt6.QtGui import QColor, QPainter, QPaintEvent
from PyQt6.QtWidgets import QAbstractButton, QWidget
from novelwriter import CONFIG
from novelwriter.enum import nwTrinary
from novelwriter.types import QtBlack, QtPaintAntiAlias
@@ -37,9 +36,7 @@ logger = logging.getLogger(__name__)
class StatusLED(QAbstractButton):
__slots__ = (
"_neutral", "_postitve", "_negative", "_color", "_state", "_bPx"
)
__slots__ = ("_neutral", "_postitve", "_negative", "_color", "_state")
def __init__(self, sW: int, sH: int, parent: QWidget | None = None) -> None:
super().__init__(parent=parent)
@@ -48,7 +45,6 @@ class StatusLED(QAbstractButton):
self._negative = QtBlack
self._color = QtBlack
self._state = nwTrinary.NEUTRAL
self._bPx = CONFIG.pxInt(1)
self.setFixedWidth(sW)
self.setFixedHeight(sH)
return
@@ -82,12 +78,9 @@ class StatusLED(QAbstractButton):
"""Draw the LED."""
painter = QPainter(self)
painter.setRenderHint(QtPaintAntiAlias, True)
painter.setPen(self.palette().windowText().color())
painter.setPen(self.palette().text().color())
painter.setBrush(self._color)
painter.setOpacity(1.0)
painter.drawEllipse(
self._bPx, self._bPx,
self.width() - 2*self._bPx,
self.height() - 2*self._bPx
)
painter.drawEllipse(1, 1, self.width() - 2, self.height() - 2)
painter.end()
return