Clean up flags in all GUI classes

This commit is contained in:
Veronica Berglyd Olsen
2024-04-03 21:09:49 +02:00
parent 20c5993e2d
commit 8fff376076
32 changed files with 236 additions and 229 deletions
+6 -6
View File
@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import (
)
from novelwriter import CONFIG, SHARED
from novelwriter.common import readTextFile
from novelwriter.common import cssCol, readTextFile
from novelwriter.extensions.configlayout import NColourLabel
from novelwriter.extensions.versioninfo import VersionInfoWidget
from novelwriter.types import QtAlignRightTop, QtDialogClose
@@ -70,7 +70,7 @@ class GuiAbout(QDialog):
self.nwLicence = QLabel(self.tr("This application is licenced under {0}").format(
"<a href='https://www.gnu.org/licenses/gpl-3.0.html'>GPL v3.0</a>"
))
), self)
self.nwLicence.setOpenExternalLinks(True)
# Credits
@@ -147,10 +147,10 @@ class GuiAbout(QDialog):
def _setStyleSheet(self) -> None:
"""Set stylesheet for all browser tabs."""
baseCol = self.palette().window().color()
self.txtCredits.setStyleSheet((
"QTextBrowser {{border: none; background: rgb({r},{g},{b});}} "
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue()))
baseCol = cssCol(self.palette().window().color())
self.txtCredits.setStyleSheet(
f"QTextBrowser {{border: none; background: {baseCol};}} "
)
return
# END Class GuiAbout
+7 -6
View File
@@ -54,7 +54,8 @@ class GuiDocMerge(QDialog):
self._data = {}
self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Documents to Merge")))
self.headLabel = QLabel(self.tr("Documents to Merge"), self)
self.headLabel.setFont(SHARED.theme.guiFontB)
self.helpLabel = NColourLabel(
self.tr("Drag and drop items to change the order, or uncheck to exclude."),
SHARED.theme.helpText, parent=self, wrap=True
@@ -70,12 +71,12 @@ class GuiDocMerge(QDialog):
self.listBox.setIconSize(iSz)
self.listBox.setMinimumWidth(CONFIG.pxInt(400))
self.listBox.setMinimumHeight(CONFIG.pxInt(180))
self.listBox.setSelectionBehavior(QAbstractItemView.SelectRows)
self.listBox.setSelectionMode(QAbstractItemView.SingleSelection)
self.listBox.setDragDropMode(QAbstractItemView.InternalMove)
self.listBox.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.listBox.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
# Merge Options
self.trashLabel = QLabel(self.tr("Move merged items to Trash"))
self.trashLabel = QLabel(self.tr("Move merged items to Trash"), self)
self.trashSwitch = NSwitch(self, height=iPx)
self.optBox = QGridLayout()
@@ -85,7 +86,7 @@ class GuiDocMerge(QDialog):
self.optBox.setColumnStretch(2, 1)
# Buttons
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel)
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
+8 -7
View File
@@ -58,7 +58,8 @@ class GuiDocSplit(QDialog):
self.setWindowTitle(self.tr("Split Document"))
self.headLabel = QLabel("<b>{0}</b>".format(self.tr("Document Headings")))
self.headLabel = QLabel(self.tr("Document Headings"), self)
self.headLabel.setFont(SHARED.theme.guiFontB)
self.helpLabel = NColourLabel(
self.tr("Select the maximum level to split into files."),
SHARED.theme.helpText, parent=self, wrap=True
@@ -76,8 +77,8 @@ class GuiDocSplit(QDialog):
docHierarchy = pOptions.getBool("GuiDocSplit", "docHierarchy", True)
# Heading Selection
self.listBox = QListWidget()
self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop)
self.listBox = QListWidget(self)
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.NoDragDrop)
self.listBox.setMinimumWidth(CONFIG.pxInt(400))
self.listBox.setMinimumHeight(CONFIG.pxInt(180))
@@ -92,15 +93,15 @@ class GuiDocSplit(QDialog):
self.splitLevel.currentIndexChanged.connect(self._reloadList)
# Split Options
self.folderLabel = QLabel(self.tr("Split into a new folder"))
self.folderLabel = QLabel(self.tr("Split into a new folder"), self)
self.folderSwitch = NSwitch(self, height=iPx)
self.folderSwitch.setChecked(intoFolder)
self.hierarchyLabel = QLabel(self.tr("Create document hierarchy"))
self.hierarchyLabel = QLabel(self.tr("Create document hierarchy"), self)
self.hierarchySwitch = NSwitch(self, height=iPx)
self.hierarchySwitch.setChecked(docHierarchy)
self.trashLabel = QLabel(self.tr("Move split document to Trash"))
self.trashLabel = QLabel(self.tr("Move split document to Trash"), self)
self.trashSwitch = NSwitch(self, height=iPx)
self.optBox = QGridLayout()
@@ -115,7 +116,7 @@ class GuiDocSplit(QDialog):
self.optBox.setColumnStretch(3, 1)
# Buttons
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel)
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
+2 -2
View File
@@ -56,13 +56,13 @@ class GuiEditLabel(QDialog):
self.labelValue.selectAll()
# Buttons
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel)
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
# Assemble
self.innerBox = QHBoxLayout()
self.innerBox.addWidget(QLabel(self.tr("Label")), 0)
self.innerBox.addWidget(QLabel(self.tr("Label"), self), 0)
self.innerBox.addWidget(self.labelValue, 1)
self.innerBox.setSpacing(mSp)
+2 -2
View File
@@ -87,7 +87,7 @@ class GuiPreferences(QDialog):
self.mainForm.setHelpTextStyle(SHARED.theme.helpText)
# Buttons
self.buttonBox = QDialogButtonBox(QtDialogApply | QtDialogSave | QtDialogClose)
self.buttonBox = QDialogButtonBox(QtDialogApply | QtDialogSave | QtDialogClose, self)
self.buttonBox.clicked.connect(self._dialogButtonClicked)
# Assemble
@@ -811,7 +811,7 @@ class GuiPreferences(QDialog):
"""Open a dialog to select the backup folder."""
if path := QFileDialog.getExistingDirectory(
self, self.tr("Backup Directory"), str(self.backupPath) or "",
options=QFileDialog.ShowDirsOnly
options=QFileDialog.Option.ShowDirsOnly
):
self.backupPath = path
self.mainForm.setHelpText("backupPath", self.tr("Path: {0}").format(path))
+2 -2
View File
@@ -84,7 +84,7 @@ class GuiProjectSettings(QDialog):
self.sidebar.buttonClicked.connect(self._sidebarClicked)
# Buttons
self.buttonBox = QDialogButtonBox(QtDialogSave | QtDialogCancel)
self.buttonBox = QDialogButtonBox(QtDialogSave | QtDialogCancel, self)
self.buttonBox.accepted.connect(self._doSave)
self.buttonBox.rejected.connect(self.close)
@@ -603,7 +603,7 @@ class _ReplacePage(NFixedPage):
)
# List Box
self.listBox = QTreeWidget()
self.listBox = QTreeWidget(self)
self.listBox.setHeaderLabels([self.tr("Keyword"), self.tr("Replace With")])
self.listBox.setColumnWidth(self.COL_KEY, wCol0)
self.listBox.setIndentation(0)
+4 -4
View File
@@ -66,14 +66,14 @@ class GuiQuoteSelect(QDialog):
lblFont.setPointSizeF(4*lblFont.pointSizeF())
# Preview Label
self.previewLabel = QLabel(current)
self.previewLabel = QLabel(current, self)
self.previewLabel.setFont(lblFont)
self.previewLabel.setFixedSize(QSize(pxW, pxH))
self.previewLabel.setAlignment(QtAlignCenter)
self.previewLabel.setFrameStyle(QFrame.Box | QFrame.Plain)
self.previewLabel.setFrameStyle(QFrame.Shape.Box | QFrame.Shadow.Plain)
# Quote Symbols
self.listBox = QListWidget()
self.listBox = QListWidget(self)
self.listBox.itemSelectionChanged.connect(self._selectedSymbol)
minSize = 100
@@ -90,7 +90,7 @@ class GuiQuoteSelect(QDialog):
self.listBox.setMinimumHeight(CONFIG.pxInt(150))
# Buttons
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel)
self.buttonBox = QDialogButtonBox(QtDialogOk | QtDialogCancel, self)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
+2 -2
View File
@@ -92,7 +92,7 @@ class GuiWordList(QDialog):
# List Box
self.listBox = QListWidget(self)
self.listBox.setDragDropMode(QAbstractItemView.NoDragDrop)
self.listBox.setDragDropMode(QAbstractItemView.DragDropMode.NoDragDrop)
self.listBox.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
self.listBox.setSortingEnabled(True)
@@ -111,7 +111,7 @@ class GuiWordList(QDialog):
self.editBox.addWidget(self.delButton, 0)
# Buttons
self.buttonBox = QDialogButtonBox(QtDialogSave | QtDialogClose)
self.buttonBox = QDialogButtonBox(QtDialogSave | QtDialogClose, self)
self.buttonBox.accepted.connect(self._doSave)
self.buttonBox.rejected.connect(self.close)