Improve how tool buttons are generated
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user