Improve how tool buttons are generated
@@ -100,8 +100,8 @@ status_time = typ_stopwatch-grey.svg
|
||||
sticky-off = typ_pin-outline.svg
|
||||
sticky-on = typ_pin.svg
|
||||
unchecked = mixed_input-unchecked.svg
|
||||
unfold-hide = typ_arrow-right.svg
|
||||
unfold-show = typ_arrow-down.svg
|
||||
unfold-hide = typ_unfold-hidden.svg
|
||||
unfold-show = typ_unfold-visible.svg
|
||||
up = typ_chevron-up.svg
|
||||
view = typ_eye.svg
|
||||
view_build = typ_export-grey.svg
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m1.5077 8.1077 10.492 10.662 10.492-10.662c0.33846-0.33846 0.50769-0.84615 0.50769-1.1846 0-0.33846-0.16923-0.84615-0.50769-1.1846-0.33846-0.33846-0.67692-0.50769-1.1846-0.50769h-18.615c-0.50769 0-0.84615 0.16923-1.1846 0.50769-0.33846 0.33846-0.50769 0.84615-0.50769 1.1846 0 0.33846 0.16923 0.84615 0.50769 1.1846z" fill="#aeaeae" stroke-width="1.6923"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 511 B |
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m8.1077 22.492 10.662-10.492-10.662-10.492c-0.33846-0.33846-0.84615-0.50769-1.1846-0.50769-0.33846 0-0.84615 0.16923-1.1846 0.50769-0.33846 0.33846-0.50769 0.67692-0.50769 1.1846v18.615c0 0.50769 0.16923 0.84615 0.50769 1.1846 0.33846 0.33846 0.84615 0.50769 1.1846 0.50769 0.33846 0 0.84615-0.16923 1.1846-0.50769z" fill="#aeaeae" stroke-width="1.6923"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 510 B |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m9.8767 17.723 5.8157-5.723-5.8157-5.723c-0.18462-0.18462-0.46155-0.27693-0.64616-0.27693-0.18462 0-0.46155 0.092309-0.64616 0.27693-0.18462 0.18462-0.27693 0.36924-0.27693 0.64616v10.154c0 0.27693 0.092309 0.46154 0.27693 0.64616 0.18462 0.18462 0.46155 0.27693 0.64616 0.27693 0.18462 0 0.46155-0.09231 0.64616-0.27693z" fill="#aeaeae" stroke-width=".92309"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 516 B |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m6.277 9.8767 5.723 5.8157 5.723-5.8157c0.18462-0.18462 0.27693-0.46155 0.27693-0.64616 0-0.18462-0.092309-0.46155-0.27693-0.64616-0.18462-0.18462-0.36924-0.27693-0.64616-0.27693h-10.154c-0.27693 0-0.46155 0.092309-0.64616 0.27693-0.18462 0.18462-0.27693 0.46155-0.27693 0.64616 0 0.18462 0.092309 0.46155 0.27693 0.64616z" fill="#aeaeae" stroke-width=".92309"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 517 B |
@@ -100,8 +100,8 @@ status_time = typ_stopwatch-grey.svg
|
||||
sticky-off = typ_pin-outline.svg
|
||||
sticky-on = typ_pin.svg
|
||||
unchecked = mixed_input-unchecked.svg
|
||||
unfold-hide = typ_arrow-right.svg
|
||||
unfold-show = typ_arrow-down.svg
|
||||
unfold-hide = typ_unfold-hidden.svg
|
||||
unfold-show = typ_unfold-visible.svg
|
||||
up = typ_chevron-up.svg
|
||||
view = typ_eye.svg
|
||||
view_build = typ_export-grey.svg
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m1.5077 8.1077 10.492 10.662 10.492-10.662c0.33846-0.33846 0.50769-0.84615 0.50769-1.1846 0-0.33846-0.16923-0.84615-0.50769-1.1846-0.33846-0.33846-0.67692-0.50769-1.1846-0.50769h-18.615c-0.50769 0-0.84615 0.16923-1.1846 0.50769-0.33846 0.33846-0.50769 0.84615-0.50769 1.1846 0 0.33846 0.16923 0.84615 0.50769 1.1846z" fill-opacity=".78039" stroke-width="1.6923"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 518 B |
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m8.1077 22.492 10.662-10.492-10.662-10.492c-0.33846-0.33846-0.84615-0.50769-1.1846-0.50769-0.33846 0-0.84615 0.16923-1.1846 0.50769-0.33846 0.33846-0.50769 0.67692-0.50769 1.1846v18.615c0 0.50769 0.16923 0.84615 0.50769 1.1846 0.33846 0.33846 0.84615 0.50769 1.1846 0.50769 0.33846 0 0.84615-0.16923 1.1846-0.50769z" fill-opacity=".78039" stroke-width="1.6923"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 517 B |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m9.8767 17.723 5.8157-5.723-5.8157-5.723c-0.18462-0.18462-0.46155-0.27693-0.64616-0.27693-0.18462 0-0.46155 0.092309-0.64616 0.27693-0.18462 0.18462-0.27693 0.36924-0.27693 0.64616v10.154c0 0.27693 0.092309 0.46154 0.27693 0.64616 0.18462 0.18462 0.46155 0.27693 0.64616 0.27693 0.18462 0 0.46155-0.09231 0.64616-0.27693z" fill-opacity=".78039" stroke-width="1.6923"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 523 B |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24" height="24" version="1.2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m6.277 9.8767 5.723 5.8157 5.723-5.8157c0.18462-0.18462 0.27693-0.46155 0.27693-0.64616 0-0.18462-0.09231-0.46155-0.27693-0.64616-0.18462-0.18462-0.36924-0.27693-0.64616-0.27693h-10.154c-0.27693 0-0.46155 0.092309-0.64616 0.27693-0.18462 0.18462-0.27693 0.46155-0.27693 0.64616 0 0.18462 0.092309 0.46155 0.27693 0.64616z" fill-opacity=".78039" stroke-width="1.6923"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 523 B |
@@ -27,7 +27,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import Qt, QSize, pyqtSlot
|
||||
from PyQt5.QtCore import Qt, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QDialog, QDialogButtonBox, QGridLayout, QLabel,
|
||||
QListWidget, QListWidgetItem, QVBoxLayout, QWidget
|
||||
@@ -59,13 +59,14 @@ class GuiDocMerge(QDialog):
|
||||
SHARED.theme.helpText, parent=self, wrap=True
|
||||
)
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
hSp = CONFIG.pxInt(12)
|
||||
vSp = CONFIG.pxInt(8)
|
||||
bSp = CONFIG.pxInt(12)
|
||||
|
||||
self.listBox = QListWidget()
|
||||
self.listBox.setIconSize(QSize(iPx, iPx))
|
||||
self.listBox = QListWidget(self)
|
||||
self.listBox.setIconSize(iSz)
|
||||
self.listBox.setMinimumWidth(CONFIG.pxInt(400))
|
||||
self.listBox.setMinimumHeight(CONFIG.pxInt(180))
|
||||
self.listBox.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
|
||||
@@ -64,7 +64,7 @@ class GuiDocSplit(QDialog):
|
||||
)
|
||||
|
||||
# Values
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
hSp = CONFIG.pxInt(12)
|
||||
vSp = CONFIG.pxInt(8)
|
||||
bSp = CONFIG.pxInt(12)
|
||||
|
||||
@@ -27,18 +27,18 @@ from __future__ import annotations
|
||||
import logging
|
||||
|
||||
from PyQt5.QtGui import QCloseEvent, QFont, QKeyEvent, QKeySequence
|
||||
from PyQt5.QtCore import QSize, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractButton, QCompleter, QDialog, QDialogButtonBox, QFileDialog,
|
||||
QFontDialog, QHBoxLayout, QLineEdit, QPushButton, QToolButton, QVBoxLayout,
|
||||
QWidget, qApp
|
||||
QFontDialog, QHBoxLayout, QLineEdit, QPushButton, QVBoxLayout, QWidget,
|
||||
qApp
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.constants import nwConst, nwUnicode
|
||||
from novelwriter.dialogs.quotes import GuiQuoteSelect
|
||||
from novelwriter.extensions.configlayout import NColourLabel, NScrollableForm
|
||||
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NSpinBox
|
||||
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NIconToolButton, NSpinBox
|
||||
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.types import QtAlignCenter
|
||||
@@ -133,10 +133,8 @@ class GuiPreferences(QDialog):
|
||||
def buildForm(self) -> None:
|
||||
"""Build the settings form."""
|
||||
section = 0
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
minWidth = CONFIG.pxInt(200)
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iconSize = QSize(iPx, iPx)
|
||||
mIcon = SHARED.theme.getIcon("more")
|
||||
|
||||
# Label
|
||||
self.sidebar.addLabel(self.tr("General"))
|
||||
@@ -178,9 +176,7 @@ class GuiPreferences(QDialog):
|
||||
self.guiFont.setReadOnly(True)
|
||||
self.guiFont.setMinimumWidth(CONFIG.pxInt(162))
|
||||
self.guiFont.setText(CONFIG.guiFont)
|
||||
self.guiFontButton = QToolButton(self)
|
||||
self.guiFontButton.setIcon(mIcon)
|
||||
self.guiFontButton.setIconSize(iconSize)
|
||||
self.guiFontButton = NIconToolButton(self, iSz, "more")
|
||||
self.guiFontButton.clicked.connect(self._selectGuiFont)
|
||||
self.mainForm.addRow(
|
||||
self.tr("Application font family"), self.guiFont,
|
||||
@@ -240,9 +236,7 @@ class GuiPreferences(QDialog):
|
||||
self.textFont.setReadOnly(True)
|
||||
self.textFont.setMinimumWidth(CONFIG.pxInt(162))
|
||||
self.textFont.setText(CONFIG.textFont)
|
||||
self.textFontButton = QToolButton(self)
|
||||
self.textFontButton.setIcon(mIcon)
|
||||
self.textFontButton.setIconSize(iconSize)
|
||||
self.textFontButton = NIconToolButton(self, iSz, "more")
|
||||
self.textFontButton.clicked.connect(self._selectTextFont)
|
||||
self.mainForm.addRow(
|
||||
self.tr("Document font family"), self.textFont,
|
||||
@@ -325,6 +319,7 @@ class GuiPreferences(QDialog):
|
||||
# Backup Path
|
||||
self.backupPath = CONFIG.backupPath()
|
||||
self.backupGetPath = QPushButton(SHARED.theme.getIcon("browse"), self.tr("Browse"), self)
|
||||
self.backupGetPath.setIconSize(iSz)
|
||||
self.backupGetPath.clicked.connect(self._backupFolder)
|
||||
self.mainForm.addRow(
|
||||
self.tr("Backup storage location"), self.backupGetPath,
|
||||
@@ -682,9 +677,7 @@ class GuiPreferences(QDialog):
|
||||
self.quoteSym["SO"].setFixedWidth(qWidth)
|
||||
self.quoteSym["SO"].setAlignment(QtAlignCenter)
|
||||
self.quoteSym["SO"].setText(CONFIG.fmtSQuoteOpen)
|
||||
self.btnSingleStyleO = QToolButton(self)
|
||||
self.btnSingleStyleO.setIcon(mIcon)
|
||||
self.btnSingleStyleO.setIconSize(iconSize)
|
||||
self.btnSingleStyleO = NIconToolButton(self, iSz, "more")
|
||||
self.btnSingleStyleO.clicked.connect(lambda: self._getQuote("SO"))
|
||||
self.mainForm.addRow(
|
||||
self.tr("Single quote open style"), self.quoteSym["SO"],
|
||||
@@ -698,9 +691,7 @@ class GuiPreferences(QDialog):
|
||||
self.quoteSym["SC"].setFixedWidth(qWidth)
|
||||
self.quoteSym["SC"].setAlignment(QtAlignCenter)
|
||||
self.quoteSym["SC"].setText(CONFIG.fmtSQuoteClose)
|
||||
self.btnSingleStyleC = QToolButton(self)
|
||||
self.btnSingleStyleC.setIcon(mIcon)
|
||||
self.btnSingleStyleC.setIconSize(iconSize)
|
||||
self.btnSingleStyleC = NIconToolButton(self, iSz, "more")
|
||||
self.btnSingleStyleC.clicked.connect(lambda: self._getQuote("SC"))
|
||||
self.mainForm.addRow(
|
||||
self.tr("Single quote close style"), self.quoteSym["SC"],
|
||||
@@ -715,9 +706,7 @@ class GuiPreferences(QDialog):
|
||||
self.quoteSym["DO"].setFixedWidth(qWidth)
|
||||
self.quoteSym["DO"].setAlignment(QtAlignCenter)
|
||||
self.quoteSym["DO"].setText(CONFIG.fmtDQuoteOpen)
|
||||
self.btnDoubleStyleO = QToolButton(self)
|
||||
self.btnDoubleStyleO.setIcon(mIcon)
|
||||
self.btnDoubleStyleO.setIconSize(iconSize)
|
||||
self.btnDoubleStyleO = NIconToolButton(self, iSz, "more")
|
||||
self.btnDoubleStyleO.clicked.connect(lambda: self._getQuote("DO"))
|
||||
self.mainForm.addRow(
|
||||
self.tr("Double quote open style"), self.quoteSym["DO"],
|
||||
@@ -731,9 +720,7 @@ class GuiPreferences(QDialog):
|
||||
self.quoteSym["DC"].setFixedWidth(qWidth)
|
||||
self.quoteSym["DC"].setAlignment(QtAlignCenter)
|
||||
self.quoteSym["DC"].setText(CONFIG.fmtDQuoteClose)
|
||||
self.btnDoubleStyleC = QToolButton(self)
|
||||
self.btnDoubleStyleC.setIcon(mIcon)
|
||||
self.btnDoubleStyleC.setIconSize(iconSize)
|
||||
self.btnDoubleStyleC = NIconToolButton(self, iSz, "more")
|
||||
self.btnDoubleStyleC.clicked.connect(lambda: self._getQuote("DC"))
|
||||
self.mainForm.addRow(
|
||||
self.tr("Double quote close style"), self.quoteSym["DC"],
|
||||
|
||||
@@ -36,10 +36,10 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import simplified
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.modified import NComboBox
|
||||
from novelwriter.extensions.configlayout import NColourLabel, NFixedPage, NScrollableForm
|
||||
from novelwriter.extensions.modified import NComboBox, NIconToolButton
|
||||
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -329,7 +329,9 @@ class _StatusPage(NFixedPage):
|
||||
self._colDeleted = []
|
||||
self._selColour = QColor(100, 100, 100)
|
||||
|
||||
self.iPx = SHARED.theme.baseIconSize
|
||||
self.iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
bSz = SHARED.theme.buttonIconSize
|
||||
|
||||
# Title
|
||||
self.pageTitle = NColourLabel(
|
||||
@@ -348,16 +350,16 @@ class _StatusPage(NFixedPage):
|
||||
self._addItem(key, entry["name"], entry["cols"], entry["count"])
|
||||
|
||||
# List Controls
|
||||
self.addButton = QPushButton(SHARED.theme.getIcon("add"), "", self)
|
||||
self.addButton = NIconToolButton(self, iSz, "add")
|
||||
self.addButton.clicked.connect(self._newItem)
|
||||
|
||||
self.delButton = QPushButton(SHARED.theme.getIcon("remove"), "", self)
|
||||
self.delButton = NIconToolButton(self, iSz, "remove")
|
||||
self.delButton.clicked.connect(self._delItem)
|
||||
|
||||
self.upButton = QPushButton(SHARED.theme.getIcon("up"), "", self)
|
||||
self.upButton = NIconToolButton(self, iSz, "up")
|
||||
self.upButton.clicked.connect(lambda: self._moveItem(-1))
|
||||
|
||||
self.dnButton = QPushButton(SHARED.theme.getIcon("down"), "", self)
|
||||
self.dnButton = NIconToolButton(self, iSz, "down")
|
||||
self.dnButton.clicked.connect(lambda: self._moveItem(1))
|
||||
|
||||
# Edit Form
|
||||
@@ -368,12 +370,12 @@ class _StatusPage(NFixedPage):
|
||||
|
||||
self.colPixmap = QPixmap(self.iPx, self.iPx)
|
||||
self.colPixmap.fill(QColor(100, 100, 100))
|
||||
self.colButton = QPushButton(QIcon(self.colPixmap), self.tr("Colour"))
|
||||
self.colButton.setIconSize(self.colPixmap.rect().size())
|
||||
self.colButton = QPushButton(QIcon(self.colPixmap), self.tr("Colour"), self)
|
||||
self.colButton.setIconSize(bSz)
|
||||
self.colButton.setEnabled(False)
|
||||
self.colButton.clicked.connect(self._selectColour)
|
||||
|
||||
self.saveButton = QPushButton(self.tr("Save"))
|
||||
self.saveButton = QPushButton(self.tr("Save"), self)
|
||||
self.saveButton.setEnabled(False)
|
||||
self.saveButton.clicked.connect(self._saveItem)
|
||||
|
||||
@@ -589,6 +591,8 @@ class _ReplacePage(NFixedPage):
|
||||
|
||||
self._changed = False
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
|
||||
wCol0 = CONFIG.pxInt(
|
||||
SHARED.project.options.getInt("GuiProjectSettings", "replaceColW", 130)
|
||||
)
|
||||
@@ -614,10 +618,10 @@ class _ReplacePage(NFixedPage):
|
||||
self.listBox.setSortingEnabled(True)
|
||||
|
||||
# List Controls
|
||||
self.addButton = QPushButton(SHARED.theme.getIcon("add"), "")
|
||||
self.addButton = NIconToolButton(self, iSz, "add")
|
||||
self.addButton.clicked.connect(self._addEntry)
|
||||
|
||||
self.delButton = QPushButton(SHARED.theme.getIcon("remove"), "")
|
||||
self.delButton = NIconToolButton(self, iSz, "remove")
|
||||
self.delButton.clicked.connect(self._delEntry)
|
||||
|
||||
# Edit Form
|
||||
@@ -630,7 +634,7 @@ class _ReplacePage(NFixedPage):
|
||||
self.editValue.setEnabled(False)
|
||||
self.editValue.setMaxLength(80)
|
||||
|
||||
self.saveButton = QPushButton(self.tr("Save"))
|
||||
self.saveButton = QPushButton(self.tr("Save"), self)
|
||||
self.saveButton.clicked.connect(self._saveEntry)
|
||||
|
||||
# Assemble
|
||||
|
||||
@@ -32,13 +32,14 @@ from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QDialog, QDialogButtonBox, QFileDialog, QHBoxLayout,
|
||||
QLineEdit, QListWidget, QPushButton, QVBoxLayout, qApp
|
||||
QLineEdit, QListWidget, QVBoxLayout, qApp
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import formatFileFilter
|
||||
from novelwriter.core.spellcheck import UserDictionary
|
||||
from novelwriter.extensions.configlayout import NColourLabel
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from novelwriter.guimain import GuiMain
|
||||
@@ -57,6 +58,7 @@ class GuiWordList(QDialog):
|
||||
self.setObjectName("GuiWordList")
|
||||
self.setWindowTitle(self.tr("Project Word List"))
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mS = CONFIG.pxInt(250)
|
||||
wW = CONFIG.pxInt(320)
|
||||
wH = CONFIG.pxInt(340)
|
||||
@@ -74,11 +76,11 @@ class GuiWordList(QDialog):
|
||||
scale=NColourLabel.HEADER_SCALE
|
||||
)
|
||||
|
||||
self.importButton = QPushButton(SHARED.theme.getIcon("import"), "", self)
|
||||
self.importButton = NIconToolButton(self, iSz, "import")
|
||||
self.importButton.setToolTip(self.tr("Import words from text file"))
|
||||
self.importButton.clicked.connect(self._importWords)
|
||||
|
||||
self.exportButton = QPushButton(SHARED.theme.getIcon("export"), "", self)
|
||||
self.exportButton = NIconToolButton(self, iSz, "export")
|
||||
self.exportButton.setToolTip(self.tr("Export words to text file"))
|
||||
self.exportButton.clicked.connect(self._exportWords)
|
||||
|
||||
@@ -96,10 +98,10 @@ class GuiWordList(QDialog):
|
||||
# Add/Remove Form
|
||||
self.newEntry = QLineEdit(self)
|
||||
|
||||
self.addButton = QPushButton(SHARED.theme.getIcon("add"), "", self)
|
||||
self.addButton = NIconToolButton(self, iSz, "add")
|
||||
self.addButton.clicked.connect(self._doAdd)
|
||||
|
||||
self.delButton = QPushButton(SHARED.theme.getIcon("remove"), "", self)
|
||||
self.delButton = NIconToolButton(self, iSz, "remove")
|
||||
self.delButton.clicked.connect(self._doDelete)
|
||||
|
||||
self.editBox = QHBoxLayout()
|
||||
|
||||
@@ -29,6 +29,8 @@ from PyQt5.QtCore import QSize, Qt
|
||||
from PyQt5.QtGui import QWheelEvent
|
||||
from PyQt5.QtWidgets import QComboBox, QDoubleSpinBox, QSpinBox, QToolButton, QWidget
|
||||
|
||||
from novelwriter import SHARED
|
||||
|
||||
|
||||
class NComboBox(QComboBox):
|
||||
|
||||
@@ -89,11 +91,40 @@ class NDoubleSpinBox(QDoubleSpinBox):
|
||||
|
||||
class NIconToolButton(QToolButton):
|
||||
|
||||
def __init__(self, parent: QWidget, iconSize: int) -> None:
|
||||
def __init__(self, parent: QWidget, iconSize: QSize, icon: str | None = None) -> None:
|
||||
super().__init__(parent=parent)
|
||||
self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly)
|
||||
self.setIconSize(QSize(iconSize, iconSize))
|
||||
self.setIconSize(iconSize)
|
||||
self.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
if icon:
|
||||
self.setThemeIcon(icon)
|
||||
return
|
||||
|
||||
def setThemeIcon(self, iconKey: str) -> None:
|
||||
"""Set an icon from the current theme."""
|
||||
self.setIcon(SHARED.theme.getIcon(iconKey))
|
||||
return
|
||||
|
||||
# END Class NIconToolButton
|
||||
|
||||
|
||||
class NIconToggleButton(QToolButton):
|
||||
|
||||
def __init__(self, parent: QWidget, iconSize: QSize, icon: str | None = None) -> None:
|
||||
super().__init__(parent=parent)
|
||||
self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly)
|
||||
self.setIconSize(iconSize)
|
||||
self.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
self.setCheckable(True)
|
||||
self.setStyleSheet("border: none; background: transparent;")
|
||||
if icon:
|
||||
self.setThemeIcon(icon)
|
||||
return
|
||||
|
||||
def setThemeIcon(self, iconKey: str) -> None:
|
||||
"""Set an icon from the current theme."""
|
||||
iconSize = self.iconSize()
|
||||
self.setIcon(SHARED.theme.getToggleIcon(iconKey, (iconSize.width(), iconSize.height())))
|
||||
return
|
||||
|
||||
# END Class NUnfoldButton
|
||||
|
||||
@@ -40,7 +40,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from PyQt5.QtCore import (
|
||||
pyqtSignal, pyqtSlot, QObject, QPoint, QRegExp, QRegularExpression,
|
||||
QRunnable, QSize, Qt, QTimer
|
||||
QRunnable, Qt, QTimer
|
||||
)
|
||||
from PyQt5.QtGui import (
|
||||
QColor, QCursor, QFont, QKeyEvent, QKeySequence, QMouseEvent, QPalette,
|
||||
@@ -48,8 +48,7 @@ from PyQt5.QtGui import (
|
||||
)
|
||||
from PyQt5.QtWidgets import (
|
||||
QAction, QFrame, QGridLayout, QHBoxLayout, QLabel, QLineEdit, QMenu,
|
||||
QPlainTextEdit, QPushButton, QShortcut, QToolBar, QToolButton, QVBoxLayout,
|
||||
QWidget, qApp
|
||||
QPlainTextEdit, QShortcut, QToolBar, QVBoxLayout, QWidget, qApp
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
@@ -58,7 +57,7 @@ from novelwriter.constants import nwConst, nwKeyWords, nwShortcode, nwUnicode
|
||||
from novelwriter.core.document import NWDocument
|
||||
from novelwriter.enum import nwDocAction, nwDocInsert, nwDocMode, nwItemClass, nwTrinary
|
||||
from novelwriter.extensions.eventfilters import WheelEventFilter
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
from novelwriter.extensions.modified import NIconToggleButton, NIconToolButton
|
||||
from novelwriter.gui.dochighlight import BLOCK_META, BLOCK_TITLE
|
||||
from novelwriter.gui.editordocument import GuiTextDocument
|
||||
from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON
|
||||
@@ -2263,79 +2262,68 @@ class GuiDocToolBar(QWidget):
|
||||
|
||||
logger.debug("Create: GuiDocToolBar")
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
cM = CONFIG.pxInt(4)
|
||||
tPx = int(0.8*SHARED.theme.fontPixelSize)
|
||||
iconSize = QSize(tPx, tPx)
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
# General Buttons
|
||||
# ===============
|
||||
|
||||
self.tbBoldMD = QToolButton(self)
|
||||
self.tbBoldMD.setIconSize(iconSize)
|
||||
self.tbBoldMD = NIconToolButton(self, iSz)
|
||||
self.tbBoldMD.setToolTip(self.tr("Markdown Bold"))
|
||||
self.tbBoldMD.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.MD_BOLD)
|
||||
)
|
||||
|
||||
self.tbItalicMD = QToolButton(self)
|
||||
self.tbItalicMD.setIconSize(iconSize)
|
||||
self.tbItalicMD = NIconToolButton(self, iSz)
|
||||
self.tbItalicMD.setToolTip(self.tr("Markdown Italic"))
|
||||
self.tbItalicMD.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.MD_ITALIC)
|
||||
)
|
||||
|
||||
self.tbStrikeMD = QToolButton(self)
|
||||
self.tbStrikeMD.setIconSize(iconSize)
|
||||
self.tbStrikeMD = NIconToolButton(self, iSz)
|
||||
self.tbStrikeMD.setToolTip(self.tr("Markdown Strikethrough"))
|
||||
self.tbStrikeMD.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.MD_STRIKE)
|
||||
)
|
||||
|
||||
self.tbBold = QToolButton(self)
|
||||
self.tbBold.setIconSize(iconSize)
|
||||
self.tbBold = NIconToolButton(self, iSz)
|
||||
self.tbBold.setToolTip(self.tr("Shortcode Bold"))
|
||||
self.tbBold.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.SC_BOLD)
|
||||
)
|
||||
|
||||
self.tbItalic = QToolButton(self)
|
||||
self.tbItalic.setIconSize(iconSize)
|
||||
self.tbItalic = NIconToolButton(self, iSz)
|
||||
self.tbItalic.setToolTip(self.tr("Shortcode Italic"))
|
||||
self.tbItalic.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.SC_ITALIC)
|
||||
)
|
||||
|
||||
self.tbStrike = QToolButton(self)
|
||||
self.tbStrike.setIconSize(iconSize)
|
||||
self.tbStrike = NIconToolButton(self, iSz)
|
||||
self.tbStrike.setToolTip(self.tr("Shortcode Strikethrough"))
|
||||
self.tbStrike.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.SC_STRIKE)
|
||||
)
|
||||
|
||||
self.tbUnderline = QToolButton(self)
|
||||
self.tbUnderline.setIconSize(iconSize)
|
||||
self.tbUnderline = NIconToolButton(self, iSz)
|
||||
self.tbUnderline.setToolTip(self.tr("Shortcode Underline"))
|
||||
self.tbUnderline.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.SC_ULINE)
|
||||
)
|
||||
|
||||
self.tbMark = QToolButton(self)
|
||||
self.tbMark.setIconSize(iconSize)
|
||||
self.tbMark = NIconToolButton(self, iSz)
|
||||
self.tbMark.setToolTip(self.tr("Shortcode Highlight"))
|
||||
self.tbMark.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.SC_MARK)
|
||||
)
|
||||
|
||||
self.tbSuperscript = QToolButton(self)
|
||||
self.tbSuperscript.setIconSize(iconSize)
|
||||
self.tbSuperscript = NIconToolButton(self, iSz)
|
||||
self.tbSuperscript.setToolTip(self.tr("Shortcode Superscript"))
|
||||
self.tbSuperscript.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.SC_SUP)
|
||||
)
|
||||
|
||||
self.tbSubscript = QToolButton(self)
|
||||
self.tbSubscript.setIconSize(iconSize)
|
||||
self.tbSubscript = NIconToolButton(self, iSz)
|
||||
self.tbSubscript.setToolTip(self.tr("Shortcode Subscript"))
|
||||
self.tbSubscript.clicked.connect(
|
||||
lambda: self.requestDocAction.emit(nwDocAction.SC_SUB)
|
||||
@@ -2415,8 +2403,9 @@ class GuiDocEditSearch(QFrame):
|
||||
self.doNextFile = CONFIG.searchNextFile
|
||||
self.doMatchCap = CONFIG.searchMatchCap
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mPx = CONFIG.pxInt(6)
|
||||
tPx = int(0.8*SHARED.theme.fontPixelSize)
|
||||
|
||||
self.boxFont = SHARED.theme.guiFont
|
||||
self.boxFont.setPointSizeF(0.9*SHARED.theme.fontPointSize)
|
||||
|
||||
@@ -2442,7 +2431,7 @@ class GuiDocEditSearch(QFrame):
|
||||
|
||||
self.searchOpt = QToolBar(self)
|
||||
self.searchOpt.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly)
|
||||
self.searchOpt.setIconSize(QSize(tPx, tPx))
|
||||
self.searchOpt.setIconSize(iSz)
|
||||
self.searchOpt.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.searchLabel = QLabel(self.tr("Search"))
|
||||
@@ -2500,20 +2489,14 @@ class GuiDocEditSearch(QFrame):
|
||||
# Buttons
|
||||
# =======
|
||||
|
||||
bPx = self.searchBox.sizeHint().height()
|
||||
|
||||
self.showReplace = QToolButton(self)
|
||||
self.showReplace.setArrowType(Qt.ArrowType.RightArrow)
|
||||
self.showReplace.setCheckable(True)
|
||||
self.showReplace = NIconToggleButton(self, iSz, "unfold")
|
||||
self.showReplace.toggled.connect(self._doToggleReplace)
|
||||
|
||||
self.searchButton = QPushButton("")
|
||||
self.searchButton.setFixedSize(QSize(bPx, bPx))
|
||||
self.searchButton = NIconToolButton(self, iSz)
|
||||
self.searchButton.setToolTip(self.tr("Find in current document"))
|
||||
self.searchButton.clicked.connect(self._doSearch)
|
||||
|
||||
self.replaceButton = QPushButton("")
|
||||
self.replaceButton.setFixedSize(QSize(bPx, bPx))
|
||||
self.replaceButton = NIconToolButton(self, iSz)
|
||||
self.replaceButton.setToolTip(self.tr("Find and replace in current document"))
|
||||
self.replaceButton.clicked.connect(self._doReplace)
|
||||
|
||||
@@ -2738,10 +2721,6 @@ class GuiDocEditSearch(QFrame):
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleReplace(self, state: bool) -> None:
|
||||
"""Toggle the show/hide of the replace box."""
|
||||
if state:
|
||||
self.showReplace.setArrowType(Qt.ArrowType.DownArrow)
|
||||
else:
|
||||
self.showReplace.setArrowType(Qt.ArrowType.RightArrow)
|
||||
self.replaceBox.setVisible(state)
|
||||
self.replaceButton.setVisible(state)
|
||||
self.repVisible = state
|
||||
@@ -2821,7 +2800,8 @@ class GuiDocEditHeader(QWidget):
|
||||
self._docHandle = None
|
||||
self._docOutline: dict[int, str] = {}
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mPx = CONFIG.pxInt(4)
|
||||
|
||||
# Main Widget Settings
|
||||
@@ -2844,27 +2824,27 @@ class GuiDocEditHeader(QWidget):
|
||||
self.outlineMenu = QMenu(self)
|
||||
|
||||
# Buttons
|
||||
self.tbButton = NIconToolButton(self, iPx)
|
||||
self.tbButton = NIconToolButton(self, iSz)
|
||||
self.tbButton.setVisible(False)
|
||||
self.tbButton.setToolTip(self.tr("Toggle Tool Bar"))
|
||||
self.tbButton.clicked.connect(lambda: self.toggleToolBarRequest.emit())
|
||||
|
||||
self.outlineButton = NIconToolButton(self, iPx)
|
||||
self.outlineButton = NIconToolButton(self, iSz)
|
||||
self.outlineButton.setVisible(False)
|
||||
self.outlineButton.setToolTip(self.tr("Outline"))
|
||||
self.outlineButton.setMenu(self.outlineMenu)
|
||||
|
||||
self.searchButton = NIconToolButton(self, iPx)
|
||||
self.searchButton = NIconToolButton(self, iSz)
|
||||
self.searchButton.setVisible(False)
|
||||
self.searchButton.setToolTip(self.tr("Search"))
|
||||
self.searchButton.clicked.connect(self.docEditor.toggleSearch)
|
||||
|
||||
self.minmaxButton = NIconToolButton(self, iPx)
|
||||
self.minmaxButton = NIconToolButton(self, iSz)
|
||||
self.minmaxButton.setVisible(False)
|
||||
self.minmaxButton.setToolTip(self.tr("Toggle Focus Mode"))
|
||||
self.minmaxButton.clicked.connect(lambda: self.docEditor.toggleFocusModeRequest.emit())
|
||||
|
||||
self.closeButton = NIconToolButton(self, iPx)
|
||||
self.closeButton = NIconToolButton(self, iSz)
|
||||
self.closeButton.setVisible(False)
|
||||
self.closeButton.setToolTip(self.tr("Close"))
|
||||
self.closeButton.clicked.connect(self._closeDocument)
|
||||
@@ -3038,7 +3018,7 @@ class GuiDocEditFooter(QWidget):
|
||||
self._tItem = None
|
||||
self._docHandle = None
|
||||
|
||||
iPx = round(0.9*SHARED.theme.baseIconSize)
|
||||
iPx = round(0.9*SHARED.theme.baseIconHeight)
|
||||
fPx = int(0.9*SHARED.theme.fontPixelSize)
|
||||
mPx = CONFIG.pxInt(8)
|
||||
bSp = CONFIG.pxInt(4)
|
||||
@@ -3137,7 +3117,7 @@ class GuiDocEditFooter(QWidget):
|
||||
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme elements."""
|
||||
iPx = round(0.9*SHARED.theme.baseIconSize)
|
||||
iPx = round(0.9*SHARED.theme.baseIconHeight)
|
||||
self.linesIcon.setPixmap(SHARED.theme.getPixmap("status_lines", (iPx, iPx)))
|
||||
self.wordsIcon.setPixmap(SHARED.theme.getPixmap("status_stats", (iPx, iPx)))
|
||||
self.matchColours()
|
||||
@@ -3179,7 +3159,7 @@ class GuiDocEditFooter(QWidget):
|
||||
sIcon = QPixmap()
|
||||
sText = ""
|
||||
else:
|
||||
iPx = round(0.9*SHARED.theme.baseIconSize)
|
||||
iPx = round(0.9*SHARED.theme.baseIconHeight)
|
||||
status, icon = self._tItem.getImportStatus(incIcon=True)
|
||||
sIcon = icon.pixmap(iPx, iPx)
|
||||
sText = f"{status} / {self._tItem.describeMe()}"
|
||||
|
||||
@@ -30,7 +30,7 @@ import logging
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QPoint, QSize, Qt, QUrl
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QPoint, Qt, QUrl
|
||||
from PyQt5.QtGui import (
|
||||
QCursor, QFont, QMouseEvent, QPalette, QResizeEvent, QTextCursor,
|
||||
QTextOption
|
||||
@@ -627,7 +627,8 @@ class GuiDocViewHeader(QWidget):
|
||||
self._docHandle = None
|
||||
self._docOutline: dict[str, tuple[str, int]] = {}
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mPx = CONFIG.pxInt(4)
|
||||
|
||||
# Main Widget Settings
|
||||
@@ -651,27 +652,27 @@ class GuiDocViewHeader(QWidget):
|
||||
self.outlineMenu = QMenu(self)
|
||||
|
||||
# Buttons
|
||||
self.outlineButton = NIconToolButton(self, iPx)
|
||||
self.outlineButton = NIconToolButton(self, iSz)
|
||||
self.outlineButton.setVisible(False)
|
||||
self.outlineButton.setToolTip(self.tr("Outline"))
|
||||
self.outlineButton.setMenu(self.outlineMenu)
|
||||
|
||||
self.backButton = NIconToolButton(self, iPx)
|
||||
self.backButton = NIconToolButton(self, iSz)
|
||||
self.backButton.setVisible(False)
|
||||
self.backButton.setToolTip(self.tr("Go Backward"))
|
||||
self.backButton.clicked.connect(self.docViewer.navBackward)
|
||||
|
||||
self.forwardButton = NIconToolButton(self, iPx)
|
||||
self.forwardButton = NIconToolButton(self, iSz)
|
||||
self.forwardButton.setVisible(False)
|
||||
self.forwardButton.setToolTip(self.tr("Go Forward"))
|
||||
self.forwardButton.clicked.connect(self.docViewer.navForward)
|
||||
|
||||
self.refreshButton = NIconToolButton(self, iPx)
|
||||
self.refreshButton = NIconToolButton(self, iSz)
|
||||
self.refreshButton.setVisible(False)
|
||||
self.refreshButton.setToolTip(self.tr("Reload"))
|
||||
self.refreshButton.clicked.connect(self._refreshDocument)
|
||||
|
||||
self.closeButton = NIconToolButton(self, iPx)
|
||||
self.closeButton = NIconToolButton(self, iSz)
|
||||
self.closeButton.setVisible(False)
|
||||
self.closeButton.setToolTip(self.tr("Close"))
|
||||
self.closeButton.clicked.connect(self._closeDocument)
|
||||
@@ -849,17 +850,17 @@ class GuiDocViewFooter(QWidget):
|
||||
# Internal Variables
|
||||
self._docHandle = None
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
hSp = CONFIG.pxInt(4)
|
||||
mPx = CONFIG.pxInt(4)
|
||||
iconSize = QSize(iPx, iPx)
|
||||
|
||||
# Main Widget Settings
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
self.setAutoFillBackground(True)
|
||||
|
||||
# Show/Hide Details
|
||||
self.showHide = NIconToolButton(self, iPx)
|
||||
self.showHide = NIconToolButton(self, iSz)
|
||||
self.showHide.clicked.connect(lambda: self.docViewer.togglePanelVisibility.emit())
|
||||
self.showHide.setToolTip(self.tr("Show/Hide Viewer Panel"))
|
||||
|
||||
@@ -869,7 +870,7 @@ class GuiDocViewFooter(QWidget):
|
||||
self.showComments.setCheckable(True)
|
||||
self.showComments.setChecked(CONFIG.viewComments)
|
||||
self.showComments.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
|
||||
self.showComments.setIconSize(iconSize)
|
||||
self.showComments.setIconSize(iSz)
|
||||
self.showComments.toggled.connect(self._doToggleComments)
|
||||
self.showComments.setToolTip(self.tr("Show Comments"))
|
||||
|
||||
@@ -879,7 +880,7 @@ class GuiDocViewFooter(QWidget):
|
||||
self.showSynopsis.setCheckable(True)
|
||||
self.showSynopsis.setChecked(CONFIG.viewSynopsis)
|
||||
self.showSynopsis.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
|
||||
self.showSynopsis.setIconSize(iconSize)
|
||||
self.showSynopsis.setIconSize(iSz)
|
||||
self.showSynopsis.toggled.connect(self._doToggleSynopsis)
|
||||
self.showSynopsis.setToolTip(self.tr("Show Synopsis Comments"))
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import logging
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from PyQt5.QtCore import QModelIndex, QSize, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtCore import QModelIndex, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QFrame, QHeaderView, QMenu, QTabWidget, QToolButton,
|
||||
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
|
||||
@@ -55,7 +55,7 @@ class GuiDocViewerPanel(QWidget):
|
||||
|
||||
self._lastHandle = None
|
||||
|
||||
iPx = int(1.0*SHARED.theme.baseIconSize)
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
|
||||
self.tabBackRefs = _ViewPanelBackRefs(self)
|
||||
|
||||
@@ -66,7 +66,7 @@ class GuiDocViewerPanel(QWidget):
|
||||
self.aInactive.toggled.connect(self._toggleHideInactive)
|
||||
|
||||
self.optsButton = QToolButton(self)
|
||||
self.optsButton.setIconSize(QSize(iPx, iPx))
|
||||
self.optsButton.setIconSize(iSz)
|
||||
self.optsButton.setMenu(self.optsMenu)
|
||||
self.optsButton.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
|
||||
@@ -240,13 +240,14 @@ class _ViewPanelBackRefs(QTreeWidget):
|
||||
self._parent = parent
|
||||
self._treeMap: dict[str, QTreeWidgetItem] = {}
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
cMg = CONFIG.pxInt(6)
|
||||
|
||||
self.setHeaderLabels([self.tr("Document"), "", "", self.tr("First Heading")])
|
||||
self.setIndentation(0)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
||||
self.setIconSize(QSize(iPx, iPx))
|
||||
self.setIconSize(iSz)
|
||||
self.setFrameStyle(QFrame.Shape.NoFrame)
|
||||
|
||||
# Set Header Sizes
|
||||
@@ -382,7 +383,8 @@ class _ViewPanelKeyWords(QTreeWidget):
|
||||
self._class = itemClass
|
||||
self._treeMap: dict[str, QTreeWidgetItem] = {}
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
cMg = CONFIG.pxInt(6)
|
||||
|
||||
self.setHeaderLabels([
|
||||
@@ -390,7 +392,7 @@ class _ViewPanelKeyWords(QTreeWidget):
|
||||
self.tr("Heading"), self.tr("Short Description")
|
||||
])
|
||||
self.setIndentation(0)
|
||||
self.setIconSize(QSize(iPx, iPx))
|
||||
self.setIconSize(iSz)
|
||||
self.setFrameStyle(QFrame.Shape.NoFrame)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
||||
self.setExpandsOnDoubleClick(False)
|
||||
|
||||
@@ -231,7 +231,7 @@ class GuiItemDetails(QWidget):
|
||||
return
|
||||
|
||||
self._handle = tHandle
|
||||
iPx = int(round(0.9*SHARED.theme.baseIconSize))
|
||||
iPx = int(round(0.9*SHARED.theme.baseIconHeight))
|
||||
|
||||
# Label
|
||||
# =====
|
||||
|
||||
@@ -32,7 +32,7 @@ from time import time
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from PyQt5.QtGui import QFocusEvent, QFont, QMouseEvent, QPalette, QResizeEvent
|
||||
from PyQt5.QtCore import QModelIndex, QPoint, Qt, QSize, pyqtSlot, pyqtSignal
|
||||
from PyQt5.QtCore import QModelIndex, QPoint, Qt, pyqtSlot, pyqtSignal
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QActionGroup, QFrame, QHBoxLayout, QHeaderView,
|
||||
QInputDialog, QMenu, QSizePolicy, QToolTip, QTreeWidget, QTreeWidgetItem,
|
||||
@@ -201,7 +201,7 @@ class GuiNovelToolBar(QWidget):
|
||||
self.novelView = novelView
|
||||
self.mainGui = novelView.mainGui
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mPx = CONFIG.pxInt(2)
|
||||
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -218,12 +218,12 @@ class GuiNovelToolBar(QWidget):
|
||||
self.novelValue.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||
self.novelValue.novelSelectionChanged.connect(self.setCurrentRoot)
|
||||
|
||||
self.tbNovel = NIconToolButton(self, iPx)
|
||||
self.tbNovel = NIconToolButton(self, iSz)
|
||||
self.tbNovel.setToolTip(self.tr("Novel Root"))
|
||||
self.tbNovel.clicked.connect(self.novelValue.showPopup)
|
||||
|
||||
# Refresh Button
|
||||
self.tbRefresh = NIconToolButton(self, iPx)
|
||||
self.tbRefresh = NIconToolButton(self, iSz)
|
||||
self.tbRefresh.setToolTip(self.tr("Refresh"))
|
||||
self.tbRefresh.clicked.connect(self._refreshNovelTree)
|
||||
|
||||
@@ -242,7 +242,7 @@ class GuiNovelToolBar(QWidget):
|
||||
self.aLastColSize = self.mLastCol.addAction(self.tr("Column Size"))
|
||||
self.aLastColSize.triggered.connect(self._selectLastColumnSize)
|
||||
|
||||
self.tbMore = NIconToolButton(self, iPx)
|
||||
self.tbMore = NIconToolButton(self, iSz)
|
||||
self.tbMore.setToolTip(self.tr("More Options"))
|
||||
self.tbMore.setMenu(self.mMore)
|
||||
|
||||
@@ -392,10 +392,11 @@ class GuiNovelTree(QTreeWidget):
|
||||
# Build GUI
|
||||
# =========
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
cMg = CONFIG.pxInt(6)
|
||||
|
||||
self.setIconSize(QSize(iPx, iPx))
|
||||
self.setIconSize(iSz)
|
||||
self.setFrameStyle(QFrame.Shape.NoFrame)
|
||||
self.setUniformRowHeights(True)
|
||||
self.setAllColumnsShowFocus(True)
|
||||
@@ -456,7 +457,7 @@ class GuiNovelTree(QTreeWidget):
|
||||
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme elements."""
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
self._pMore = SHARED.theme.loadDecoration("deco_doc_more", h=iPx)
|
||||
return
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import logging
|
||||
from time import time
|
||||
from enum import Enum
|
||||
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot, QSize, QT_TRANSLATE_NOOP
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot, QT_TRANSLATE_NOOP
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QAction, QFileDialog, QFrame, QGridLayout, QGroupBox,
|
||||
QHBoxLayout, QLabel, QMenu, QScrollArea, QSizePolicy, QSplitter, QToolBar,
|
||||
@@ -207,11 +207,11 @@ class GuiOutlineToolBar(QToolBar):
|
||||
|
||||
logger.debug("Create: GuiOutlineToolBar")
|
||||
|
||||
bPx = SHARED.theme.baseButtonHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mPx = CONFIG.pxInt(12)
|
||||
|
||||
self.setMovable(False)
|
||||
self.setIconSize(QSize(bPx, bPx))
|
||||
self.setIconSize(iSz)
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
stretch = QWidget(self)
|
||||
@@ -376,8 +376,7 @@ class GuiOutlineTree(QTreeWidget):
|
||||
self.itemDoubleClicked.connect(self._treeDoubleClick)
|
||||
self.itemSelectionChanged.connect(self._itemSelected)
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
self.setIconSize(QSize(iPx, iPx))
|
||||
self.setIconSize(SHARED.theme.baseIconSize)
|
||||
self.setIndentation(0)
|
||||
|
||||
self.treeHead = self.header()
|
||||
|
||||
@@ -35,7 +35,7 @@ from typing import TYPE_CHECKING
|
||||
from PyQt5.QtGui import (
|
||||
QDragEnterEvent, QDragMoveEvent, QDropEvent, QIcon, QMouseEvent, QPalette
|
||||
)
|
||||
from PyQt5.QtCore import QPoint, QTimer, Qt, QSize, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtCore import QPoint, QTimer, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QAction, QDialog, QFrame, QHBoxLayout, QHeaderView,
|
||||
QLabel, QMenu, QShortcut, QSizePolicy, QTreeWidget, QTreeWidgetItem,
|
||||
@@ -264,7 +264,7 @@ class GuiProjectToolBar(QWidget):
|
||||
self.projTree = projView.projTree
|
||||
self.mainGui = projView.mainGui
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mPx = CONFIG.pxInt(2)
|
||||
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -279,17 +279,17 @@ class GuiProjectToolBar(QWidget):
|
||||
# Quick Links
|
||||
self.mQuick = QMenu(self)
|
||||
|
||||
self.tbQuick = NIconToolButton(self, iPx)
|
||||
self.tbQuick = NIconToolButton(self, iSz)
|
||||
self.tbQuick.setToolTip("%s [Ctrl+L]" % self.tr("Quick Links"))
|
||||
self.tbQuick.setShortcut("Ctrl+L")
|
||||
self.tbQuick.setMenu(self.mQuick)
|
||||
|
||||
# Move Buttons
|
||||
self.tbMoveU = NIconToolButton(self, iPx)
|
||||
self.tbMoveU = NIconToolButton(self, iSz)
|
||||
self.tbMoveU.setToolTip("%s [Ctrl+Up]" % self.tr("Move Up"))
|
||||
self.tbMoveU.clicked.connect(lambda: self.projTree.moveTreeItem(-1))
|
||||
|
||||
self.tbMoveD = NIconToolButton(self, iPx)
|
||||
self.tbMoveD = NIconToolButton(self, iSz)
|
||||
self.tbMoveD.setToolTip("%s [Ctrl+Down]" % self.tr("Move Down"))
|
||||
self.tbMoveD.clicked.connect(lambda: self.projTree.moveTreeItem(1))
|
||||
|
||||
@@ -329,7 +329,7 @@ class GuiProjectToolBar(QWidget):
|
||||
self.mAddRoot = self.mAdd.addMenu(trConst(nwLabels.ITEM_DESCRIPTION["root"]))
|
||||
self._buildRootMenu()
|
||||
|
||||
self.tbAdd = NIconToolButton(self, iPx)
|
||||
self.tbAdd = NIconToolButton(self, iSz)
|
||||
self.tbAdd.setToolTip("%s [Ctrl+N]" % self.tr("Add Item"))
|
||||
self.tbAdd.setShortcut("Ctrl+N")
|
||||
self.tbAdd.setMenu(self.mAdd)
|
||||
@@ -346,7 +346,7 @@ class GuiProjectToolBar(QWidget):
|
||||
self.aEmptyTrash = self.mMore.addAction(self.tr("Empty Trash"))
|
||||
self.aEmptyTrash.triggered.connect(lambda: self.projTree.emptyTrash())
|
||||
|
||||
self.tbMore = NIconToolButton(self, iPx)
|
||||
self.tbMore = NIconToolButton(self, iSz)
|
||||
self.tbMore.setToolTip(self.tr("More Options"))
|
||||
self.tbMore.setMenu(self.mMore)
|
||||
|
||||
@@ -517,10 +517,10 @@ class GuiProjectTree(QTreeWidget):
|
||||
self.customContextMenuRequested.connect(self._openContextMenu)
|
||||
|
||||
# Tree Settings
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
cMg = CONFIG.pxInt(6)
|
||||
|
||||
self.setIconSize(QSize(iPx, iPx))
|
||||
self.setIconSize(SHARED.theme.baseIconSize)
|
||||
self.setFrameStyle(QFrame.Shape.NoFrame)
|
||||
self.setUniformRowHeights(True)
|
||||
self.setAllColumnsShowFocus(True)
|
||||
@@ -564,7 +564,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
self.itemSelectionChanged.connect(self._treeSelectionChange)
|
||||
|
||||
# Auto Scroll
|
||||
self._scrollMargin = SHARED.theme.baseIconSize
|
||||
self._scrollMargin = SHARED.theme.baseIconHeight
|
||||
self._scrollDirection = 0
|
||||
self._scrollTimer = QTimer(self)
|
||||
self._scrollTimer.timeout.connect(self._doAutoScroll)
|
||||
|
||||
@@ -27,7 +27,7 @@ import logging
|
||||
|
||||
from time import time
|
||||
|
||||
from PyQt5.QtCore import QSize, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtGui import QCursor, QKeyEvent
|
||||
from PyQt5.QtWidgets import (
|
||||
QFrame, QHBoxLayout, QHeaderView, QLabel, QLineEdit, QToolBar, QTreeWidget,
|
||||
@@ -60,7 +60,8 @@ class GuiProjectSearch(QWidget):
|
||||
|
||||
logger.debug("Create: GuiProjectSearch")
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mPx = CONFIG.pxInt(2)
|
||||
tPx = CONFIG.pxInt(4)
|
||||
|
||||
@@ -77,7 +78,7 @@ class GuiProjectSearch(QWidget):
|
||||
# Options
|
||||
self.searchOpt = QToolBar(self)
|
||||
self.searchOpt.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly)
|
||||
self.searchOpt.setIconSize(QSize(iPx, iPx))
|
||||
self.searchOpt.setIconSize(iSz)
|
||||
self.searchOpt.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.toggleCase = self.searchOpt.addAction(self.tr("Case Sensitive"))
|
||||
@@ -109,7 +110,7 @@ class GuiProjectSearch(QWidget):
|
||||
self.searchResult = QTreeWidget(self)
|
||||
self.searchResult.setHeaderHidden(True)
|
||||
self.searchResult.setColumnCount(2)
|
||||
self.searchResult.setIconSize(QSize(iPx, iPx))
|
||||
self.searchResult.setIconSize(iSz)
|
||||
self.searchResult.setIndentation(iPx)
|
||||
self.searchResult.setFrameStyle(QFrame.Shape.NoFrame)
|
||||
self.searchResult.setUniformRowHeights(True)
|
||||
|
||||
@@ -28,7 +28,7 @@ import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from PyQt5.QtGui import QPalette
|
||||
from PyQt5.QtCore import QEvent, QPoint, pyqtSignal
|
||||
from PyQt5.QtCore import QEvent, QPoint, QSize, pyqtSignal
|
||||
from PyQt5.QtWidgets import QMenu, QVBoxLayout, QWidget
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
@@ -55,40 +55,42 @@ class GuiSideBar(QWidget):
|
||||
self.mainGui = mainGui
|
||||
|
||||
iPx = int(1.2*SHARED.theme.baseButtonHeight)
|
||||
iSz = QSize(iPx, iPx)
|
||||
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
self.installEventFilter(StatusTipFilter(mainGui))
|
||||
|
||||
# Buttons
|
||||
self.tbProject = NIconToolButton(self, iPx)
|
||||
self.tbProject = NIconToolButton(self, iSz)
|
||||
self.tbProject.setToolTip("{0} [Ctrl+T]".format(self.tr("Project Tree View")))
|
||||
self.tbProject.clicked.connect(lambda: self.requestViewChange.emit(nwView.PROJECT))
|
||||
|
||||
self.tbNovel = NIconToolButton(self, iPx)
|
||||
self.tbNovel = NIconToolButton(self, iSz)
|
||||
self.tbNovel.setToolTip("{0} [Ctrl+T]".format(self.tr("Novel Tree View")))
|
||||
self.tbNovel.clicked.connect(lambda: self.requestViewChange.emit(nwView.NOVEL))
|
||||
|
||||
self.tbSearch = NIconToolButton(self, iPx)
|
||||
self.tbSearch = NIconToolButton(self, iSz)
|
||||
self.tbSearch.setToolTip("{0} [Ctrl+Shift+F]".format(self.tr("Project Search")))
|
||||
self.tbSearch.clicked.connect(lambda: self.requestViewChange.emit(nwView.SEARCH))
|
||||
|
||||
self.tbOutline = NIconToolButton(self, iPx)
|
||||
self.tbOutline = NIconToolButton(self, iSz)
|
||||
self.tbOutline.setToolTip("{0} [Ctrl+Shift+T]".format(self.tr("Novel Outline View")))
|
||||
self.tbOutline.clicked.connect(lambda: self.requestViewChange.emit(nwView.OUTLINE))
|
||||
|
||||
self.tbBuild = NIconToolButton(self, iPx)
|
||||
self.tbBuild = NIconToolButton(self, iSz)
|
||||
self.tbBuild.setToolTip("{0} [F5]".format(self.tr("Build Manuscript")))
|
||||
self.tbBuild.clicked.connect(self.mainGui.showBuildManuscriptDialog)
|
||||
|
||||
self.tbDetails = NIconToolButton(self, iPx)
|
||||
self.tbDetails = NIconToolButton(self, iSz)
|
||||
self.tbDetails.setToolTip("{0} [Shift+F6]".format(self.tr("Novel Details")))
|
||||
self.tbDetails.clicked.connect(self.mainGui.showNovelDetailsDialog)
|
||||
|
||||
self.tbStats = NIconToolButton(self, iPx)
|
||||
self.tbStats = NIconToolButton(self, iSz)
|
||||
self.tbStats.setToolTip("{0} [F6]".format(self.tr("Writing Statistics")))
|
||||
self.tbStats.clicked.connect(self.mainGui.showWritingStatsDialog)
|
||||
|
||||
# Settings Menu
|
||||
self.tbSettings = NIconToolButton(self, iPx)
|
||||
self.tbSettings = NIconToolButton(self, iSz)
|
||||
self.tbSettings.setToolTip(self.tr("Settings"))
|
||||
|
||||
self.mSettings = _PopRightMenu(self.tbSettings)
|
||||
|
||||
@@ -58,7 +58,7 @@ class GuiMainStatus(QStatusBar):
|
||||
colSaved = SHARED.theme.statSaved
|
||||
colUnsaved = SHARED.theme.statUnsaved
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
|
||||
# Permanent Widgets
|
||||
# =================
|
||||
@@ -130,7 +130,7 @@ class GuiMainStatus(QStatusBar):
|
||||
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme elements."""
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
self.langIcon.setPixmap(SHARED.theme.getPixmap("status_lang", (iPx, iPx)))
|
||||
self.statsIcon.setPixmap(SHARED.theme.getPixmap("status_stats", (iPx, iPx)))
|
||||
self.timePixmap = SHARED.theme.getPixmap("status_time", (iPx, iPx))
|
||||
|
||||
@@ -29,7 +29,7 @@ import logging
|
||||
from math import ceil
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtCore import QSize, Qt
|
||||
from PyQt5.QtWidgets import qApp
|
||||
from PyQt5.QtGui import (
|
||||
QPalette, QColor, QIcon, QFont, QFontMetrics, QFontDatabase, QPixmap
|
||||
@@ -156,13 +156,18 @@ class GuiTheme:
|
||||
self.guiFontB.setBold(True)
|
||||
|
||||
qMetric = QFontMetrics(self.guiFont)
|
||||
fHeight = qMetric.height()
|
||||
fAscent = qMetric.ascent()
|
||||
self.fontPointSize = self.guiFont.pointSizeF()
|
||||
self.fontPixelSize = int(round(qMetric.height()))
|
||||
self.baseIconSize = int(round(qMetric.ascent()))
|
||||
self.baseButtonHeight = int(round(1.35*qMetric.ascent()))
|
||||
self.fontPixelSize = int(round(fHeight))
|
||||
self.baseIconHeight = int(round(fAscent))
|
||||
self.baseButtonHeight = int(round(1.35*fAscent))
|
||||
self.textNHeight = qMetric.boundingRect("N").height()
|
||||
self.textNWidth = qMetric.boundingRect("N").width()
|
||||
|
||||
self.baseIconSize = QSize(self.baseIconHeight, self.baseIconHeight)
|
||||
self.buttonIconSize = QSize(int(0.9*self.baseIconHeight), int(0.9*self.baseIconHeight))
|
||||
|
||||
# Monospace Font
|
||||
self.guiFontFixed = QFont()
|
||||
self.guiFontFixed.setPointSizeF(0.95*self.fontPointSize)
|
||||
@@ -171,7 +176,7 @@ class GuiTheme:
|
||||
logger.debug("GUI Font Family: %s", self.guiFont.family())
|
||||
logger.debug("GUI Font Point Size: %.2f", self.fontPointSize)
|
||||
logger.debug("GUI Font Pixel Size: %d", self.fontPixelSize)
|
||||
logger.debug("GUI Base Icon Size: %d", self.baseIconSize)
|
||||
logger.debug("GUI Base Icon Height: %d", self.baseIconHeight)
|
||||
logger.debug("GUI Base Button Height: %d", self.baseButtonHeight)
|
||||
logger.debug("Text 'N' Height: %d", self.textNHeight)
|
||||
logger.debug("Text 'N' Width: %d", self.textNWidth)
|
||||
@@ -679,7 +684,7 @@ class GuiIcons:
|
||||
def getToggleIcon(self, name: str, size: tuple[int, int]) -> QIcon:
|
||||
"""Return a toggle icon from the icon buffer. or load it."""
|
||||
if name in self.TOGGLE_ICON_KEYS:
|
||||
pOne = self.getPixmap(self.TOGGLE_ICON_KEYS[name][0], size)
|
||||
pOne = self.getPixmap(self.TOGGLE_ICON_KEYS[name][0], size)
|
||||
pTwo = self.getPixmap(self.TOGGLE_ICON_KEYS[name][1], size)
|
||||
icon = QIcon()
|
||||
icon.addPixmap(pOne, QIcon.Mode.Normal, QIcon.State.On)
|
||||
@@ -724,7 +729,7 @@ class GuiIcons:
|
||||
def getHeaderDecoration(self, hLevel: int) -> QPixmap:
|
||||
"""Get the decoration for a specific heading level."""
|
||||
if not self._headerDec:
|
||||
iPx = self.mainTheme.baseIconSize
|
||||
iPx = self.mainTheme.baseIconHeight
|
||||
self._headerDec = [
|
||||
self.loadDecoration("deco_doc_h0", h=iPx),
|
||||
self.loadDecoration("deco_doc_h1", h=iPx),
|
||||
@@ -737,7 +742,7 @@ class GuiIcons:
|
||||
def getHeaderDecorationNarrow(self, hLevel: int) -> QPixmap:
|
||||
"""Get the narrow decoration for a specific heading level."""
|
||||
if not self._headerDecNarrow:
|
||||
iPx = self.mainTheme.baseIconSize
|
||||
iPx = self.mainTheme.baseIconHeight
|
||||
self._headerDecNarrow = [
|
||||
self.loadDecoration("deco_doc_h0_n", h=iPx),
|
||||
self.loadDecoration("deco_doc_h1_n", h=iPx),
|
||||
|
||||
@@ -404,7 +404,7 @@ class _GuiAlert(QMessageBox):
|
||||
self.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
|
||||
else:
|
||||
self.setStandardButtons(QMessageBox.Ok)
|
||||
pSz = 2*self._theme.baseIconSize
|
||||
pSz = 2*self._theme.baseIconHeight
|
||||
if level == self.INFO:
|
||||
self.setIconPixmap(self._theme.getPixmap("alert_info", (pSz, pSz)))
|
||||
self.setWindowTitle(self.tr("Information"))
|
||||
|
||||
@@ -36,8 +36,9 @@ from PyQt5.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.error import formatException
|
||||
from novelwriter.common import formatFileFilter, openExternalPath, formatInt, getFileSize
|
||||
from novelwriter.error import formatException
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -54,6 +55,7 @@ class GuiDictionaries(QDialog):
|
||||
self._installPath = None
|
||||
self._currDicts = set()
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
iPx = CONFIG.pxInt(4)
|
||||
mPx = CONFIG.pxInt(8)
|
||||
sPx = CONFIG.pxInt(16)
|
||||
@@ -72,8 +74,7 @@ class GuiDictionaries(QDialog):
|
||||
self.huInfo.setOpenExternalLinks(True)
|
||||
self.huInfo.setWordWrap(True)
|
||||
self.huInput = QLineEdit(self)
|
||||
self.huBrowse = QPushButton(self)
|
||||
self.huBrowse.setIcon(SHARED.theme.getIcon("browse"))
|
||||
self.huBrowse = NIconToolButton(self, iSz, "browse")
|
||||
self.huBrowse.clicked.connect(self._doBrowseHunspell)
|
||||
self.huImport = QPushButton(self.tr("Add Dictionary"), self)
|
||||
self.huImport.setIcon(SHARED.theme.getIcon("add"))
|
||||
@@ -91,8 +92,7 @@ class GuiDictionaries(QDialog):
|
||||
self.inInfo = QLabel(self.tr("Dictionary install location"))
|
||||
self.inPath = QLineEdit(self)
|
||||
self.inPath.setReadOnly(True)
|
||||
self.inBrowse = QPushButton(self)
|
||||
self.inBrowse.setIcon(SHARED.theme.getIcon("browse"))
|
||||
self.inBrowse = NIconToolButton(self, iSz, "browse")
|
||||
self.inBrowse.clicked.connect(self._doOpenInstallLocation)
|
||||
|
||||
self.inBox = QHBoxLayout()
|
||||
|
||||
@@ -28,7 +28,7 @@ import logging
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import QSize, QTimer, Qt, pyqtSlot
|
||||
from PyQt5.QtCore import QTimer, Qt, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractButton, QAbstractItemView, QDialog, QDialogButtonBox, QFileDialog,
|
||||
QGridLayout, QHBoxLayout, QLabel, QLineEdit, QListWidget, QListWidgetItem,
|
||||
@@ -42,6 +42,7 @@ from novelwriter.core.buildsettings import BuildSettings
|
||||
from novelwriter.core.docbuild import NWBuildDocument
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.enum import nwBuildFmt
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
from novelwriter.extensions.simpleprogress import NProgressSimple
|
||||
from novelwriter.types import QtAlignCenter
|
||||
|
||||
@@ -70,7 +71,8 @@ class GuiManuscriptBuild(QDialog):
|
||||
self.setMinimumWidth(CONFIG.pxInt(500))
|
||||
self.setMinimumHeight(CONFIG.pxInt(300))
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
bSz = SHARED.theme.buttonIconSize
|
||||
sp4 = CONFIG.pxInt(4)
|
||||
sp8 = CONFIG.pxInt(8)
|
||||
sp16 = CONFIG.pxInt(16)
|
||||
@@ -88,7 +90,7 @@ class GuiManuscriptBuild(QDialog):
|
||||
|
||||
self.lblFormat = QLabel(self.tr("Output Format"))
|
||||
self.listFormats = QListWidget()
|
||||
self.listFormats.setIconSize(QSize(iPx, iPx))
|
||||
self.listFormats.setIconSize(iSz)
|
||||
current = None
|
||||
for key in nwBuildFmt:
|
||||
item = QListWidgetItem()
|
||||
@@ -115,7 +117,7 @@ class GuiManuscriptBuild(QDialog):
|
||||
self.lblContent = QLabel(self.tr("Table of Contents"))
|
||||
|
||||
self.listContent = QListWidget(self)
|
||||
self.listContent.setIconSize(QSize(iPx, iPx))
|
||||
self.listContent.setIconSize(iSz)
|
||||
self.listContent.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
||||
|
||||
self.contentBox = QVBoxLayout()
|
||||
@@ -142,7 +144,7 @@ class GuiManuscriptBuild(QDialog):
|
||||
# Build Path
|
||||
self.lblPath = QLabel(self.tr("Path"))
|
||||
self.buildPath = QLineEdit(self)
|
||||
self.btnBrowse = QPushButton(SHARED.theme.getIcon("browse"), "")
|
||||
self.btnBrowse = NIconToolButton(self, iSz, "browse")
|
||||
|
||||
self.pathBox = QHBoxLayout()
|
||||
self.pathBox.addWidget(self.buildPath)
|
||||
@@ -152,7 +154,7 @@ class GuiManuscriptBuild(QDialog):
|
||||
# Build Name
|
||||
self.lblName = QLabel(self.tr("File Name"))
|
||||
self.buildName = QLineEdit(self)
|
||||
self.btnReset = QPushButton(SHARED.theme.getIcon("revert"), "")
|
||||
self.btnReset = NIconToolButton(self, iSz, "revert")
|
||||
self.btnReset.setToolTip(self.tr("Reset file name to default"))
|
||||
|
||||
self.nameBox = QHBoxLayout()
|
||||
@@ -178,7 +180,10 @@ class GuiManuscriptBuild(QDialog):
|
||||
|
||||
# Dialog Buttons
|
||||
self.btnOpen = QPushButton(SHARED.theme.getIcon("browse"), self.tr("Open Folder"))
|
||||
self.btnOpen.setIconSize(bSz)
|
||||
self.btnBuild = QPushButton(SHARED.theme.getIcon("export"), self.tr("&Build"))
|
||||
self.btnBuild.setIconSize(bSz)
|
||||
|
||||
self.dlgButtons = QDialogButtonBox(QDialogButtonBox.StandardButton.Close)
|
||||
self.dlgButtons.addButton(self.btnOpen, QDialogButtonBox.ButtonRole.ActionRole)
|
||||
self.dlgButtons.addButton(self.btnBuild, QDialogButtonBox.ButtonRole.ActionRole)
|
||||
|
||||
@@ -31,7 +31,7 @@ from typing import TYPE_CHECKING
|
||||
from datetime import datetime
|
||||
|
||||
from PyQt5.QtGui import QCloseEvent, QColor, QCursor, QFont, QPalette, QResizeEvent
|
||||
from PyQt5.QtCore import QSize, QTimer, QUrl, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtCore import QTimer, QUrl, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QDialog, QFormLayout, QGridLayout, QHBoxLayout, QLabel,
|
||||
QListWidget, QListWidgetItem, QPushButton, QSizePolicy, QSplitter,
|
||||
@@ -48,7 +48,7 @@ from novelwriter.core.tohtml import ToHtml
|
||||
from novelwriter.core.tokenizer import HeadingFormatter
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.extensions.circularprogress import NProgressCircle
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
from novelwriter.extensions.modified import NIconToggleButton, NIconToolButton
|
||||
from novelwriter.gui.theme import STYLES_FLAT_TABS, STYLES_MIN_TOOLBUTTON
|
||||
from novelwriter.tools.manusbuild import GuiManuscriptBuild
|
||||
from novelwriter.tools.manussettings import GuiBuildSettings
|
||||
@@ -89,7 +89,7 @@ class GuiManuscript(QDialog):
|
||||
self.setMinimumWidth(CONFIG.pxInt(600))
|
||||
self.setMinimumHeight(CONFIG.pxInt(500))
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
wWin = CONFIG.pxInt(900)
|
||||
hWin = CONFIG.pxInt(600)
|
||||
|
||||
@@ -108,20 +108,17 @@ class GuiManuscript(QDialog):
|
||||
|
||||
buttonStyle = SHARED.theme.getStyleSheet(STYLES_MIN_TOOLBUTTON)
|
||||
|
||||
self.tbAdd = NIconToolButton(self, iPx)
|
||||
self.tbAdd.setIcon(SHARED.theme.getIcon("add"))
|
||||
self.tbAdd = NIconToolButton(self, iSz, "add")
|
||||
self.tbAdd.setToolTip(self.tr("Add New Build"))
|
||||
self.tbAdd.setStyleSheet(buttonStyle)
|
||||
self.tbAdd.clicked.connect(self._createNewBuild)
|
||||
|
||||
self.tbDel = NIconToolButton(self, iPx)
|
||||
self.tbDel.setIcon(SHARED.theme.getIcon("remove"))
|
||||
self.tbDel = NIconToolButton(self, iSz, "remove")
|
||||
self.tbDel.setToolTip(self.tr("Delete Selected Build"))
|
||||
self.tbDel.setStyleSheet(buttonStyle)
|
||||
self.tbDel.clicked.connect(self._deleteSelectedBuild)
|
||||
|
||||
self.tbEdit = NIconToolButton(self, iPx)
|
||||
self.tbEdit.setIcon(SHARED.theme.getIcon("edit"))
|
||||
self.tbEdit = NIconToolButton(self, iSz, "edit")
|
||||
self.tbEdit.setToolTip(self.tr("Edit Selected Build"))
|
||||
self.tbEdit.setStyleSheet(buttonStyle)
|
||||
self.tbEdit.clicked.connect(self._editSelectedBuild)
|
||||
@@ -140,7 +137,7 @@ class GuiManuscript(QDialog):
|
||||
# ======
|
||||
|
||||
self.buildList = QListWidget(self)
|
||||
self.buildList.setIconSize(QSize(iPx, iPx))
|
||||
self.buildList.setIconSize(iSz)
|
||||
self.buildList.doubleClicked.connect(self._editSelectedBuild)
|
||||
self.buildList.currentItemChanged.connect(self._updateBuildDetails)
|
||||
self.buildList.setSelectionMode(QAbstractItemView.SingleSelection)
|
||||
@@ -529,7 +526,7 @@ class _DetailsWidget(QWidget):
|
||||
# Tree Widget
|
||||
self.listView = QTreeWidget(self)
|
||||
self.listView.setHeaderLabels([self.tr("Setting"), self.tr("Value")])
|
||||
self.listView.setIndentation(SHARED.theme.baseIconSize)
|
||||
self.listView.setIndentation(SHARED.theme.baseIconHeight)
|
||||
self.listView.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
||||
|
||||
# Assemble
|
||||
@@ -724,7 +721,9 @@ class _OutlineWidget(QWidget):
|
||||
parent.addChild(item)
|
||||
indent = True
|
||||
|
||||
self.listView.setIndentation(SHARED.theme.baseIconSize if indent else CONFIG.pxInt(4))
|
||||
self.listView.setIndentation(
|
||||
SHARED.theme.baseIconHeight if indent else CONFIG.pxInt(4)
|
||||
)
|
||||
self._outline = data
|
||||
|
||||
return
|
||||
@@ -979,13 +978,7 @@ class _StatsWidget(QWidget):
|
||||
self.minWidget = QWidget(self)
|
||||
self.maxWidget = QWidget(self)
|
||||
|
||||
iPx = int(0.6*SHARED.theme.baseIconSize)
|
||||
toggleIcon = SHARED.theme.getToggleIcon("unfold", (iPx, iPx))
|
||||
|
||||
self.toggleButton = NIconToolButton(self, iPx)
|
||||
self.toggleButton.setCheckable(True)
|
||||
self.toggleButton.setIcon(toggleIcon)
|
||||
self.toggleButton.setStyleSheet(SHARED.theme.getStyleSheet(STYLES_MIN_TOOLBUTTON))
|
||||
self.toggleButton = NIconToggleButton(self, SHARED.theme.baseIconSize, "unfold")
|
||||
self.toggleButton.toggled.connect(self._toggleView)
|
||||
|
||||
self._buildMinimal()
|
||||
|
||||
@@ -28,12 +28,12 @@ import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from PyQt5.QtGui import QFont, QIcon, QSyntaxHighlighter, QTextCharFormat, QTextDocument
|
||||
from PyQt5.QtCore import QEvent, QSize, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtCore import QEvent, Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractButton, QAbstractItemView, QDialog, QDialogButtonBox,
|
||||
QFontDialog, QFrame, QGridLayout, QHBoxLayout, QHeaderView, QLabel,
|
||||
QLineEdit, QMenu, QPlainTextEdit, QPushButton, QSplitter, QStackedWidget,
|
||||
QToolButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
|
||||
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
@@ -42,7 +42,7 @@ from novelwriter.core.buildsettings import BuildSettings, FilterMode
|
||||
from novelwriter.extensions.configlayout import (
|
||||
NColourLabel, NFixedPage, NScrollableForm, NScrollablePage
|
||||
)
|
||||
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NSpinBox
|
||||
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NIconToolButton, NSpinBox
|
||||
from novelwriter.extensions.pagedsidebar import NPagedSideBar
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.switchbox import NSwitchBox
|
||||
@@ -316,14 +316,13 @@ class _FilterTab(NFixedPage):
|
||||
# Project Tree
|
||||
# ============
|
||||
|
||||
# Tree Settings
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
cMg = CONFIG.pxInt(6)
|
||||
iconSize = QSize(iPx, iPx)
|
||||
|
||||
# Tree Widget
|
||||
self.optTree = QTreeWidget(self)
|
||||
self.optTree.setIconSize(QSize(iPx, iPx))
|
||||
self.optTree.setIconSize(iSz)
|
||||
self.optTree.setUniformRowHeights(True)
|
||||
self.optTree.setAllColumnsShowFocus(True)
|
||||
self.optTree.setHeaderHidden(True)
|
||||
@@ -346,22 +345,18 @@ class _FilterTab(NFixedPage):
|
||||
# Filters
|
||||
# =======
|
||||
|
||||
self.includedButton = QToolButton(self)
|
||||
self.includedButton = NIconToolButton(self, iSz)
|
||||
self.includedButton.setToolTip(self.tr("Always included"))
|
||||
self.includedButton.setIcon(self._statusFlags[self.F_INCLUDED])
|
||||
self.includedButton.setIconSize(iconSize)
|
||||
self.includedButton.clicked.connect(lambda: self._setSelectedMode(self.F_INCLUDED))
|
||||
|
||||
self.excludedButton = QToolButton(self)
|
||||
self.excludedButton = NIconToolButton(self, iSz)
|
||||
self.excludedButton.setToolTip(self.tr("Always excluded"))
|
||||
self.excludedButton.setIcon(self._statusFlags[self.F_EXCLUDED])
|
||||
self.excludedButton.setIconSize(iconSize)
|
||||
self.excludedButton.clicked.connect(lambda: self._setSelectedMode(self.F_EXCLUDED))
|
||||
|
||||
self.resetButton = QToolButton(self)
|
||||
self.resetButton = NIconToolButton(self, iSz, "revert")
|
||||
self.resetButton.setToolTip(self.tr("Reset to default"))
|
||||
self.resetButton.setIcon(SHARED.theme.getIcon("revert"))
|
||||
self.resetButton.setIconSize(iconSize)
|
||||
self.resetButton.clicked.connect(lambda: self._setSelectedMode(self.F_FILTERED))
|
||||
|
||||
self.modeBox = QHBoxLayout()
|
||||
@@ -598,12 +593,11 @@ class _HeadingsTab(NScrollablePage):
|
||||
self._build = build
|
||||
self._editing = 0
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
sSp = CONFIG.pxInt(16)
|
||||
vSp = CONFIG.pxInt(12)
|
||||
bSp = CONFIG.pxInt(6)
|
||||
iconSize = QSize(iPx, iPx)
|
||||
editIcon = SHARED.theme.getIcon("edit")
|
||||
trHide = self.tr("Hide")
|
||||
|
||||
# Format Boxes
|
||||
@@ -615,9 +609,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.lblTitle = QLabel(self._build.getLabel("headings.fmtTitle"), self)
|
||||
self.fmtTitle = QLineEdit("", self)
|
||||
self.fmtTitle.setReadOnly(True)
|
||||
self.btnTitle = QToolButton(self)
|
||||
self.btnTitle.setIcon(editIcon)
|
||||
self.btnTitle.setIconSize(iconSize)
|
||||
self.btnTitle = NIconToolButton(self, iSz, "edit")
|
||||
self.btnTitle.clicked.connect(lambda: self._editHeading(self.EDIT_TITLE))
|
||||
self.hdeTitle = QLabel(trHide, self)
|
||||
self.hdeTitle.setIndent(bSp)
|
||||
@@ -633,9 +625,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.lblChapter = QLabel(self._build.getLabel("headings.fmtChapter"), self)
|
||||
self.fmtChapter = QLineEdit("", self)
|
||||
self.fmtChapter.setReadOnly(True)
|
||||
self.btnChapter = QToolButton(self)
|
||||
self.btnChapter.setIcon(editIcon)
|
||||
self.btnChapter.setIconSize(iconSize)
|
||||
self.btnChapter = NIconToolButton(self, iSz, "edit")
|
||||
self.btnChapter.clicked.connect(lambda: self._editHeading(self.EDIT_CHAPTER))
|
||||
self.hdeChapter = QLabel(trHide, self)
|
||||
self.hdeChapter.setIndent(bSp)
|
||||
@@ -651,9 +641,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.lblUnnumbered = QLabel(self._build.getLabel("headings.fmtUnnumbered"), self)
|
||||
self.fmtUnnumbered = QLineEdit("", self)
|
||||
self.fmtUnnumbered.setReadOnly(True)
|
||||
self.btnUnnumbered = QToolButton(self)
|
||||
self.btnUnnumbered.setIcon(editIcon)
|
||||
self.btnUnnumbered.setIconSize(iconSize)
|
||||
self.btnUnnumbered = NIconToolButton(self, iSz, "edit")
|
||||
self.btnUnnumbered.clicked.connect(lambda: self._editHeading(self.EDIT_UNNUM))
|
||||
self.hdeUnnumbered = QLabel(trHide, self)
|
||||
self.hdeUnnumbered.setIndent(bSp)
|
||||
@@ -669,9 +657,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.lblScene = QLabel(self._build.getLabel("headings.fmtScene"), self)
|
||||
self.fmtScene = QLineEdit("", self)
|
||||
self.fmtScene.setReadOnly(True)
|
||||
self.btnScene = QToolButton(self)
|
||||
self.btnScene.setIcon(editIcon)
|
||||
self.btnScene.setIconSize(iconSize)
|
||||
self.btnScene = NIconToolButton(self, iSz, "edit")
|
||||
self.btnScene.clicked.connect(lambda: self._editHeading(self.EDIT_SCENE))
|
||||
self.hdeScene = QLabel(trHide, self)
|
||||
self.hdeScene.setIndent(bSp)
|
||||
@@ -687,9 +673,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.lblHScene = QLabel(self._build.getLabel("headings.fmtHardScene"), self)
|
||||
self.fmtHScene = QLineEdit("", self)
|
||||
self.fmtHScene.setReadOnly(True)
|
||||
self.btnHScene = QToolButton(self)
|
||||
self.btnHScene.setIcon(editIcon)
|
||||
self.btnHScene.setIconSize(iconSize)
|
||||
self.btnHScene = NIconToolButton(self, iSz, "edit")
|
||||
self.btnHScene.clicked.connect(lambda: self._editHeading(self.EDIT_HSCENE))
|
||||
self.hdeHScene = QLabel(trHide, self)
|
||||
self.hdeHScene.setIndent(bSp)
|
||||
@@ -705,9 +689,7 @@ class _HeadingsTab(NScrollablePage):
|
||||
self.lblSection = QLabel(self._build.getLabel("headings.fmtSection"), self)
|
||||
self.fmtSection = QLineEdit("", self)
|
||||
self.fmtSection.setReadOnly(True)
|
||||
self.btnSection = QToolButton(self)
|
||||
self.btnSection.setIcon(editIcon)
|
||||
self.btnSection.setIconSize(iconSize)
|
||||
self.btnSection = NIconToolButton(self, iSz, "edit")
|
||||
self.btnSection.clicked.connect(lambda: self._editHeading(self.EDIT_SECTION))
|
||||
self.hdeSection = QLabel(trHide, self)
|
||||
self.hdeSection.setIndent(bSp)
|
||||
@@ -996,8 +978,8 @@ class _ContentTab(NScrollableForm):
|
||||
|
||||
self._build = build
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iconSize = QSize(iPx, iPx)
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
|
||||
# Text Content
|
||||
self.incBodyText = NSwitch(self, height=iPx)
|
||||
@@ -1014,11 +996,8 @@ class _ContentTab(NScrollableForm):
|
||||
lambda keyword=keyword: self._updateIgnoredKeywords(keyword)
|
||||
)
|
||||
|
||||
self.ignoredKeywordsButton = QToolButton(self)
|
||||
self.ignoredKeywordsButton.setIcon(SHARED.theme.getIcon("add"))
|
||||
self.ignoredKeywordsButton.setIconSize(iconSize)
|
||||
self.ignoredKeywordsButton = NIconToolButton(self, iSz, "add")
|
||||
self.ignoredKeywordsButton.setMenu(self.mnKeywords)
|
||||
self.ignoredKeywordsButton.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
|
||||
self.addGroupLabel(self._build.getLabel("text.grpContent"))
|
||||
self.addRow(self._build.getLabel("text.includeBodyText"), self.incBodyText)
|
||||
@@ -1087,7 +1066,8 @@ class _FormatTab(NScrollableForm):
|
||||
self._build = build
|
||||
self._unitScale = 1.0
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
spW = 6*SHARED.theme.textNWidth
|
||||
dbW = 8*SHARED.theme.textNWidth
|
||||
|
||||
@@ -1099,8 +1079,7 @@ class _FormatTab(NScrollableForm):
|
||||
# Font Family
|
||||
self.textFont = QLineEdit(self)
|
||||
self.textFont.setReadOnly(True)
|
||||
self.btnTextFont = QPushButton("...")
|
||||
self.btnTextFont.setMaximumWidth(int(2.5*SHARED.theme.getTextWidth("...")))
|
||||
self.btnTextFont = NIconToolButton(self, iSz, "more")
|
||||
self.btnTextFont.clicked.connect(self._selectFont)
|
||||
self.addRow(
|
||||
self._build.getLabel("format.textFont"), self.textFont,
|
||||
@@ -1353,9 +1332,9 @@ class _OutputTab(NScrollableForm):
|
||||
|
||||
self._build = build
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
spW = 6*SHARED.theme.textNWidth
|
||||
iconSize = QSize(iPx, iPx)
|
||||
|
||||
# Open Document
|
||||
self.addGroupLabel(self._build.getLabel("odt"))
|
||||
@@ -1365,9 +1344,7 @@ class _OutputTab(NScrollableForm):
|
||||
|
||||
self.odtPageHeader = QLineEdit(self)
|
||||
self.odtPageHeader.setMinimumWidth(CONFIG.pxInt(200))
|
||||
self.btnPageHeader = QToolButton(self)
|
||||
self.btnPageHeader.setIcon(SHARED.theme.getIcon("revert"))
|
||||
self.btnPageHeader.setIconSize(iconSize)
|
||||
self.btnPageHeader = NIconToolButton(self, iSz, "revert")
|
||||
self.btnPageHeader.clicked.connect(self._resetPageHeader)
|
||||
self.addRow(
|
||||
self._build.getLabel("odt.pageHeader"), self.odtPageHeader,
|
||||
|
||||
@@ -27,7 +27,7 @@ import math
|
||||
import logging
|
||||
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtCore import QSize, Qt, pyqtSlot
|
||||
from PyQt5.QtCore import Qt, pyqtSlot
|
||||
from PyQt5.QtWidgets import (
|
||||
QAbstractItemView, QDialog, QDialogButtonBox, QFormLayout, QGridLayout,
|
||||
QHBoxLayout, QLabel, QSpinBox, QStackedWidget, QTreeWidget,
|
||||
@@ -310,7 +310,8 @@ class _ContentsPage(NFixedPage):
|
||||
self._data = []
|
||||
self._currentRoot = None
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
hPx = CONFIG.pxInt(12)
|
||||
vPx = CONFIG.pxInt(4)
|
||||
options = SHARED.project.options
|
||||
@@ -323,7 +324,7 @@ class _ContentsPage(NFixedPage):
|
||||
|
||||
# Contents Tree
|
||||
self.tocTree = QTreeWidget(self)
|
||||
self.tocTree.setIconSize(QSize(iPx, iPx))
|
||||
self.tocTree.setIconSize(iSz)
|
||||
self.tocTree.setIndentation(0)
|
||||
self.tocTree.setColumnCount(6)
|
||||
self.tocTree.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
||||
|
||||
@@ -36,8 +36,8 @@ from PyQt5.QtCore import (
|
||||
from PyQt5.QtWidgets import (
|
||||
QAction, QDialog, QFileDialog, QFormLayout, QHBoxLayout, QLabel, QLineEdit,
|
||||
QListView, QMenu, QPushButton, QScrollArea, QShortcut, QStackedWidget,
|
||||
QStyle, QStyleOptionViewItem, QStyledItemDelegate, QToolButton,
|
||||
QVBoxLayout, QWidget, qApp
|
||||
QStyle, QStyleOptionViewItem, QStyledItemDelegate, QVBoxLayout, QWidget,
|
||||
qApp
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
@@ -46,7 +46,7 @@ from novelwriter.constants import nwFiles
|
||||
from novelwriter.core.coretools import ProjectBuilder
|
||||
from novelwriter.enum import nwItemClass
|
||||
from novelwriter.extensions.configlayout import NWrappedWidgetBox
|
||||
from novelwriter.extensions.modified import NSpinBox
|
||||
from novelwriter.extensions.modified import NIconToolButton, NSpinBox
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
from novelwriter.extensions.versioninfo import VersionInfoWidget
|
||||
from novelwriter.types import QtAlignLeft, QtAlignRightTop
|
||||
@@ -76,8 +76,9 @@ class GuiWelcome(QDialog):
|
||||
hD = CONFIG.pxInt(36)
|
||||
hE = CONFIG.pxInt(48)
|
||||
hF = CONFIG.pxInt(128)
|
||||
self._hPx = CONFIG.pxInt(600)
|
||||
btnIconSize = SHARED.theme.buttonIconSize
|
||||
|
||||
self._hPx = CONFIG.pxInt(600)
|
||||
self.resize(*CONFIG.welcomeWinSize)
|
||||
|
||||
# Elements
|
||||
@@ -110,26 +111,32 @@ class GuiWelcome(QDialog):
|
||||
|
||||
self.btnList = QPushButton(self.tr("List"), self)
|
||||
self.btnList.setIcon(SHARED.theme.getIcon("list"))
|
||||
self.btnList.setIconSize(btnIconSize)
|
||||
self.btnList.clicked.connect(self._showOpenProjectPage)
|
||||
|
||||
self.btnNew = QPushButton(self.tr("New"), self)
|
||||
self.btnNew.setIcon(SHARED.theme.getIcon("add"))
|
||||
self.btnNew.setIconSize(btnIconSize)
|
||||
self.btnNew.clicked.connect(self._showNewProjectPage)
|
||||
|
||||
self.btnBrowse = QPushButton(self.tr("Browse"), self)
|
||||
self.btnBrowse.setIcon(SHARED.theme.getIcon("browse"))
|
||||
self.btnBrowse.setIconSize(btnIconSize)
|
||||
self.btnBrowse.clicked.connect(self._browseForProject)
|
||||
|
||||
self.btnCancel = QPushButton(self.tr("Cancel"), self)
|
||||
self.btnCancel.setIcon(SHARED.theme.getIcon("cross"))
|
||||
self.btnCancel.setIconSize(btnIconSize)
|
||||
self.btnCancel.clicked.connect(self.close)
|
||||
|
||||
self.btnCreate = QPushButton(self.tr("Create"), self)
|
||||
self.btnCreate.setIcon(SHARED.theme.getIcon("star"))
|
||||
self.btnCreate.setIconSize(btnIconSize)
|
||||
self.btnCreate.clicked.connect(self.tabNew.createNewProject)
|
||||
|
||||
self.btnOpen = QPushButton(self.tr("Open"), self)
|
||||
self.btnOpen.setIcon(SHARED.theme.getIcon("open"))
|
||||
self.btnOpen.setIconSize(btnIconSize)
|
||||
self.btnOpen.clicked.connect(self._openSelectedItem)
|
||||
|
||||
self.btnBox = QHBoxLayout()
|
||||
@@ -557,11 +564,10 @@ class _NewProjectForm(QWidget):
|
||||
self._fillMode = self.FILL_BLANK
|
||||
self._copyPath = None
|
||||
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
sPx = CONFIG.pxInt(16)
|
||||
|
||||
iconSize = QSize(iPx, iPx)
|
||||
|
||||
# Project Settings
|
||||
# ================
|
||||
|
||||
@@ -580,9 +586,7 @@ class _NewProjectForm(QWidget):
|
||||
self.projPath = QLineEdit(self)
|
||||
self.projPath.setReadOnly(True)
|
||||
|
||||
self.browsePath = QToolButton(self)
|
||||
self.browsePath.setIcon(SHARED.theme.getIcon("browse"))
|
||||
self.browsePath.setIconSize(iconSize)
|
||||
self.browsePath = NIconToolButton(self, iSz, "browse")
|
||||
self.browsePath.clicked.connect(self._doBrowse)
|
||||
|
||||
self.pathBox = QHBoxLayout()
|
||||
@@ -593,9 +597,7 @@ class _NewProjectForm(QWidget):
|
||||
self.projFill = QLineEdit(self)
|
||||
self.projFill.setReadOnly(True)
|
||||
|
||||
self.browseFill = QToolButton(self)
|
||||
self.browseFill.setIconSize(iconSize)
|
||||
self.browseFill.setIcon(SHARED.theme.getIcon("add_document"))
|
||||
self.browseFill = NIconToolButton(self, iSz, "add_document")
|
||||
|
||||
self.fillMenu = _PopLeftDirectionMenu(self.browseFill)
|
||||
|
||||
@@ -612,7 +614,6 @@ class _NewProjectForm(QWidget):
|
||||
self.fillCopy.triggered.connect(self._setFillCopy)
|
||||
|
||||
self.browseFill.setMenu(self.fillMenu)
|
||||
self.browseFill.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
|
||||
self.fillBox = QHBoxLayout()
|
||||
self.fillBox.addWidget(self.projFill)
|
||||
|
||||
@@ -188,7 +188,7 @@ class GuiWritingStats(QDialog):
|
||||
self.infoForm.setRowStretch(6, 1)
|
||||
|
||||
# Filter Options
|
||||
iPx = SHARED.theme.baseIconSize
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
|
||||
self.filterBox = QGroupBox(self.tr("Filters"), self)
|
||||
self.filterForm = QGridLayout(self)
|
||||
|
||||
@@ -75,7 +75,7 @@ class MockStatusBar:
|
||||
class MockTheme:
|
||||
|
||||
def __init__(self):
|
||||
self.baseIconSize = 10
|
||||
self.baseIconHeight = 10
|
||||
return
|
||||
|
||||
def getPixmap(self, *a):
|
||||
|
||||