Clean up warnings and deprecations in base and dialogs
This commit is contained in:
@@ -49,18 +49,13 @@ class GuiAbout(NDialog):
|
||||
self.setObjectName("GuiAbout")
|
||||
|
||||
self.setWindowTitle(self.tr("About novelWriter"))
|
||||
self.resize(CONFIG.pxInt(700), CONFIG.pxInt(500))
|
||||
|
||||
hA = CONFIG.pxInt(8)
|
||||
hB = CONFIG.pxInt(16)
|
||||
nwH = CONFIG.pxInt(36)
|
||||
nwPx = CONFIG.pxInt(128)
|
||||
self.resize(700, 500)
|
||||
|
||||
# Logo and Banner
|
||||
self.nwImage = SHARED.theme.loadDecoration("nw-text", h=nwH)
|
||||
self.nwImage = SHARED.theme.loadDecoration("nw-text", h=36)
|
||||
|
||||
self.nwLogo = QLabel(self)
|
||||
self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (nwPx, nwPx)))
|
||||
self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (128, 128)))
|
||||
|
||||
self.nwLabel = QLabel(self)
|
||||
self.nwLabel.setPixmap(self.nwImage)
|
||||
@@ -79,8 +74,7 @@ class GuiAbout(NDialog):
|
||||
|
||||
self.txtCredits = QTextBrowser(self)
|
||||
self.txtCredits.setOpenExternalLinks(True)
|
||||
self.txtCredits.document().setDocumentMargin(0)
|
||||
self.txtCredits.setViewportMargins(0, hA, hA, 0)
|
||||
self.txtCredits.setViewportMargins(0, 8, 8, 0)
|
||||
|
||||
# Buttons
|
||||
self.btnBox = QDialogButtonBox(QtDialogClose, self)
|
||||
@@ -88,15 +82,15 @@ class GuiAbout(NDialog):
|
||||
|
||||
# Assemble
|
||||
self.innerBox = QVBoxLayout()
|
||||
self.innerBox.addSpacing(hB)
|
||||
self.innerBox.addSpacing(16)
|
||||
self.innerBox.addWidget(self.nwLabel)
|
||||
self.innerBox.addWidget(self.nwInfo)
|
||||
self.innerBox.addSpacing(hA)
|
||||
self.innerBox.addSpacing(8)
|
||||
self.innerBox.addWidget(self.nwLicence)
|
||||
self.innerBox.addSpacing(hA)
|
||||
self.innerBox.addSpacing(8)
|
||||
self.innerBox.addWidget(self.lblCredits)
|
||||
self.innerBox.addWidget(self.txtCredits)
|
||||
self.innerBox.addSpacing(hB)
|
||||
self.innerBox.addSpacing(16)
|
||||
self.innerBox.addWidget(self.btnBox)
|
||||
|
||||
self.outerBox = QHBoxLayout()
|
||||
|
||||
@@ -32,7 +32,7 @@ from PyQt6.QtWidgets import (
|
||||
QListWidgetItem, QVBoxLayout, QWidget
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.extensions.configlayout import NColourLabel
|
||||
from novelwriter.extensions.modified import NDialog
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
@@ -63,14 +63,11 @@ class GuiDocMerge(NDialog):
|
||||
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
hSp = CONFIG.pxInt(12)
|
||||
vSp = CONFIG.pxInt(8)
|
||||
bSp = CONFIG.pxInt(12)
|
||||
|
||||
self.listBox = QListWidget(self)
|
||||
self.listBox.setIconSize(iSz)
|
||||
self.listBox.setMinimumWidth(CONFIG.pxInt(400))
|
||||
self.listBox.setMinimumHeight(CONFIG.pxInt(180))
|
||||
self.listBox.setMinimumWidth(400)
|
||||
self.listBox.setMinimumHeight(180)
|
||||
self.listBox.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||
self.listBox.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
|
||||
@@ -82,7 +79,7 @@ class GuiDocMerge(NDialog):
|
||||
self.optBox = QGridLayout()
|
||||
self.optBox.addWidget(self.trashLabel, 0, 0)
|
||||
self.optBox.addWidget(self.trashSwitch, 0, 1)
|
||||
self.optBox.setHorizontalSpacing(hSp)
|
||||
self.optBox.setHorizontalSpacing(12)
|
||||
self.optBox.setColumnStretch(2, 1)
|
||||
|
||||
# Buttons
|
||||
@@ -91,18 +88,19 @@ class GuiDocMerge(NDialog):
|
||||
self.buttonBox.rejected.connect(self.reject)
|
||||
|
||||
self.resetButton = self.buttonBox.addButton(QtDialogReset)
|
||||
self.resetButton.clicked.connect(self._resetList)
|
||||
if self.resetButton is not None:
|
||||
self.resetButton.clicked.connect(self._resetList)
|
||||
|
||||
# Assemble
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.outerBox.setSpacing(0)
|
||||
self.outerBox.addWidget(self.headLabel)
|
||||
self.outerBox.addWidget(self.helpLabel)
|
||||
self.outerBox.addSpacing(vSp)
|
||||
self.outerBox.addSpacing(8)
|
||||
self.outerBox.addWidget(self.listBox)
|
||||
self.outerBox.addSpacing(vSp)
|
||||
self.outerBox.addSpacing(8)
|
||||
self.outerBox.addLayout(self.optBox)
|
||||
self.outerBox.addSpacing(bSp)
|
||||
self.outerBox.addSpacing(12)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ from PyQt6.QtWidgets import (
|
||||
QListWidget, QListWidgetItem, QVBoxLayout, QWidget
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter import SHARED
|
||||
from novelwriter.extensions.configlayout import NColourLabel
|
||||
from novelwriter.extensions.modified import NDialog
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
@@ -67,9 +67,6 @@ class GuiDocSplit(NDialog):
|
||||
|
||||
# Values
|
||||
iPx = SHARED.theme.baseIconHeight
|
||||
hSp = CONFIG.pxInt(12)
|
||||
vSp = CONFIG.pxInt(8)
|
||||
bSp = CONFIG.pxInt(12)
|
||||
|
||||
pOptions = SHARED.project.options
|
||||
spLevel = pOptions.getInt("GuiDocSplit", "spLevel", 3)
|
||||
@@ -79,11 +76,11 @@ class GuiDocSplit(NDialog):
|
||||
# Heading Selection
|
||||
self.listBox = QListWidget(self)
|
||||
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.NoDragDrop)
|
||||
self.listBox.setMinimumWidth(CONFIG.pxInt(400))
|
||||
self.listBox.setMinimumHeight(CONFIG.pxInt(180))
|
||||
self.listBox.setMinimumWidth(400)
|
||||
self.listBox.setMinimumHeight(180)
|
||||
|
||||
self.splitLevel = QComboBox(self)
|
||||
self.splitLevel.addItem(self.tr("Split on Heading Level 1 (Partition)"), 1)
|
||||
self.splitLevel.addItem(self.tr("Split on Heading Level 1 (Partition)"), 1)
|
||||
self.splitLevel.addItem(self.tr("Split up to Heading Level 2 (Chapter)"), 2)
|
||||
self.splitLevel.addItem(self.tr("Split up to Heading Level 3 (Scene)"), 3)
|
||||
self.splitLevel.addItem(self.tr("Split up to Heading Level 4 (Section)"), 4)
|
||||
@@ -111,8 +108,8 @@ class GuiDocSplit(NDialog):
|
||||
self.optBox.addWidget(self.hierarchySwitch, 1, 1)
|
||||
self.optBox.addWidget(self.trashLabel, 2, 0)
|
||||
self.optBox.addWidget(self.trashSwitch, 2, 1)
|
||||
self.optBox.setVerticalSpacing(vSp)
|
||||
self.optBox.setHorizontalSpacing(hSp)
|
||||
self.optBox.setVerticalSpacing(8)
|
||||
self.optBox.setHorizontalSpacing(12)
|
||||
self.optBox.setColumnStretch(3, 1)
|
||||
|
||||
# Buttons
|
||||
@@ -125,12 +122,12 @@ class GuiDocSplit(NDialog):
|
||||
self.outerBox.setSpacing(0)
|
||||
self.outerBox.addWidget(self.headLabel)
|
||||
self.outerBox.addWidget(self.helpLabel)
|
||||
self.outerBox.addSpacing(vSp)
|
||||
self.outerBox.addSpacing(8)
|
||||
self.outerBox.addWidget(self.listBox)
|
||||
self.outerBox.addWidget(self.splitLevel)
|
||||
self.outerBox.addSpacing(vSp)
|
||||
self.outerBox.addSpacing(8)
|
||||
self.outerBox.addLayout(self.optBox)
|
||||
self.outerBox.addSpacing(bSp)
|
||||
self.outerBox.addSpacing(12)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import logging
|
||||
|
||||
from PyQt6.QtWidgets import QDialogButtonBox, QHBoxLayout, QLabel, QLineEdit, QVBoxLayout, QWidget
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.extensions.modified import NDialog
|
||||
from novelwriter.types import QtAccepted, QtDialogCancel, QtDialogOk
|
||||
|
||||
@@ -43,12 +42,9 @@ class GuiEditLabel(NDialog):
|
||||
self.setObjectName("GuiEditLabel")
|
||||
self.setWindowTitle(self.tr("Item Label"))
|
||||
|
||||
mVd = CONFIG.pxInt(220)
|
||||
mSp = CONFIG.pxInt(12)
|
||||
|
||||
# Item Label
|
||||
self.labelValue = QLineEdit(self)
|
||||
self.labelValue.setMinimumWidth(mVd)
|
||||
self.labelValue.setMinimumWidth(220)
|
||||
self.labelValue.setMaxLength(200)
|
||||
self.labelValue.setText(text)
|
||||
self.labelValue.selectAll()
|
||||
@@ -62,10 +58,10 @@ class GuiEditLabel(NDialog):
|
||||
self.innerBox = QHBoxLayout()
|
||||
self.innerBox.addWidget(QLabel(self.tr("Label"), self), 0)
|
||||
self.innerBox.addWidget(self.labelValue, 1)
|
||||
self.innerBox.setSpacing(mSp)
|
||||
self.innerBox.setSpacing(12)
|
||||
|
||||
self.outerBox = QVBoxLayout()
|
||||
self.outerBox.setSpacing(mSp)
|
||||
self.outerBox.setSpacing(12)
|
||||
self.outerBox.addLayout(self.innerBox, 1)
|
||||
self.outerBox.addWidget(self.buttonBox, 0)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
|
||||
from PyQt6.QtCore import Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt6.QtGui import QCloseEvent, QKeyEvent, QKeySequence
|
||||
from PyQt6.QtGui import QAction, QCloseEvent, QKeyEvent, QKeySequence
|
||||
from PyQt6.QtWidgets import (
|
||||
QCompleter, QDialogButtonBox, QFileDialog, QHBoxLayout, QLineEdit,
|
||||
QPushButton, QVBoxLayout, QWidget
|
||||
@@ -58,23 +58,23 @@ class GuiPreferences(NDialog):
|
||||
logger.debug("Create: GuiPreferences")
|
||||
self.setObjectName("GuiPreferences")
|
||||
self.setWindowTitle(self.tr("Preferences"))
|
||||
self.setMinimumSize(CONFIG.pxInt(600), CONFIG.pxInt(500))
|
||||
self.setMinimumSize(600, 500)
|
||||
self.resize(*CONFIG.prefsWinSize)
|
||||
|
||||
# Title
|
||||
self.titleLabel = NColourLabel(
|
||||
self.tr("Preferences"), self, color=SHARED.theme.helpText,
|
||||
scale=NColourLabel.HEADER_SCALE, indent=CONFIG.pxInt(4)
|
||||
scale=NColourLabel.HEADER_SCALE, indent=4,
|
||||
)
|
||||
|
||||
# Search Box
|
||||
self.searchAction = QAction(SHARED.theme.getIcon("search"), "")
|
||||
self.searchAction.triggered.connect(self._gotoSearch)
|
||||
|
||||
self.searchText = QLineEdit(self)
|
||||
self.searchText.setPlaceholderText(self.tr("Search"))
|
||||
self.searchText.setMinimumWidth(CONFIG.pxInt(200))
|
||||
self.searchAction = self.searchText.addAction(
|
||||
SHARED.theme.getIcon("search"), QLineEdit.ActionPosition.TrailingPosition
|
||||
)
|
||||
self.searchAction.triggered.connect(self._gotoSearch)
|
||||
self.searchText.setMinimumWidth(200)
|
||||
self.searchText.addAction(self.searchAction, QLineEdit.ActionPosition.TrailingPosition)
|
||||
|
||||
# SideBar
|
||||
self.sidebar = NPagedSideBar(self)
|
||||
@@ -105,7 +105,7 @@ class GuiPreferences(NDialog):
|
||||
self.outerBox.addLayout(self.searchBox)
|
||||
self.outerBox.addLayout(self.mainBox)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.outerBox.setSpacing(CONFIG.pxInt(8))
|
||||
self.outerBox.setSpacing(8)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
self.setSizeGripEnabled(True)
|
||||
@@ -134,8 +134,6 @@ class GuiPreferences(NDialog):
|
||||
section = 0
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
boxFixed = 6*SHARED.theme.textNWidth
|
||||
minWidth = CONFIG.pxInt(200)
|
||||
fontWidth = CONFIG.pxInt(162)
|
||||
|
||||
# Temporary Variables
|
||||
self._guiFont = CONFIG.guiFont
|
||||
@@ -154,7 +152,7 @@ class GuiPreferences(NDialog):
|
||||
|
||||
# Display Language
|
||||
self.guiLocale = NComboBox(self)
|
||||
self.guiLocale.setMinimumWidth(minWidth)
|
||||
self.guiLocale.setMinimumWidth(200)
|
||||
for lang, name in CONFIG.listLanguages(CONFIG.LANG_NW):
|
||||
self.guiLocale.addItem(name, lang)
|
||||
self.guiLocale.setCurrentData(CONFIG.guiLocale, "en_GB")
|
||||
@@ -166,7 +164,7 @@ class GuiPreferences(NDialog):
|
||||
|
||||
# Colour Theme
|
||||
self.guiTheme = NComboBox(self)
|
||||
self.guiTheme.setMinimumWidth(minWidth)
|
||||
self.guiTheme.setMinimumWidth(200)
|
||||
for theme, name in SHARED.theme.listThemes():
|
||||
self.guiTheme.addItem(name, theme)
|
||||
self.guiTheme.setCurrentData(CONFIG.guiTheme, "default")
|
||||
@@ -178,7 +176,7 @@ class GuiPreferences(NDialog):
|
||||
|
||||
# Icon Theme
|
||||
self.iconTheme = NComboBox(self)
|
||||
self.iconTheme.setMinimumWidth(minWidth)
|
||||
self.iconTheme.setMinimumWidth(200)
|
||||
for theme, name in SHARED.theme.iconCache.listThemes():
|
||||
self.iconTheme.addItem(name, theme)
|
||||
self.iconTheme.setCurrentData(CONFIG.iconTheme, "material_rounded_bold")
|
||||
@@ -190,7 +188,7 @@ class GuiPreferences(NDialog):
|
||||
|
||||
# Tree Icon Colours
|
||||
self.iconColTree = NComboBox(self)
|
||||
self.iconColTree.setMinimumWidth(minWidth)
|
||||
self.iconColTree.setMinimumWidth(200)
|
||||
for key, label in nwLabels.THEME_COLORS.items():
|
||||
self.iconColTree.addItem(trConst(label), key)
|
||||
self.iconColTree.setCurrentData(CONFIG.iconColTree, "theme")
|
||||
@@ -211,7 +209,7 @@ class GuiPreferences(NDialog):
|
||||
# Application Font Family
|
||||
self.guiFont = QLineEdit(self)
|
||||
self.guiFont.setReadOnly(True)
|
||||
self.guiFont.setMinimumWidth(fontWidth)
|
||||
self.guiFont.setMinimumWidth(162)
|
||||
self.guiFont.setText(describeFont(self._guiFont))
|
||||
self.guiFont.setCursorPosition(0)
|
||||
self.guiFontButton = NIconToolButton(self, iSz, "font")
|
||||
@@ -256,7 +254,7 @@ class GuiPreferences(NDialog):
|
||||
|
||||
# Document Colour Theme
|
||||
self.guiSyntax = NComboBox(self)
|
||||
self.guiSyntax.setMinimumWidth(CONFIG.pxInt(200))
|
||||
self.guiSyntax.setMinimumWidth(200)
|
||||
for syntax, name in SHARED.theme.listSyntax():
|
||||
self.guiSyntax.addItem(name, syntax)
|
||||
self.guiSyntax.setCurrentData(CONFIG.guiSyntax, "default_light")
|
||||
@@ -269,7 +267,7 @@ class GuiPreferences(NDialog):
|
||||
# Document Font Family
|
||||
self.textFont = QLineEdit(self)
|
||||
self.textFont.setReadOnly(True)
|
||||
self.textFont.setMinimumWidth(fontWidth)
|
||||
self.textFont.setMinimumWidth(162)
|
||||
self.textFont.setText(describeFont(CONFIG.textFont))
|
||||
self.textFont.setCursorPosition(0)
|
||||
self.textFontButton = NIconToolButton(self, iSz, "font")
|
||||
@@ -482,7 +480,7 @@ class GuiPreferences(NDialog):
|
||||
|
||||
# Spell Checking
|
||||
self.spellLanguage = NComboBox(self)
|
||||
self.spellLanguage.setMinimumWidth(minWidth)
|
||||
self.spellLanguage.setMinimumWidth(200)
|
||||
|
||||
if CONFIG.hasEnchant:
|
||||
for tag, language in SHARED.spelling.listDictionaries():
|
||||
@@ -651,8 +649,6 @@ class GuiPreferences(NDialog):
|
||||
self.sidebar.addButton(title, section)
|
||||
self.mainForm.addGroupLabel(title, section)
|
||||
|
||||
boxWidth = CONFIG.pxInt(150)
|
||||
|
||||
# Auto-Replace as You Type Main Switch
|
||||
self.doReplace = NSwitch(self)
|
||||
self.doReplace.setChecked(CONFIG.doReplace)
|
||||
@@ -701,7 +697,7 @@ class GuiPreferences(NDialog):
|
||||
# Pad Before
|
||||
self.fmtPadBefore = QLineEdit(self)
|
||||
self.fmtPadBefore.setMaxLength(32)
|
||||
self.fmtPadBefore.setMinimumWidth(boxWidth)
|
||||
self.fmtPadBefore.setMinimumWidth(150)
|
||||
self.fmtPadBefore.setText(CONFIG.fmtPadBefore)
|
||||
self.mainForm.addRow(
|
||||
self.tr("Insert non-breaking space before"), self.fmtPadBefore,
|
||||
@@ -711,7 +707,7 @@ class GuiPreferences(NDialog):
|
||||
# Pad After
|
||||
self.fmtPadAfter = QLineEdit(self)
|
||||
self.fmtPadAfter.setMaxLength(32)
|
||||
self.fmtPadAfter.setMinimumWidth(boxWidth)
|
||||
self.fmtPadAfter.setMinimumWidth(150)
|
||||
self.fmtPadAfter.setText(CONFIG.fmtPadAfter)
|
||||
self.mainForm.addRow(
|
||||
self.tr("Insert non-breaking space after"), self.fmtPadAfter,
|
||||
|
||||
@@ -30,7 +30,7 @@ import logging
|
||||
from pathlib import Path
|
||||
|
||||
from PyQt6.QtCore import Qt, pyqtSignal, pyqtSlot
|
||||
from PyQt6.QtGui import QCloseEvent, QColor
|
||||
from PyQt6.QtGui import QAction, QCloseEvent, QColor
|
||||
from PyQt6.QtWidgets import (
|
||||
QAbstractItemView, QApplication, QColorDialog, QDialogButtonBox,
|
||||
QFileDialog, QGridLayout, QHBoxLayout, QLineEdit, QMenu, QStackedWidget,
|
||||
@@ -71,16 +71,16 @@ class GuiProjectSettings(NDialog):
|
||||
self.setWindowTitle(self.tr("Project Settings"))
|
||||
|
||||
options = SHARED.project.options
|
||||
self.setMinimumSize(CONFIG.pxInt(500), CONFIG.pxInt(400))
|
||||
self.setMinimumSize(500, 400)
|
||||
self.resize(
|
||||
CONFIG.pxInt(options.getInt("GuiProjectSettings", "winWidth", CONFIG.pxInt(650))),
|
||||
CONFIG.pxInt(options.getInt("GuiProjectSettings", "winHeight", CONFIG.pxInt(500)))
|
||||
options.getInt("GuiProjectSettings", "winWidth", 650),
|
||||
options.getInt("GuiProjectSettings", "winHeight", 500),
|
||||
)
|
||||
|
||||
# Title
|
||||
self.titleLabel = NColourLabel(
|
||||
self.tr("Project Settings"), self, color=SHARED.theme.helpText,
|
||||
scale=NColourLabel.HEADER_SCALE, indent=CONFIG.pxInt(4)
|
||||
scale=NColourLabel.HEADER_SCALE, indent=4,
|
||||
)
|
||||
|
||||
# SideBar
|
||||
@@ -125,7 +125,7 @@ class GuiProjectSettings(NDialog):
|
||||
self.outerBox.addLayout(self.topBox)
|
||||
self.outerBox.addLayout(self.mainBox)
|
||||
self.outerBox.addWidget(self.buttonBox)
|
||||
self.outerBox.setSpacing(CONFIG.pxInt(8))
|
||||
self.outerBox.setSpacing(8)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
self.setSizeGripEnabled(True)
|
||||
@@ -210,11 +210,11 @@ class GuiProjectSettings(NDialog):
|
||||
|
||||
def _saveSettings(self) -> None:
|
||||
"""Save GUI settings."""
|
||||
winWidth = CONFIG.rpxInt(self.width())
|
||||
winHeight = CONFIG.rpxInt(self.height())
|
||||
statusColW = CONFIG.rpxInt(self.statusPage.columnWidth())
|
||||
importColW = CONFIG.rpxInt(self.importPage.columnWidth())
|
||||
replaceColW = CONFIG.rpxInt(self.replacePage.columnWidth())
|
||||
winWidth = self.width()
|
||||
winHeight = self.height()
|
||||
statusColW = self.statusPage.columnWidth()
|
||||
importColW = self.importPage.columnWidth()
|
||||
replaceColW = self.replacePage.columnWidth()
|
||||
|
||||
logger.debug("Saving State: GuiProjectSettings")
|
||||
options = SHARED.project.options
|
||||
@@ -232,7 +232,6 @@ class _SettingsPage(NScrollableForm):
|
||||
def __init__(self, parent: QWidget) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
xW = CONFIG.pxInt(200)
|
||||
data = SHARED.project.data
|
||||
self.setHelpTextStyle(SHARED.theme.helpText)
|
||||
self.setRowIndent(0)
|
||||
@@ -240,7 +239,7 @@ class _SettingsPage(NScrollableForm):
|
||||
# Project Name
|
||||
self.projName = QLineEdit(self)
|
||||
self.projName.setMaxLength(200)
|
||||
self.projName.setMinimumWidth(xW)
|
||||
self.projName.setMinimumWidth(200)
|
||||
self.projName.setText(data.name)
|
||||
self.addRow(
|
||||
self.tr("Project name"), self.projName,
|
||||
@@ -251,7 +250,7 @@ class _SettingsPage(NScrollableForm):
|
||||
# Project Author
|
||||
self.projAuthor = QLineEdit(self)
|
||||
self.projAuthor.setMaxLength(200)
|
||||
self.projAuthor.setMinimumWidth(xW)
|
||||
self.projAuthor.setMinimumWidth(200)
|
||||
self.projAuthor.setText(data.author)
|
||||
self.addRow(
|
||||
self.tr("Author(s)"), self.projAuthor,
|
||||
@@ -262,7 +261,7 @@ class _SettingsPage(NScrollableForm):
|
||||
# Project Language
|
||||
projLang = data.language or CONFIG.guiLocale
|
||||
self.projLang = NComboBox(self)
|
||||
self.projLang.setMinimumWidth(xW)
|
||||
self.projLang.setMinimumWidth(200)
|
||||
for tag, language in CONFIG.listLanguages(CONFIG.LANG_PROJ):
|
||||
self.projLang.addItem(language, tag)
|
||||
self.projLang.setCurrentData(projLang, projLang)
|
||||
@@ -274,7 +273,7 @@ class _SettingsPage(NScrollableForm):
|
||||
|
||||
# Spell Check Language
|
||||
self.spellLang = NComboBox(self)
|
||||
self.spellLang.setMinimumWidth(xW)
|
||||
self.spellLang.setMinimumWidth(200)
|
||||
self.spellLang.addItem(self.tr("Default"), "None")
|
||||
if CONFIG.hasEnchant:
|
||||
for tag, language in SHARED.spelling.listDictionaries():
|
||||
@@ -323,9 +322,7 @@ class _StatusPage(NFixedPage):
|
||||
pageLabel = self.tr("Project Note Importance Levels")
|
||||
colSetting = "importColW"
|
||||
|
||||
wCol0 = CONFIG.pxInt(
|
||||
SHARED.project.options.getInt("GuiProjectSettings", colSetting, 130)
|
||||
)
|
||||
wCol0 = SHARED.project.options.getInt("GuiProjectSettings", colSetting, 130)
|
||||
|
||||
self._changed = False
|
||||
self._color = QColor(100, 100, 100)
|
||||
@@ -334,7 +331,6 @@ class _StatusPage(NFixedPage):
|
||||
|
||||
self._iPx = SHARED.theme.baseIconHeight
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
bPd = CONFIG.pxInt(4)
|
||||
|
||||
iColor = self.palette().text().color()
|
||||
|
||||
@@ -395,7 +391,7 @@ class _StatusPage(NFixedPage):
|
||||
self.labelText.textEdited.connect(self._onNameEdit)
|
||||
|
||||
buttonStyle = (
|
||||
f"QToolButton {{padding: 0 {bPd}px;}} "
|
||||
f"QToolButton {{padding: 0 {4}px;}} "
|
||||
"QToolButton::menu-indicator {image: none;}"
|
||||
)
|
||||
|
||||
@@ -406,12 +402,14 @@ class _StatusPage(NFixedPage):
|
||||
self.colorButton.setEnabled(False)
|
||||
self.colorButton.clicked.connect(self._onColourSelect)
|
||||
|
||||
def buildMenu(menu: QMenu, items: dict[nwStatusShape, str]) -> None:
|
||||
for shape, label in items.items():
|
||||
icon = NWStatus.createIcon(self._iPx, iColor, shape)
|
||||
action = menu.addAction(icon, trConst(label))
|
||||
action.triggered.connect(qtLambda(self._selectShape, shape))
|
||||
self._icons[shape] = icon
|
||||
def buildMenu(menu: QMenu | None, items: dict[nwStatusShape, str]) -> None:
|
||||
if menu is not None:
|
||||
for shape, label in items.items():
|
||||
icon = NWStatus.createIcon(self._iPx, iColor, shape)
|
||||
action = QAction(icon, trConst(label))
|
||||
action.triggered.connect(qtLambda(self._selectShape, shape))
|
||||
menu.addAction(action)
|
||||
self._icons[shape] = icon
|
||||
|
||||
self.shapeMenu = QMenu(self)
|
||||
buildMenu(self.shapeMenu, nwLabels.SHAPES_PLAIN)
|
||||
@@ -676,10 +674,7 @@ class _ReplacePage(NFixedPage):
|
||||
self._changed = False
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
|
||||
wCol0 = CONFIG.pxInt(
|
||||
SHARED.project.options.getInt("GuiProjectSettings", "replaceColW", 130)
|
||||
)
|
||||
wCol0 = SHARED.project.options.getInt("GuiProjectSettings", "replaceColW", 130)
|
||||
|
||||
# Title
|
||||
self.pageTitle = NColourLabel(
|
||||
|
||||
@@ -32,7 +32,6 @@ from PyQt6.QtWidgets import (
|
||||
QListWidgetItem, QVBoxLayout, QWidget
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.constants import nwQuotes, trConst
|
||||
from novelwriter.extensions.modified import NDialog
|
||||
from novelwriter.types import (
|
||||
@@ -62,18 +61,14 @@ class GuiQuoteSelect(NDialog):
|
||||
|
||||
self._selected = current
|
||||
|
||||
qMetrics = QFontMetrics(self.font())
|
||||
pxW = 7*qMetrics.boundingRectChar("M").width()
|
||||
pxH = 7*qMetrics.boundingRectChar("M").height()
|
||||
pxH = 7*qMetrics.boundingRectChar("M").height()
|
||||
|
||||
lblFont = self.font()
|
||||
lblFont.setPointSizeF(4*lblFont.pointSizeF())
|
||||
metrics = QFontMetrics(self.font())
|
||||
|
||||
# Preview Label
|
||||
self.previewLabel = QLabel(current, self)
|
||||
self.previewLabel.setFont(lblFont)
|
||||
self.previewLabel.setFixedSize(QSize(pxW, pxH))
|
||||
self.previewLabel.setFixedSize(QSize(4*metrics.maxWidth(), 5*metrics.height()))
|
||||
self.previewLabel.setAlignment(QtAlignCenter)
|
||||
self.previewLabel.setFrameStyle(QFrame.Shape.Box | QFrame.Shadow.Plain)
|
||||
|
||||
@@ -84,15 +79,15 @@ class GuiQuoteSelect(NDialog):
|
||||
minSize = 100
|
||||
for sKey, sLabel in nwQuotes.SYMBOLS.items():
|
||||
text = "[ %s ] %s" % (sKey, trConst(sLabel))
|
||||
minSize = max(minSize, qMetrics.boundingRect(text).width())
|
||||
minSize = max(minSize, metrics.boundingRect(text).width())
|
||||
qtItem = QListWidgetItem(text)
|
||||
qtItem.setData(self.D_KEY, sKey)
|
||||
self.listBox.addItem(qtItem)
|
||||
if sKey == current:
|
||||
self.listBox.setCurrentItem(qtItem)
|
||||
|
||||
self.listBox.setMinimumWidth(minSize + CONFIG.pxInt(40))
|
||||
self.listBox.setMinimumHeight(CONFIG.pxInt(150))
|
||||
self.listBox.setMinimumWidth(minSize + 40)
|
||||
self.listBox.setMinimumHeight(150)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
|
||||
|
||||
@@ -56,15 +56,12 @@ class GuiWordList(NDialog):
|
||||
self.setWindowTitle(self.tr("Project Word List"))
|
||||
|
||||
iSz = SHARED.theme.baseIconSize
|
||||
mS = CONFIG.pxInt(250)
|
||||
wW = CONFIG.pxInt(320)
|
||||
wH = CONFIG.pxInt(340)
|
||||
|
||||
self.setMinimumWidth(mS)
|
||||
self.setMinimumHeight(mS)
|
||||
self.setMinimumWidth(250)
|
||||
self.setMinimumHeight(250)
|
||||
self.resize(
|
||||
CONFIG.pxInt(SHARED.project.options.getInt("GuiWordList", "winWidth", wW)),
|
||||
CONFIG.pxInt(SHARED.project.options.getInt("GuiWordList", "winHeight", wH))
|
||||
SHARED.project.options.getInt("GuiWordList", "winWidth", 320),
|
||||
SHARED.project.options.getInt("GuiWordList", "winHeight", 340),
|
||||
)
|
||||
|
||||
# Header
|
||||
@@ -118,9 +115,9 @@ class GuiWordList(NDialog):
|
||||
self.outerBox.addLayout(self.headerBox, 0)
|
||||
self.outerBox.addWidget(self.listBox, 1)
|
||||
self.outerBox.addLayout(self.editBox, 0)
|
||||
self.outerBox.addSpacing(CONFIG.pxInt(12))
|
||||
self.outerBox.addSpacing(12)
|
||||
self.outerBox.addWidget(self.buttonBox, 0)
|
||||
self.outerBox.setSpacing(CONFIG.pxInt(4))
|
||||
self.outerBox.setSpacing(4)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
@@ -230,14 +227,10 @@ class GuiWordList(NDialog):
|
||||
|
||||
def _saveGuiSettings(self) -> None:
|
||||
"""Save GUI settings."""
|
||||
winWidth = CONFIG.rpxInt(self.width())
|
||||
winHeight = CONFIG.rpxInt(self.height())
|
||||
|
||||
logger.debug("Saving State: GuiWordList")
|
||||
pOptions = SHARED.project.options
|
||||
pOptions.setValue("GuiWordList", "winWidth", winWidth)
|
||||
pOptions.setValue("GuiWordList", "winHeight", winHeight)
|
||||
|
||||
pOptions.setValue("GuiWordList", "winWidth", self.width())
|
||||
pOptions.setValue("GuiWordList", "winHeight", self.height())
|
||||
return
|
||||
|
||||
def _addWord(self, word: str) -> None:
|
||||
|
||||
@@ -65,11 +65,11 @@ class NWErrorMessage(QDialog):
|
||||
|
||||
# Widgets
|
||||
self.msgIcon = QLabel()
|
||||
self.msgIcon.setPixmap(
|
||||
QApplication.style().standardIcon(
|
||||
QStyle.StandardPixmap.SP_MessageBoxCritical
|
||||
).pixmap(64, 64)
|
||||
)
|
||||
if style := QApplication.style():
|
||||
self.msgIcon.setPixmap(
|
||||
style.standardIcon(QStyle.StandardPixmap.SP_MessageBoxCritical).pixmap(64, 64)
|
||||
)
|
||||
|
||||
self.msgHead = QLabel()
|
||||
self.msgHead.setOpenExternalLinks(True)
|
||||
self.msgHead.setWordWrap(True)
|
||||
|
||||
@@ -114,10 +114,6 @@ class GuiMain(QMainWindow):
|
||||
# Build the GUI
|
||||
# =============
|
||||
|
||||
# Sizes
|
||||
mPx = CONFIG.pxInt(4)
|
||||
hWd = CONFIG.pxInt(4)
|
||||
|
||||
# Main GUI Elements
|
||||
self.mainStatus = GuiMainStatus(self)
|
||||
self.projView = GuiProjectView(self)
|
||||
@@ -142,7 +138,7 @@ class GuiMain(QMainWindow):
|
||||
self.treePane = QWidget(self)
|
||||
self.treeBox = QVBoxLayout()
|
||||
self.treeBox.setContentsMargins(0, 0, 0, 0)
|
||||
self.treeBox.setSpacing(mPx)
|
||||
self.treeBox.setSpacing(4)
|
||||
self.treeBox.addWidget(self.projStack)
|
||||
self.treeBox.addWidget(self.itemDetails)
|
||||
self.treePane.setLayout(self.treeBox)
|
||||
@@ -151,7 +147,7 @@ class GuiMain(QMainWindow):
|
||||
self.splitView = QSplitter(Qt.Orientation.Vertical, self)
|
||||
self.splitView.addWidget(self.docViewer)
|
||||
self.splitView.addWidget(self.docViewerPanel)
|
||||
self.splitView.setHandleWidth(hWd)
|
||||
self.splitView.setHandleWidth(4)
|
||||
self.splitView.setOpaqueResize(False)
|
||||
self.splitView.setSizes(CONFIG.viewPanePos)
|
||||
self.splitView.setCollapsible(0, False)
|
||||
@@ -162,7 +158,7 @@ class GuiMain(QMainWindow):
|
||||
self.splitDocs.addWidget(self.docEditor)
|
||||
self.splitDocs.addWidget(self.splitView)
|
||||
self.splitDocs.setOpaqueResize(False)
|
||||
self.splitDocs.setHandleWidth(hWd)
|
||||
self.splitDocs.setHandleWidth(4)
|
||||
self.splitDocs.setCollapsible(0, False)
|
||||
self.splitDocs.setCollapsible(1, False)
|
||||
|
||||
@@ -172,7 +168,7 @@ class GuiMain(QMainWindow):
|
||||
self.splitMain.addWidget(self.treePane)
|
||||
self.splitMain.addWidget(self.splitDocs)
|
||||
self.splitMain.setOpaqueResize(False)
|
||||
self.splitMain.setHandleWidth(hWd)
|
||||
self.splitMain.setHandleWidth(4)
|
||||
self.splitMain.setSizes(CONFIG.mainPanePos)
|
||||
self.splitMain.setCollapsible(0, False)
|
||||
self.splitMain.setCollapsible(0, False)
|
||||
|
||||
Reference in New Issue
Block a user