diff --git a/novelwriter/extensions/configlayout.py b/novelwriter/extensions/configlayout.py index 3ab6b87b..3d23fede 100644 --- a/novelwriter/extensions/configlayout.py +++ b/novelwriter/extensions/configlayout.py @@ -59,10 +59,7 @@ class NConfigLayout(QGridLayout): def setHelpTextStyle(self, color: QColor | list | tuple, fontScale: float = FONT_SCALE) -> None: """Set the text color for the help text.""" - if isinstance(color, QColor): - self._helpCol = color - else: - self._helpCol = QColor(*color) + self._helpCol = color if isinstance(color, QColor) else QColor(*color) self._fontScale = fontScale return @@ -74,12 +71,6 @@ class NConfigLayout(QGridLayout): qHelp.setText(text) return - def setLabelText(self, row: int, text: str) -> None: - """Set the text for the main label.""" - if row in self._itemMap: - self._itemMap[row](0).setText(text) - return - ## # Class Methods ## @@ -211,10 +202,7 @@ class NHelpLabel(QLabel): fontSize: float = FONT_SCALE) -> None: super().__init__(text) - if isinstance(color, QColor): - qCol = color - else: - qCol = QColor(*color) + qCol = color if isinstance(color, QColor) else QColor(*color) lblCol = self.palette() lblCol.setColor(QPalette.WindowText, qCol) diff --git a/novelwriter/extensions/pagedsidebar.py b/novelwriter/extensions/pagedsidebar.py index 6da97974..927d40d7 100644 --- a/novelwriter/extensions/pagedsidebar.py +++ b/novelwriter/extensions/pagedsidebar.py @@ -65,10 +65,7 @@ class NPagedSideBar(QToolBar): def setLabelColor(self, color: list | QColor) -> None: """Set the text color for the labels.""" - if isinstance(color, list): - self._labelCol = QColor(*color) - elif isinstance(color, QColor): - self._labelCol = color + self._labelCol = color if isinstance(color, QColor) else QColor(*color) return def addSeparator(self) -> None: diff --git a/novelwriter/extensions/simpleprogress.py b/novelwriter/extensions/simpleprogress.py index 30a11168..0a74ae4e 100644 --- a/novelwriter/extensions/simpleprogress.py +++ b/novelwriter/extensions/simpleprogress.py @@ -41,14 +41,13 @@ class NProgressSimple(QProgressBar): def paintEvent(self, event: QPaintEvent) -> None: """Custom painter for the progress bar.""" - if self.value() == 0: - return - progress = ceil(self.width()*float(self.value())/self.maximum()) - qPaint = QPainter(self) - qPaint.setRenderHint(QPainter.Antialiasing, True) - qPaint.setPen(self.palette().highlight().color()) - qPaint.setBrush(self.palette().highlight()) - qPaint.drawRect(0, 0, progress, self.height()) + if (value := self.value()) > 0: + progress = ceil(self.width()*float(value)/self.maximum()) + qPaint = QPainter(self) + qPaint.setRenderHint(QPainter.Antialiasing, True) + qPaint.setPen(self.palette().highlight().color()) + qPaint.setBrush(self.palette().highlight()) + qPaint.drawRect(0, 0, progress, self.height()) return # END Class NProgressSimple diff --git a/novelwriter/extensions/switch.py b/novelwriter/extensions/switch.py index e702a6b6..23810706 100644 --- a/novelwriter/extensions/switch.py +++ b/novelwriter/extensions/switch.py @@ -134,10 +134,10 @@ class NSwitch(QAbstractButton): qPaint.setBrush(thumbBrush) qPaint.drawEllipse(self._offset - self._rR, self._rB, self._rH, self._rH) - theFont = qPaint.font() - theFont.setPixelSize(self._xT) + font = qPaint.font() + font.setPixelSize(self._xT) qPaint.setPen(textColor) - qPaint.setFont(theFont) + qPaint.setFont(font) qPaint.drawText( QRectF(self._offset - self._rR, self._rB, self._rH, self._rH), Qt.AlignCenter, thumbText diff --git a/novelwriter/extensions/switchbox.py b/novelwriter/extensions/switchbox.py index 98db295a..4b81e21d 100644 --- a/novelwriter/extensions/switchbox.py +++ b/novelwriter/extensions/switchbox.py @@ -106,11 +106,6 @@ class NSwitchBox(QScrollArea): self._bumpIndex() return - def setInnerContentsMargins(self, left: int, top: int, right: int, bottom: int) -> None: - """Set the contents margins of the inner layout.""" - self._content.setContentsMargins(left, top, right, bottom) - return - ## # Internal Functions ## diff --git a/novelwriter/tools/manusbuild.py b/novelwriter/tools/manusbuild.py index d7a8096e..82480b77 100644 --- a/novelwriter/tools/manusbuild.py +++ b/novelwriter/tools/manusbuild.py @@ -331,7 +331,7 @@ class GuiManuscriptBuild(QDialog): self._build.setLastBuildName(bName) self._build.setLastFormat(bFormat) - QTimer.singleShot(1000, self._resetProgress) + QTimer.singleShot(3000, self._resetProgress) return True diff --git a/tests/test_gui/test_gui_mainmenu.py b/tests/test_gui/test_gui_mainmenu.py index 91c1ac13..95eec7b8 100644 --- a/tests/test_gui/test_gui_mainmenu.py +++ b/tests/test_gui/test_gui_mainmenu.py @@ -441,6 +441,7 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncPath, projPath, mockRnd): assert nwGUI.docEditor.isEmpty # qtbot.stop() + nwGUI.docEditor.clear() # Check Menu Entries nwGUI.mainMenu.aInsENDash.activate(QAction.Trigger)