From 4afbd98d6ff2bf9ce7121b83b5cbddfa51e16e80 Mon Sep 17 00:00:00 2001
From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com>
Date: Thu, 11 Jan 2024 09:17:46 +0100
Subject: [PATCH] Add icons to preferences buttons
---
.../assets/icons/typicons_dark/icons.conf | 1 +
.../icons/typicons_dark/typ_th-dot-more.svg | 4 +++
.../assets/icons/typicons_light/icons.conf | 1 +
.../icons/typicons_light/typ_th-dot-more.svg | 4 +++
novelwriter/dialogs/preferences.py | 32 +++++++++----------
novelwriter/extensions/configlayout.py | 8 +++--
novelwriter/gui/theme.py | 2 +-
7 files changed, 32 insertions(+), 20 deletions(-)
create mode 100644 novelwriter/assets/icons/typicons_dark/typ_th-dot-more.svg
create mode 100644 novelwriter/assets/icons/typicons_light/typ_th-dot-more.svg
diff --git a/novelwriter/assets/icons/typicons_dark/icons.conf b/novelwriter/assets/icons/typicons_dark/icons.conf
index 44317317..f66874ee 100644
--- a/novelwriter/assets/icons/typicons_dark/icons.conf
+++ b/novelwriter/assets/icons/typicons_dark/icons.conf
@@ -61,6 +61,7 @@ forward = typ_chevron-right.svg
maximise = typ_arrow-maximise.svg
menu = typ_th-dot-menu.svg
minimise = typ_arrow-minimise.svg
+more = typ_th-dot-more.svg
noncheckable = mixed_input-none.svg
panel = nw_panel.svg
proj_chapter = mixed_document-chapter.svg
diff --git a/novelwriter/assets/icons/typicons_dark/typ_th-dot-more.svg b/novelwriter/assets/icons/typicons_dark/typ_th-dot-more.svg
new file mode 100644
index 00000000..782996dc
--- /dev/null
+++ b/novelwriter/assets/icons/typicons_dark/typ_th-dot-more.svg
@@ -0,0 +1,4 @@
+
+
diff --git a/novelwriter/assets/icons/typicons_light/icons.conf b/novelwriter/assets/icons/typicons_light/icons.conf
index 7579bb70..3a6837d9 100644
--- a/novelwriter/assets/icons/typicons_light/icons.conf
+++ b/novelwriter/assets/icons/typicons_light/icons.conf
@@ -61,6 +61,7 @@ forward = typ_chevron-right.svg
maximise = typ_arrow-maximise.svg
menu = typ_th-dot-menu.svg
minimise = typ_arrow-minimise.svg
+more = typ_th-dot-more.svg
noncheckable = mixed_input-none.svg
panel = nw_panel.svg
proj_chapter = mixed_document-chapter.svg
diff --git a/novelwriter/assets/icons/typicons_light/typ_th-dot-more.svg b/novelwriter/assets/icons/typicons_light/typ_th-dot-more.svg
new file mode 100644
index 00000000..779bc23f
--- /dev/null
+++ b/novelwriter/assets/icons/typicons_light/typ_th-dot-more.svg
@@ -0,0 +1,4 @@
+
+
diff --git a/novelwriter/dialogs/preferences.py b/novelwriter/dialogs/preferences.py
index 633253c0..34349c91 100644
--- a/novelwriter/dialogs/preferences.py
+++ b/novelwriter/dialogs/preferences.py
@@ -31,7 +31,7 @@ from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import (
QAbstractButton, QComboBox, QCompleter, QDialog, QDialogButtonBox,
QDoubleSpinBox, QFileDialog, QFontDialog, QHBoxLayout, QLabel, QLineEdit,
- QPushButton, QSpinBox, QVBoxLayout, QWidget, qApp
+ QPushButton, QSpinBox, QToolButton, QVBoxLayout, QWidget, qApp
)
from novelwriter import CONFIG, SHARED
@@ -54,7 +54,7 @@ class GuiPreferences(QDialog):
logger.debug("Create: GuiPreferences")
self.setObjectName("GuiPreferences")
- self.setWindowTitle(CONFIG.appName)
+ self.setWindowTitle(self.tr("Preferences"))
self.setMinimumSize(CONFIG.pxInt(600), CONFIG.pxInt(500))
self.resize(*CONFIG.preferencesWinSize)
@@ -139,6 +139,7 @@ class GuiPreferences(QDialog):
"""Build the settings form."""
section = 0
minWidth = CONFIG.pxInt(200)
+ mIcon = SHARED.theme.getIcon("more")
# Appearance
# ==========
@@ -181,8 +182,8 @@ class GuiPreferences(QDialog):
self.guiFont.setReadOnly(True)
self.guiFont.setFixedWidth(CONFIG.pxInt(162))
self.guiFont.setText(CONFIG.guiFont)
- self.guiFontButton = QPushButton("...", self)
- self.guiFontButton.setMaximumWidth(int(2.5*SHARED.theme.getTextWidth("...")))
+ self.guiFontButton = QToolButton(self)
+ self.guiFontButton.setIcon(mIcon)
self.guiFontButton.clicked.connect(self._selectGuiFont)
self.mainForm.addRow(
self.tr("Application font family"),
@@ -249,8 +250,8 @@ class GuiPreferences(QDialog):
self.textFont.setReadOnly(True)
self.textFont.setFixedWidth(CONFIG.pxInt(162))
self.textFont.setText(CONFIG.textFont)
- self.textFontButton = QPushButton("...", self)
- self.textFontButton.setMaximumWidth(int(2.5*SHARED.theme.getTextWidth("...")))
+ self.textFontButton = QToolButton(self)
+ self.textFontButton.setIcon(mIcon)
self.textFontButton.clicked.connect(self._selectTextFont)
self.mainForm.addRow(
self.tr("Document font family"),
@@ -722,9 +723,8 @@ class GuiPreferences(QDialog):
self.sidebar.addButton(title, section)
self.mainForm.addGroupLabel(title, section)
- qWidth = CONFIG.pxInt(40)
- bWidth = int(2.5*SHARED.theme.getTextWidth("..."))
self.quoteSym = {}
+ qWidth = CONFIG.pxInt(40)
# Single Quote Style
self.quoteSym["SO"] = QLineEdit(self)
@@ -733,8 +733,8 @@ class GuiPreferences(QDialog):
self.quoteSym["SO"].setFixedWidth(qWidth)
self.quoteSym["SO"].setAlignment(Qt.AlignCenter)
self.quoteSym["SO"].setText(CONFIG.fmtSQuoteOpen)
- self.btnSingleStyleO = QPushButton("...", self)
- self.btnSingleStyleO.setMaximumWidth(bWidth)
+ self.btnSingleStyleO = QToolButton(self)
+ self.btnSingleStyleO.setIcon(mIcon)
self.btnSingleStyleO.clicked.connect(lambda: self._getQuote("SO"))
self.mainForm.addRow(
self.tr("Single quote open style"),
@@ -749,8 +749,8 @@ class GuiPreferences(QDialog):
self.quoteSym["SC"].setFixedWidth(qWidth)
self.quoteSym["SC"].setAlignment(Qt.AlignCenter)
self.quoteSym["SC"].setText(CONFIG.fmtSQuoteClose)
- self.btnSingleStyleC = QPushButton("...", self)
- self.btnSingleStyleC.setMaximumWidth(bWidth)
+ self.btnSingleStyleC = QToolButton(self)
+ self.btnSingleStyleC.setIcon(mIcon)
self.btnSingleStyleC.clicked.connect(lambda: self._getQuote("SC"))
self.mainForm.addRow(
self.tr("Single quote close style"),
@@ -766,8 +766,8 @@ class GuiPreferences(QDialog):
self.quoteSym["DO"].setFixedWidth(qWidth)
self.quoteSym["DO"].setAlignment(Qt.AlignCenter)
self.quoteSym["DO"].setText(CONFIG.fmtDQuoteOpen)
- self.btnDoubleStyleO = QPushButton("...", self)
- self.btnDoubleStyleO.setMaximumWidth(bWidth)
+ self.btnDoubleStyleO = QToolButton(self)
+ self.btnDoubleStyleO.setIcon(mIcon)
self.btnDoubleStyleO.clicked.connect(lambda: self._getQuote("DO"))
self.mainForm.addRow(
self.tr("Double quote open style"),
@@ -782,8 +782,8 @@ class GuiPreferences(QDialog):
self.quoteSym["DC"].setFixedWidth(qWidth)
self.quoteSym["DC"].setAlignment(Qt.AlignCenter)
self.quoteSym["DC"].setText(CONFIG.fmtDQuoteClose)
- self.btnDoubleStyleC = QPushButton("...", self)
- self.btnDoubleStyleC.setMaximumWidth(bWidth)
+ self.btnDoubleStyleC = QToolButton(self)
+ self.btnDoubleStyleC.setIcon(mIcon)
self.btnDoubleStyleC.clicked.connect(lambda: self._getQuote("DC"))
self.mainForm.addRow(
self.tr("Double quote close style"),
diff --git a/novelwriter/extensions/configlayout.py b/novelwriter/extensions/configlayout.py
index 9cb932cd..d714cf00 100644
--- a/novelwriter/extensions/configlayout.py
+++ b/novelwriter/extensions/configlayout.py
@@ -122,15 +122,16 @@ class NScrollableForm(QScrollArea):
button: QWidget | None = None, editable: str | None = None) -> None:
"""Add a label and a widget as a new row of the form."""
row = QHBoxLayout()
+ row.setSpacing(CONFIG.pxInt(4))
- wSp = CONFIG.pxInt(12)
+ mPx = CONFIG.pxInt(12)
qLabel = QLabel(label, self)
- qLabel.setIndent(wSp)
+ qLabel.setIndent(mPx)
qLabel.setBuddy(widget)
if helpText:
qHelp = NHelpLabel(str(helpText), self._helpCol, self._fontScale)
- qHelp.setIndent(wSp)
+ qHelp.setIndent(mPx)
labelBox = QVBoxLayout()
labelBox.addWidget(qLabel)
labelBox.addWidget(qHelp)
@@ -142,6 +143,7 @@ class NScrollableForm(QScrollArea):
else:
row.addWidget(qLabel)
+ row.addSpacing(mPx)
row.addWidget(widget)
if isinstance(unit, str):
diff --git a/novelwriter/gui/theme.py b/novelwriter/gui/theme.py
index 65642ea4..2e3e8b94 100644
--- a/novelwriter/gui/theme.py
+++ b/novelwriter/gui/theme.py
@@ -466,7 +466,7 @@ class GuiIcons:
# General Button Icons
"add", "add_document", "backward", "bookmark", "browse", "checked", "close", "cross",
- "document", "down", "edit", "export", "forward", "maximise", "menu", "minimise",
+ "document", "down", "edit", "export", "forward", "maximise", "menu", "minimise", "more",
"noncheckable", "panel", "refresh", "remove", "revert", "search_replace", "search",
"settings", "star", "unchecked", "up", "view",