Clean up a lot more namespace flags
This commit is contained in:
@@ -29,7 +29,9 @@ from PyQt5.QtCore import QRect
|
||||
from PyQt5.QtGui import QBrush, QColor, QPaintEvent, QPainter, QPen
|
||||
from PyQt5.QtWidgets import QProgressBar, QSizePolicy, QWidget
|
||||
|
||||
from novelwriter.types import QtAlignCenter, QtRoundCap, QtSolidLine, QtTransparent
|
||||
from novelwriter.types import (
|
||||
QtPaintAnitAlias, QtAlignCenter, QtRoundCap, QtSolidLine, QtTransparent
|
||||
)
|
||||
|
||||
|
||||
class NProgressCircle(QProgressBar):
|
||||
@@ -87,7 +89,7 @@ class NProgressCircle(QProgressBar):
|
||||
progress = 100.0*self.value()/self.maximum()
|
||||
angle = ceil(16*3.6*progress)
|
||||
painter = QPainter(self)
|
||||
painter.setRenderHint(QPainter.Antialiasing, True)
|
||||
painter.setRenderHint(QtPaintAnitAlias, True)
|
||||
painter.setPen(self._dPen)
|
||||
painter.setBrush(self._dBrush)
|
||||
painter.drawEllipse(self._dRect)
|
||||
|
||||
@@ -258,7 +258,7 @@ class NColourLabel(QLabel):
|
||||
font.setWeight(QFont.Weight.Bold if bold else QFont.Weight.Normal)
|
||||
if color:
|
||||
colour = self.palette()
|
||||
colour.setColor(QPalette.WindowText, color)
|
||||
colour.setColor(QPalette.ColorRole.WindowText, color)
|
||||
self.setPalette(colour)
|
||||
|
||||
self.setFont(font)
|
||||
|
||||
@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import (
|
||||
QStyleOptionToolButton, QToolBar, QToolButton, QWidget
|
||||
)
|
||||
|
||||
from novelwriter.types import QtAlignLeft, QtNoBrush, QtNoPen
|
||||
from novelwriter.types import QtPaintAnitAlias, QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen
|
||||
|
||||
|
||||
class NPagedSideBar(QToolBar):
|
||||
@@ -125,7 +125,7 @@ class _NPagedToolButton(QToolButton):
|
||||
fH = self.fontMetrics().height()
|
||||
self._bH = round(fH * 1.7)
|
||||
self._tM = (self._bH - fH)//2
|
||||
self._lM = 3*self.style().pixelMetric(QStyle.PM_ButtonMargin)//2
|
||||
self._lM = 3*self.style().pixelMetric(QStyle.PixelMetric.PM_ButtonMargin)//2
|
||||
self._cR = self._lM//2
|
||||
self._aH = 2*fH//7
|
||||
self.setFixedHeight(self._bH)
|
||||
@@ -145,7 +145,7 @@ class _NPagedToolButton(QToolButton):
|
||||
opt.initFrom(self)
|
||||
|
||||
paint = QPainter(self)
|
||||
paint.setRenderHint(QPainter.Antialiasing, True)
|
||||
paint.setRenderHint(QtPaintAnitAlias, True)
|
||||
paint.setPen(QtNoPen)
|
||||
paint.setBrush(QtNoBrush)
|
||||
|
||||
@@ -153,7 +153,7 @@ class _NPagedToolButton(QToolButton):
|
||||
height = self.height()
|
||||
palette = self.palette()
|
||||
|
||||
if opt.state & QStyle.State_MouseOver == QStyle.State_MouseOver:
|
||||
if opt.state & QtMouseOver == QtMouseOver:
|
||||
backCol = palette.base()
|
||||
paint.setBrush(backCol)
|
||||
paint.setOpacity(0.75)
|
||||
@@ -202,7 +202,7 @@ class _NPagedToolLabel(QLabel):
|
||||
fH = self.fontMetrics().height()
|
||||
self._bH = round(fH * 1.7)
|
||||
self._tM = (self._bH - fH)//2
|
||||
self._lM = self.style().pixelMetric(QStyle.PM_ButtonMargin)//2
|
||||
self._lM = self.style().pixelMetric(QStyle.PixelMetric.PM_ButtonMargin)//2
|
||||
self.setFixedHeight(self._bH)
|
||||
|
||||
self._textCol = textColor or self.palette().text().color()
|
||||
@@ -214,7 +214,7 @@ class _NPagedToolLabel(QLabel):
|
||||
label that matches the button style.
|
||||
"""
|
||||
paint = QPainter(self)
|
||||
paint.setRenderHint(QPainter.Antialiasing, True)
|
||||
paint.setRenderHint(QtPaintAnitAlias, True)
|
||||
paint.setPen(QtNoPen)
|
||||
|
||||
width = self.width()
|
||||
|
||||
@@ -28,6 +28,8 @@ from math import ceil
|
||||
from PyQt5.QtGui import QPaintEvent, QPainter
|
||||
from PyQt5.QtWidgets import QProgressBar, QWidget
|
||||
|
||||
from novelwriter.types import QtPaintAnitAlias
|
||||
|
||||
|
||||
class NProgressSimple(QProgressBar):
|
||||
"""Extension: Simple Progress Widget
|
||||
@@ -44,7 +46,7 @@ class NProgressSimple(QProgressBar):
|
||||
if (value := self.value()) > 0:
|
||||
progress = ceil(self.width()*float(value)/self.maximum())
|
||||
painter = QPainter(self)
|
||||
painter.setRenderHint(QPainter.Antialiasing, True)
|
||||
painter.setRenderHint(QtPaintAnitAlias, True)
|
||||
painter.setPen(self.palette().highlight().color())
|
||||
painter.setBrush(self.palette().highlight())
|
||||
painter.drawRect(0, 0, progress, self.height())
|
||||
|
||||
@@ -30,6 +30,8 @@ from typing import Literal
|
||||
from PyQt5.QtGui import QColor, QPaintEvent, QPainter
|
||||
from PyQt5.QtWidgets import QAbstractButton, QWidget
|
||||
|
||||
from novelwriter.types import QtPaintAnitAlias
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -67,7 +69,7 @@ class StatusLED(QAbstractButton):
|
||||
def paintEvent(self, event: QPaintEvent) -> None:
|
||||
"""Draw the LED."""
|
||||
painter = QPainter(self)
|
||||
painter.setRenderHint(QPainter.Antialiasing, True)
|
||||
painter.setRenderHint(QtPaintAnitAlias, True)
|
||||
painter.setPen(self.palette().dark().color())
|
||||
painter.setBrush(self._theCol)
|
||||
painter.setOpacity(1.0)
|
||||
|
||||
@@ -28,7 +28,7 @@ from PyQt5.QtCore import QEvent, QPropertyAnimation, Qt, pyqtProperty
|
||||
from PyQt5.QtWidgets import QAbstractButton, QSizePolicy, QWidget
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.types import QtMouseLeft, QtNoPen
|
||||
from novelwriter.types import QtPaintAnitAlias, QtMouseLeft, QtNoPen
|
||||
|
||||
|
||||
class NSwitch(QAbstractButton):
|
||||
@@ -90,7 +90,7 @@ class NSwitch(QAbstractButton):
|
||||
def paintEvent(self, event: QPaintEvent) -> None:
|
||||
"""Drawing the switch itself."""
|
||||
painter = QPainter(self)
|
||||
painter.setRenderHint(QPainter.Antialiasing, True)
|
||||
painter.setRenderHint(QtPaintAnitAlias, True)
|
||||
painter.setPen(QtNoPen)
|
||||
|
||||
palette = self.palette()
|
||||
|
||||
Reference in New Issue
Block a user