From 5a177e500e4181813e709f787af59f3fabfa3ab3 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Wed, 18 Jun 2025 20:50:12 +0200 Subject: [PATCH 1/4] Update the help text for theme selections in Preferences --- novelwriter/dialogs/preferences.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/novelwriter/dialogs/preferences.py b/novelwriter/dialogs/preferences.py index 23620cef..e7155bfd 100644 --- a/novelwriter/dialogs/preferences.py +++ b/novelwriter/dialogs/preferences.py @@ -180,11 +180,11 @@ class GuiPreferences(NDialog): self.mainForm.addRow( self.tr("Light colour theme"), self.lightTheme, - self.tr("User interface colour theme."), stretch=(3, 2) + self.tr("You can change theme mode from the sidebar."), stretch=(3, 2) ) self.mainForm.addRow( self.tr("Dark colour theme"), self.darkTheme, - self.tr("User interface colour theme."), stretch=(3, 2) + self.tr("You can change theme mode from the sidebar."), stretch=(3, 2) ) # Icon Theme From 110d8b8e5942409945d4d6a8f76cf3e79286f83b Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Wed, 18 Jun 2025 20:50:33 +0200 Subject: [PATCH 2/4] Swap value and modifier colours in default themes --- novelwriter/assets/themes/default_dark.conf | 4 ++-- novelwriter/assets/themes/default_light.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/novelwriter/assets/themes/default_dark.conf b/novelwriter/assets/themes/default_dark.conf index 0c7bd643..894fb9c8 100644 --- a/novelwriter/assets/themes/default_dark.conf +++ b/novelwriter/assets/themes/default_dark.conf @@ -69,10 +69,10 @@ hidden = faded shortcode = green keyword = red tag = green -value = blue +value = green optional = green spellcheckline = red errorline = green replacetag = green -modifier = green +modifier = blue texthighlight = yellow:72 diff --git a/novelwriter/assets/themes/default_light.conf b/novelwriter/assets/themes/default_light.conf index fb4e707a..704bb84f 100644 --- a/novelwriter/assets/themes/default_light.conf +++ b/novelwriter/assets/themes/default_light.conf @@ -69,10 +69,10 @@ hidden = faded shortcode = green keyword = red tag = green -value = blue +value = green optional = green spellcheckline = red errorline = green replacetag = green -modifier = green +modifier = blue texthighlight = yellow:72 From dbf0b5d3f756b260d44e3f91c0192fdc2896f35c Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 19 Jun 2025 19:29:14 +0200 Subject: [PATCH 3/4] Modify the style to show a scroll bar for combo boxes --- novelwriter/__init__.py | 3 ++- novelwriter/dialogs/docsplit.py | 8 ++++---- novelwriter/extensions/modified.py | 9 ++++++++- novelwriter/extensions/novelselector.py | 7 ++++++- novelwriter/types.py | 1 + 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py index 488353b3..3f2bc134 100644 --- a/novelwriter/__init__.py +++ b/novelwriter/__init__.py @@ -296,7 +296,8 @@ def _createApp(style: str) -> QApplication: """Create the app. This is done in a function to make it easier to block app creation during testing. """ - app = QApplication([CONFIG.appName, f"-style={style}"]) + app = QApplication([CONFIG.appName]) + app.setStyle(style) app.setApplicationName(CONFIG.appName) app.setApplicationVersion(__version__) app.setOrganizationDomain(__domain__) diff --git a/novelwriter/dialogs/docsplit.py b/novelwriter/dialogs/docsplit.py index a67aafa7..a2acd53f 100644 --- a/novelwriter/dialogs/docsplit.py +++ b/novelwriter/dialogs/docsplit.py @@ -28,13 +28,13 @@ import logging from PyQt6.QtCore import pyqtSlot from PyQt6.QtWidgets import ( - QAbstractItemView, QComboBox, QDialogButtonBox, QGridLayout, QLabel, - QListWidget, QListWidgetItem, QVBoxLayout, QWidget + QAbstractItemView, QDialogButtonBox, QGridLayout, QLabel, QListWidget, + QListWidgetItem, QVBoxLayout, QWidget ) from novelwriter import SHARED from novelwriter.extensions.configlayout import NColorLabel -from novelwriter.extensions.modified import NDialog +from novelwriter.extensions.modified import NComboBox, NDialog from novelwriter.extensions.switch import NSwitch from novelwriter.types import QtAccepted, QtDialogCancel, QtDialogOk, QtUserRole @@ -79,7 +79,7 @@ class GuiDocSplit(NDialog): self.listBox.setMinimumWidth(400) self.listBox.setMinimumHeight(180) - self.splitLevel = QComboBox(self) + self.splitLevel = NComboBox(self) self.splitLevel.addItem(self.tr("Split on Heading Level 1 (Partition)"), 1) self.splitLevel.addItem(self.tr("Split up to Heading Level 2 (Chapter)"), 2) self.splitLevel.addItem(self.tr("Split up to Heading Level 3 (Scene)"), 3) diff --git a/novelwriter/extensions/modified.py b/novelwriter/extensions/modified.py index 9bea4c78..4b2f663e 100644 --- a/novelwriter/extensions/modified.py +++ b/novelwriter/extensions/modified.py @@ -117,12 +117,19 @@ class NTreeView(QTreeView): class NComboBox(QComboBox): - def __init__(self, parent: QWidget | None = None) -> None: + def __init__(self, parent: QWidget | None = None, maxItems: int = 15) -> None: super().__init__(parent=parent) self.setFocusPolicy(Qt.FocusPolicy.StrongFocus) + self.setMaxVisibleItems(maxItems) + + # The style sheet disables Fusion style pop-up mode on some platforms + # and allows for scrolling of long lists of items + self.setStyleSheet("QComboBox {combobox-popup: 0;}") + return def wheelEvent(self, event: QWheelEvent) -> None: + """Only capture the mouse wheel if the widget has focus.""" if self.hasFocus(): super().wheelEvent(event) else: diff --git a/novelwriter/extensions/novelselector.py b/novelwriter/extensions/novelselector.py index ee585a0d..e3b1e93f 100644 --- a/novelwriter/extensions/novelselector.py +++ b/novelwriter/extensions/novelselector.py @@ -25,14 +25,19 @@ from __future__ import annotations import logging +from typing import TYPE_CHECKING + from PyQt6.QtCore import pyqtSignal, pyqtSlot from PyQt6.QtGui import QPalette -from PyQt6.QtWidgets import QComboBox, QWidget +from PyQt6.QtWidgets import QComboBox from novelwriter import SHARED from novelwriter.constants import nwLabels from novelwriter.enum import nwItemClass +if TYPE_CHECKING: + from PyQt6.QtWidgets import QWidget + logger = logging.getLogger(__name__) diff --git a/novelwriter/types.py b/novelwriter/types.py index fb0faebd..ead3397f 100644 --- a/novelwriter/types.py +++ b/novelwriter/types.py @@ -126,6 +126,7 @@ QtHeaderFixed = QHeaderView.ResizeMode.Fixed # Scroll Bar Policy +QtScrollAlwaysOn = Qt.ScrollBarPolicy.ScrollBarAlwaysOn QtScrollAlwaysOff = Qt.ScrollBarPolicy.ScrollBarAlwaysOff QtScrollAsNeeded = Qt.ScrollBarPolicy.ScrollBarAsNeeded From 4eaac8dbe87301c7476f21e4915f9ab4e2747ddd Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Thu, 19 Jun 2025 20:06:30 +0200 Subject: [PATCH 4/4] Fix issues with the Solarized themes --- novelwriter/assets/themes/solarized_dark.conf | 26 +++++++++---------- .../assets/themes/solarized_light.conf | 20 +++++++------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/novelwriter/assets/themes/solarized_dark.conf b/novelwriter/assets/themes/solarized_dark.conf index 8bf4e983..cf3fdc3c 100644 --- a/novelwriter/assets/themes/solarized_dark.conf +++ b/novelwriter/assets/themes/solarized_dark.conf @@ -27,7 +27,7 @@ licenseurl = https://github.com/altercation/solarized/blob/master/LICENSE ## [Base] -base = #073642 +base = #002b36 default = #fdf6e3 faded = #eee8d5 red = #dc322f @@ -51,12 +51,12 @@ inactive = red disabled = faded [Palette] -window = #002b36 +window = #073642 windowtext = default base = base alternatebase = #586e75 text = default -tooltipbase = yellow +tooltipbase = yellow:L150 tooltiptext = #002b36 button = base buttontext = default @@ -75,21 +75,21 @@ errortext = red [Syntax] background = base text = default -line = default:32 +line = #073642 link = blue -headertext = default:D125 -headertag = cyan +headertext = blue +headertag = #657b83 emphasis = blue dialog = cyan -altdialog = cyan -note = cyan:L115 -hidden = default:D150 -shortcode = yellow +altdialog = red +note = cyan:D125 +hidden = default:L200 +shortcode = blue keyword = green -tag = orange +tag = yellow value = orange -optional = cyan:L115 -spellcheckline = orange +optional = cyan:D125 +spellcheckline = red errorline = red replacetag = green modifier = yellow diff --git a/novelwriter/assets/themes/solarized_light.conf b/novelwriter/assets/themes/solarized_light.conf index 5f01abe7..aba3a711 100644 --- a/novelwriter/assets/themes/solarized_light.conf +++ b/novelwriter/assets/themes/solarized_light.conf @@ -27,7 +27,7 @@ licenseurl = https://github.com/altercation/solarized/blob/master/LICENSE ## [Base] -base = #eee8d5 +base = #fdf6e3 default = #002b36 faded = #073642 red = #dc322f @@ -51,12 +51,12 @@ inactive = red disabled = faded [Palette] -window = #fdf6e3 +window = #eee8d5 windowtext = default base = base alternatebase = #93a1a1 text = default -tooltipbase = yellow +tooltipbase = yellow:L150 tooltiptext = #002b36 button = base buttontext = default @@ -75,21 +75,21 @@ errortext = red [Syntax] background = base text = default -line = default:32 +line = #eee8d5 link = blue -headertext = default:L125 -headertag = cyan +headertext = blue +headertag = #657b83 emphasis = blue dialog = cyan -altdialog = cyan +altdialog = red note = cyan:D125 hidden = default:L200 -shortcode = yellow +shortcode = blue keyword = green -tag = orange +tag = yellow value = orange optional = cyan:D125 -spellcheckline = orange +spellcheckline = red errorline = red replacetag = green modifier = yellow