Skip to content

Commit

Permalink
Fix minor issues with some constants (#2166)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo authored Jan 9, 2025
2 parents e0f467f + 5b74125 commit 31a75f0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions novelwriter/core/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from novelwriter import SHARED
from novelwriter.common import simplified
from novelwriter.enum import nwStatusShape
from novelwriter.types import QtPaintAnitAlias, QtTransparent
from novelwriter.types import QtPaintAntiAlias, QtTransparent

if TYPE_CHECKING: # pragma: no cover
from typing import TypeGuard # Requires Python 3.10
Expand Down Expand Up @@ -195,7 +195,7 @@ def createIcon(height: int, color: QColor, shape: nwStatusShape) -> QIcon:
pixmap.fill(QtTransparent)

painter = QPainter(pixmap)
painter.setRenderHint(QtPaintAnitAlias)
painter.setRenderHint(QtPaintAntiAlias)
painter.fillPath(_SHAPES.getShape(shape), color)
painter.end()

Expand Down
2 changes: 1 addition & 1 deletion novelwriter/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(self, parent: QWidget) -> None:

font = QFont()
font.setPointSize(round(0.9*self.font().pointSize()))
font.setFamily(QFontDatabase.systemFont(QFontDatabase.FixedFont).family())
font.setFamily(QFontDatabase.systemFont(QFontDatabase.SystemFont.FixedFont).family())

self.msgBody = QPlainTextEdit()
self.msgBody.setFont(font)
Expand Down
6 changes: 3 additions & 3 deletions novelwriter/extensions/pagedsidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)

from novelwriter.types import (
QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen, QtPaintAnitAlias,
QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen, QtPaintAntiAlias,
QtSizeExpanding, QtSizeFixed
)

Expand Down Expand Up @@ -146,7 +146,7 @@ def paintEvent(self, event: QPaintEvent) -> None:
opt.initFrom(self)

paint = QPainter(self)
paint.setRenderHint(QtPaintAnitAlias, True)
paint.setRenderHint(QtPaintAntiAlias, True)
paint.setPen(QtNoPen)
paint.setBrush(QtNoBrush)

Expand Down Expand Up @@ -213,7 +213,7 @@ def paintEvent(self, event: QPaintEvent) -> None:
label that matches the button style.
"""
paint = QPainter(self)
paint.setRenderHint(QtPaintAnitAlias, True)
paint.setRenderHint(QtPaintAntiAlias, True)
paint.setPen(QtNoPen)

width = self.width()
Expand Down
6 changes: 3 additions & 3 deletions novelwriter/extensions/progressbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from PyQt5.QtWidgets import QProgressBar, QWidget

from novelwriter.types import (
QtAlignCenter, QtPaintAnitAlias, QtRoundCap, QtSizeFixed, QtSolidLine,
QtAlignCenter, QtPaintAntiAlias, QtRoundCap, QtSizeFixed, QtSolidLine,
QtTransparent
)

Expand Down Expand Up @@ -91,7 +91,7 @@ def paintEvent(self, event: QPaintEvent) -> None:
progress = 100.0*self.value()/self.maximum()
angle = ceil(16*3.6*progress)
painter = QPainter(self)
painter.setRenderHint(QtPaintAnitAlias, True)
painter.setRenderHint(QtPaintAntiAlias, True)
painter.setPen(self._dPen)
painter.setBrush(self._dBrush)
painter.drawEllipse(self._dRect)
Expand Down Expand Up @@ -119,7 +119,7 @@ def paintEvent(self, event: QPaintEvent) -> None:
if (value := self.value()) > 0:
progress = ceil(self.width()*float(value)/self.maximum())
painter = QPainter(self)
painter.setRenderHint(QtPaintAnitAlias, True)
painter.setRenderHint(QtPaintAntiAlias, True)
painter.setPen(self.palette().highlight().color())
painter.setBrush(self.palette().highlight())
painter.drawRect(0, 0, progress, self.height())
Expand Down
4 changes: 2 additions & 2 deletions novelwriter/extensions/statusled.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from novelwriter import CONFIG
from novelwriter.enum import nwTrinary
from novelwriter.types import QtBlack, QtPaintAnitAlias
from novelwriter.types import QtBlack, QtPaintAntiAlias

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -81,7 +81,7 @@ def setState(self, state: nwTrinary) -> None:
def paintEvent(self, event: QPaintEvent) -> None:
"""Draw the LED."""
painter = QPainter(self)
painter.setRenderHint(QtPaintAnitAlias, True)
painter.setRenderHint(QtPaintAntiAlias, True)
painter.setPen(self.palette().windowText().color())
painter.setBrush(self._color)
painter.setOpacity(1.0)
Expand Down
4 changes: 2 additions & 2 deletions novelwriter/extensions/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from PyQt5.QtWidgets import QAbstractButton, QWidget

from novelwriter import CONFIG, SHARED
from novelwriter.types import QtMouseLeft, QtNoPen, QtPaintAnitAlias, QtSizeFixed
from novelwriter.types import QtMouseLeft, QtNoPen, QtPaintAntiAlias, QtSizeFixed


class NSwitch(QAbstractButton):
Expand Down Expand Up @@ -90,7 +90,7 @@ def resizeEvent(self, event: QResizeEvent) -> None:
def paintEvent(self, event: QPaintEvent) -> None:
"""Drawing the switch itself."""
painter = QPainter(self)
painter.setRenderHint(QtPaintAnitAlias, True)
painter.setRenderHint(QtPaintAntiAlias, True)
painter.setPen(QtNoPen)

palette = self.palette()
Expand Down
2 changes: 1 addition & 1 deletion novelwriter/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
QtNoPen = Qt.PenStyle.NoPen
QtRoundCap = Qt.PenCapStyle.RoundCap
QtSolidLine = Qt.PenStyle.SolidLine
QtPaintAnitAlias = QPainter.RenderHint.Antialiasing
QtPaintAntiAlias = QPainter.RenderHint.Antialiasing
QtMouseOver = QStyle.StateFlag.State_MouseOver
QtSelected = QStyle.StateFlag.State_Selected

Expand Down

0 comments on commit 31a75f0

Please sign in to comment.