Update build settings layout (#1674)

This commit is contained in:
Veronica Berglyd Olsen
2024-01-27 18:16:33 +01:00
committed by GitHub
6 changed files with 231 additions and 464 deletions
+75 -126
View File
@@ -134,6 +134,9 @@ class GuiPreferences(QDialog):
minWidth = CONFIG.pxInt(200) minWidth = CONFIG.pxInt(200)
mIcon = SHARED.theme.getIcon("more") mIcon = SHARED.theme.getIcon("more")
# Label
self.sidebar.addLabel(self.tr("General"))
# Appearance # Appearance
# ========== # ==========
@@ -151,9 +154,8 @@ class GuiPreferences(QDialog):
self.guiLocale.setCurrentIndex(idx) self.guiLocale.setCurrentIndex(idx)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Display language"), self.tr("Display language"), self.guiLocale,
self.guiLocale, self.tr("Requires restart to take effect."), stretch=(3, 2)
self.tr("Requires restart to take effect.")
) )
# Colour Theme # Colour Theme
@@ -165,23 +167,21 @@ class GuiPreferences(QDialog):
self.guiTheme.setCurrentIndex(idx) self.guiTheme.setCurrentIndex(idx)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Colour theme"), self.tr("Colour theme"), self.guiTheme,
self.guiTheme, self.tr("General colour theme and icons."), stretch=(3, 2)
self.tr("General colour theme and icons.")
) )
# Application Font Family # Application Font Family
self.guiFont = QLineEdit(self) self.guiFont = QLineEdit(self)
self.guiFont.setReadOnly(True) self.guiFont.setReadOnly(True)
self.guiFont.setFixedWidth(CONFIG.pxInt(162)) self.guiFont.setMinimumWidth(CONFIG.pxInt(162))
self.guiFont.setText(CONFIG.guiFont) self.guiFont.setText(CONFIG.guiFont)
self.guiFontButton = QToolButton(self) self.guiFontButton = QToolButton(self)
self.guiFontButton.setIcon(mIcon) self.guiFontButton.setIcon(mIcon)
self.guiFontButton.clicked.connect(self._selectGuiFont) self.guiFontButton.clicked.connect(self._selectGuiFont)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Application font family"), self.tr("Application font family"), self.guiFont,
self.guiFont, self.tr("Requires restart to take effect."), stretch=(3, 2),
self.tr("Requires restart to take effect."),
button=self.guiFontButton button=self.guiFontButton
) )
@@ -192,18 +192,15 @@ class GuiPreferences(QDialog):
self.guiFontSize.setSingleStep(1) self.guiFontSize.setSingleStep(1)
self.guiFontSize.setValue(CONFIG.guiFontSize) self.guiFontSize.setValue(CONFIG.guiFontSize)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Application font size"), self.tr("Application font size"), self.guiFontSize,
self.guiFontSize, self.tr("Requires restart to take effect."), unit=self.tr("pt")
self.tr("Requires restart to take effect."),
unit=self.tr("pt")
) )
# Vertical Scrollbars # Vertical Scrollbars
self.hideVScroll = NSwitch(self) self.hideVScroll = NSwitch(self)
self.hideVScroll.setChecked(CONFIG.hideVScroll) self.hideVScroll.setChecked(CONFIG.hideVScroll)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Hide vertical scroll bars in main windows"), self.tr("Hide vertical scroll bars in main windows"), self.hideVScroll,
self.hideVScroll,
self.tr("Scrolling available with mouse wheel and keys only.") self.tr("Scrolling available with mouse wheel and keys only.")
) )
@@ -211,8 +208,7 @@ class GuiPreferences(QDialog):
self.hideHScroll = NSwitch(self) self.hideHScroll = NSwitch(self)
self.hideHScroll.setChecked(CONFIG.hideHScroll) self.hideHScroll.setChecked(CONFIG.hideHScroll)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Hide horizontal scroll bars in main windows"), self.tr("Hide horizontal scroll bars in main windows"), self.hideHScroll,
self.hideHScroll,
self.tr("Scrolling available with mouse wheel and keys only.") self.tr("Scrolling available with mouse wheel and keys only.")
) )
@@ -233,23 +229,21 @@ class GuiPreferences(QDialog):
self.guiSyntax.setCurrentIndex(idx) self.guiSyntax.setCurrentIndex(idx)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Document colour theme"), self.tr("Document colour theme"), self.guiSyntax,
self.guiSyntax, self.tr("Colour theme for the editor and viewer."), stretch=(3, 2)
self.tr("Colour theme for the editor and viewer.")
) )
# Document Font Family # Document Font Family
self.textFont = QLineEdit(self) self.textFont = QLineEdit(self)
self.textFont.setReadOnly(True) self.textFont.setReadOnly(True)
self.textFont.setFixedWidth(CONFIG.pxInt(162)) self.textFont.setMinimumWidth(CONFIG.pxInt(162))
self.textFont.setText(CONFIG.textFont) self.textFont.setText(CONFIG.textFont)
self.textFontButton = QToolButton(self) self.textFontButton = QToolButton(self)
self.textFontButton.setIcon(mIcon) self.textFontButton.setIcon(mIcon)
self.textFontButton.clicked.connect(self._selectTextFont) self.textFontButton.clicked.connect(self._selectTextFont)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Document font family"), self.tr("Document font family"), self.textFont,
self.textFont, self.tr("Applies to both document editor and viewer."), stretch=(3, 2),
self.tr("Applies to both document editor and viewer."),
button=self.textFontButton button=self.textFontButton
) )
@@ -260,18 +254,15 @@ class GuiPreferences(QDialog):
self.textSize.setSingleStep(1) self.textSize.setSingleStep(1)
self.textSize.setValue(CONFIG.textSize) self.textSize.setValue(CONFIG.textSize)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Document font size"), self.tr("Document font size"), self.textSize,
self.textSize, self.tr("Applies to both document editor and viewer."), unit=self.tr("pt")
self.tr("Applies to both document editor and viewer."),
unit=self.tr("pt")
) )
# Emphasise Labels # Emphasise Labels
self.emphLabels = NSwitch(self) self.emphLabels = NSwitch(self)
self.emphLabels.setChecked(CONFIG.emphLabels) self.emphLabels.setChecked(CONFIG.emphLabels)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Emphasise partition and chapter labels"), self.tr("Emphasise partition and chapter labels"), self.emphLabels,
self.emphLabels,
self.tr("Makes them stand out in the project tree."), self.tr("Makes them stand out in the project tree."),
) )
@@ -279,8 +270,7 @@ class GuiPreferences(QDialog):
self.showFullPath = NSwitch(self) self.showFullPath = NSwitch(self)
self.showFullPath.setChecked(CONFIG.showFullPath) self.showFullPath.setChecked(CONFIG.showFullPath)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Show full path in document header"), self.tr("Show full path in document header"), self.showFullPath,
self.showFullPath,
self.tr("Add the parent folder names to the header.") self.tr("Add the parent folder names to the header.")
) )
@@ -288,8 +278,7 @@ class GuiPreferences(QDialog):
self.incNotesWCount = NSwitch(self) self.incNotesWCount = NSwitch(self)
self.incNotesWCount.setChecked(CONFIG.incNotesWCount) self.incNotesWCount.setChecked(CONFIG.incNotesWCount)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Include project notes in status bar word count"), self.tr("Include project notes in status bar word count"), self.incNotesWCount
self.incNotesWCount
) )
# Auto Save # Auto Save
@@ -307,10 +296,8 @@ class GuiPreferences(QDialog):
self.autoSaveDoc.setSingleStep(1) self.autoSaveDoc.setSingleStep(1)
self.autoSaveDoc.setValue(CONFIG.autoSaveDoc) self.autoSaveDoc.setValue(CONFIG.autoSaveDoc)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Save document interval"), self.tr("Save document interval"), self.autoSaveDoc,
self.autoSaveDoc, self.tr("How often the document is automatically saved."), unit=self.tr("seconds")
self.tr("How often the document is automatically saved."),
unit=self.tr("seconds")
) )
# Project Save Timer # Project Save Timer
@@ -320,10 +307,8 @@ class GuiPreferences(QDialog):
self.autoSaveProj.setSingleStep(1) self.autoSaveProj.setSingleStep(1)
self.autoSaveProj.setValue(CONFIG.autoSaveProj) self.autoSaveProj.setValue(CONFIG.autoSaveProj)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Save project interval"), self.tr("Save project interval"), self.autoSaveProj,
self.autoSaveProj, self.tr("How often the project is automatically saved."), unit=self.tr("seconds")
self.tr("How often the project is automatically saved."),
unit=self.tr("seconds")
) )
# Project Backup # Project Backup
@@ -339,10 +324,8 @@ class GuiPreferences(QDialog):
self.backupGetPath = QPushButton(SHARED.theme.getIcon("browse"), self.tr("Browse"), self) self.backupGetPath = QPushButton(SHARED.theme.getIcon("browse"), self.tr("Browse"), self)
self.backupGetPath.clicked.connect(self._backupFolder) self.backupGetPath.clicked.connect(self._backupFolder)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Backup storage location"), self.tr("Backup storage location"), self.backupGetPath,
self.backupGetPath, self.tr("Path: {0}").format(self.backupPath), editable="backupPath"
self.tr("Path: {0}").format(self.backupPath),
editable="backupPath"
) )
# Run When Closing # Run When Closing
@@ -350,8 +333,7 @@ class GuiPreferences(QDialog):
self.backupOnClose.setChecked(CONFIG.backupOnClose) self.backupOnClose.setChecked(CONFIG.backupOnClose)
self.backupOnClose.toggled.connect(self._toggledBackupOnClose) self.backupOnClose.toggled.connect(self._toggledBackupOnClose)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Run backup when the project is closed"), self.tr("Run backup when the project is closed"), self.backupOnClose,
self.backupOnClose,
self.tr("Can be overridden for individual projects in Project Settings.") self.tr("Can be overridden for individual projects in Project Settings.")
) )
@@ -361,8 +343,7 @@ class GuiPreferences(QDialog):
self.askBeforeBackup.setChecked(CONFIG.askBeforeBackup) self.askBeforeBackup.setChecked(CONFIG.askBeforeBackup)
self.askBeforeBackup.setEnabled(CONFIG.backupOnClose) self.askBeforeBackup.setEnabled(CONFIG.backupOnClose)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Ask before running backup"), self.tr("Ask before running backup"), self.askBeforeBackup,
self.askBeforeBackup,
self.tr("If off, backups will run in the background.") self.tr("If off, backups will run in the background.")
) )
@@ -378,8 +359,7 @@ class GuiPreferences(QDialog):
self.stopWhenIdle = NSwitch(self) self.stopWhenIdle = NSwitch(self)
self.stopWhenIdle.setChecked(CONFIG.stopWhenIdle) self.stopWhenIdle.setChecked(CONFIG.stopWhenIdle)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Pause the session timer when not writing"), self.tr("Pause the session timer when not writing"), self.stopWhenIdle,
self.stopWhenIdle,
self.tr("Also pauses when the application window does not have focus.") self.tr("Also pauses when the application window does not have focus.")
) )
@@ -391,12 +371,14 @@ class GuiPreferences(QDialog):
self.userIdleTime.setDecimals(1) self.userIdleTime.setDecimals(1)
self.userIdleTime.setValue(CONFIG.userIdleTime/60.0) self.userIdleTime.setValue(CONFIG.userIdleTime/60.0)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Editor inactive time before pausing timer"), self.tr("Editor inactive time before pausing timer"), self.userIdleTime,
self.userIdleTime,
self.tr("User activity includes typing and changing the content."), self.tr("User activity includes typing and changing the content."),
unit=self.tr("minutes") unit=self.tr("minutes")
) )
# Label
self.sidebar.addLabel(self.tr("Writing"))
# Text Flow # Text Flow
# ========= # =========
@@ -412,10 +394,8 @@ class GuiPreferences(QDialog):
self.textWidth.setSingleStep(10) self.textWidth.setSingleStep(10)
self.textWidth.setValue(CONFIG.textWidth) self.textWidth.setValue(CONFIG.textWidth)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Maximum text width in \"Normal Mode\""), self.tr("Maximum text width in \"Normal Mode\""), self.textWidth,
self.textWidth, self.tr("Set to 0 to disable this feature."), unit=self.tr("px")
self.tr("Set to 0 to disable this feature."),
unit=self.tr("px")
) )
# Max Text Width in Focus Mode # Max Text Width in Focus Mode
@@ -425,18 +405,15 @@ class GuiPreferences(QDialog):
self.focusWidth.setSingleStep(10) self.focusWidth.setSingleStep(10)
self.focusWidth.setValue(CONFIG.focusWidth) self.focusWidth.setValue(CONFIG.focusWidth)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Maximum text width in \"Focus Mode\""), self.tr("Maximum text width in \"Focus Mode\""), self.focusWidth,
self.focusWidth, self.tr("The maximum width cannot be disabled."), unit=self.tr("px")
self.tr("The maximum width cannot be disabled."),
unit=self.tr("px")
) )
# Focus Mode Footer # Focus Mode Footer
self.hideFocusFooter = NSwitch(self) self.hideFocusFooter = NSwitch(self)
self.hideFocusFooter.setChecked(CONFIG.hideFocusFooter) self.hideFocusFooter.setChecked(CONFIG.hideFocusFooter)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Hide document footer in \"Focus Mode\""), self.tr("Hide document footer in \"Focus Mode\""), self.hideFocusFooter,
self.hideFocusFooter,
self.tr("Hide the information bar in the document editor.") self.tr("Hide the information bar in the document editor.")
) )
@@ -444,8 +421,7 @@ class GuiPreferences(QDialog):
self.doJustify = NSwitch(self) self.doJustify = NSwitch(self)
self.doJustify.setChecked(CONFIG.doJustify) self.doJustify.setChecked(CONFIG.doJustify)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Justify the text margins"), self.tr("Justify the text margins"), self.doJustify,
self.doJustify,
self.tr("Applies to both document editor and viewer."), self.tr("Applies to both document editor and viewer."),
) )
@@ -456,8 +432,7 @@ class GuiPreferences(QDialog):
self.textMargin.setSingleStep(1) self.textMargin.setSingleStep(1)
self.textMargin.setValue(CONFIG.textMargin) self.textMargin.setValue(CONFIG.textMargin)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Minimum text margin"), self.tr("Minimum text margin"), self.textMargin,
self.textMargin,
self.tr("Applies to both document editor and viewer."), self.tr("Applies to both document editor and viewer."),
unit=self.tr("px") unit=self.tr("px")
) )
@@ -469,8 +444,7 @@ class GuiPreferences(QDialog):
self.tabWidth.setSingleStep(1) self.tabWidth.setSingleStep(1)
self.tabWidth.setValue(CONFIG.tabWidth) self.tabWidth.setValue(CONFIG.tabWidth)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Tab width"), self.tr("Tab width"), self.tabWidth,
self.tabWidth,
self.tr("The width of a tab key press in the editor and viewer."), self.tr("The width of a tab key press in the editor and viewer."),
unit=self.tr("px") unit=self.tr("px")
) )
@@ -498,17 +472,15 @@ class GuiPreferences(QDialog):
self.spellLanguage.setCurrentIndex(idx) self.spellLanguage.setCurrentIndex(idx)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Spell check language"), self.tr("Spell check language"), self.spellLanguage,
self.spellLanguage, self.tr("Available languages are determined by your system."), stretch=(3, 2)
self.tr("Available languages are determined by your system.")
) )
# Auto-Select Word Under Cursor # Auto-Select Word Under Cursor
self.autoSelect = NSwitch(self) self.autoSelect = NSwitch(self)
self.autoSelect.setChecked(CONFIG.autoSelect) self.autoSelect.setChecked(CONFIG.autoSelect)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Auto-select word under cursor"), self.tr("Auto-select word under cursor"), self.autoSelect,
self.autoSelect,
self.tr("Apply formatting to word under cursor if no selection is made.") self.tr("Apply formatting to word under cursor if no selection is made.")
) )
@@ -516,16 +488,14 @@ class GuiPreferences(QDialog):
self.showTabsNSpaces = NSwitch(self) self.showTabsNSpaces = NSwitch(self)
self.showTabsNSpaces.setChecked(CONFIG.showTabsNSpaces) self.showTabsNSpaces.setChecked(CONFIG.showTabsNSpaces)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Show tabs and spaces"), self.tr("Show tabs and spaces"), self.showTabsNSpaces
self.showTabsNSpaces
) )
# Show Line Endings # Show Line Endings
self.showLineEndings = NSwitch(self) self.showLineEndings = NSwitch(self)
self.showLineEndings.setChecked(CONFIG.showLineEndings) self.showLineEndings.setChecked(CONFIG.showLineEndings)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Show line endings"), self.tr("Show line endings"), self.showLineEndings
self.showLineEndings
) )
# Editor Scrolling # Editor Scrolling
@@ -540,8 +510,7 @@ class GuiPreferences(QDialog):
self.scrollPastEnd = NSwitch(self) self.scrollPastEnd = NSwitch(self)
self.scrollPastEnd.setChecked(CONFIG.scrollPastEnd) self.scrollPastEnd.setChecked(CONFIG.scrollPastEnd)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Scroll past end of the document"), self.tr("Scroll past end of the document"), self.scrollPastEnd,
self.scrollPastEnd,
self.tr("Also centres the cursor when scrolling.") self.tr("Also centres the cursor when scrolling.")
) )
@@ -549,8 +518,7 @@ class GuiPreferences(QDialog):
self.autoScroll = NSwitch(self) self.autoScroll = NSwitch(self)
self.autoScroll.setChecked(CONFIG.autoScroll) self.autoScroll.setChecked(CONFIG.autoScroll)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Typewriter style scrolling when you type"), self.tr("Typewriter style scrolling when you type"), self.autoScroll,
self.autoScroll,
self.tr("Keeps the cursor at a fixed vertical position.") self.tr("Keeps the cursor at a fixed vertical position.")
) )
@@ -561,10 +529,8 @@ class GuiPreferences(QDialog):
self.autoScrollPos.setSingleStep(1) self.autoScrollPos.setSingleStep(1)
self.autoScrollPos.setValue(int(CONFIG.autoScrollPos)) self.autoScrollPos.setValue(int(CONFIG.autoScrollPos))
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Minimum position for Typewriter scrolling"), self.tr("Minimum position for Typewriter scrolling"), self.autoScrollPos,
self.autoScrollPos, self.tr("Percentage of the editor height from the top."), unit="%"
self.tr("Percentage of the editor height from the top."),
unit="%"
) )
# Text Highlighting # Text Highlighting
@@ -579,40 +545,35 @@ class GuiPreferences(QDialog):
self.highlightQuotes.setChecked(CONFIG.highlightQuotes) self.highlightQuotes.setChecked(CONFIG.highlightQuotes)
self.highlightQuotes.toggled.connect(self._toggleHighlightQuotes) self.highlightQuotes.toggled.connect(self._toggleHighlightQuotes)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Highlight text wrapped in quotes"), self.tr("Highlight text wrapped in quotes"), self.highlightQuotes,
self.highlightQuotes,
self.tr("Applies to the document editor only.") self.tr("Applies to the document editor only.")
) )
self.allowOpenSQuote = NSwitch(self) self.allowOpenSQuote = NSwitch(self)
self.allowOpenSQuote.setChecked(CONFIG.allowOpenSQuote) self.allowOpenSQuote.setChecked(CONFIG.allowOpenSQuote)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Allow open-ended single quotes"), self.tr("Allow open-ended single quotes"), self.allowOpenSQuote,
self.allowOpenSQuote,
self.tr("Highlight single-quoted line with no closing quote.") self.tr("Highlight single-quoted line with no closing quote.")
) )
self.allowOpenDQuote = NSwitch(self) self.allowOpenDQuote = NSwitch(self)
self.allowOpenDQuote.setChecked(CONFIG.allowOpenDQuote) self.allowOpenDQuote.setChecked(CONFIG.allowOpenDQuote)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Allow open-ended double quotes"), self.tr("Allow open-ended double quotes"), self.allowOpenDQuote,
self.allowOpenDQuote,
self.tr("Highlight double-quoted line with no closing quote.") self.tr("Highlight double-quoted line with no closing quote.")
) )
self.highlightEmph = NSwitch(self) self.highlightEmph = NSwitch(self)
self.highlightEmph.setChecked(CONFIG.highlightEmph) self.highlightEmph.setChecked(CONFIG.highlightEmph)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Add highlight colour to emphasised text"), self.tr("Add highlight colour to emphasised text"), self.highlightEmph,
self.highlightEmph,
self.tr("Applies to the document editor only.") self.tr("Applies to the document editor only.")
) )
self.showMultiSpaces = NSwitch(self) self.showMultiSpaces = NSwitch(self)
self.showMultiSpaces.setChecked(CONFIG.showMultiSpaces) self.showMultiSpaces.setChecked(CONFIG.showMultiSpaces)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Highlight multiple or trailing spaces"), self.tr("Highlight multiple or trailing spaces"), self.showMultiSpaces,
self.showMultiSpaces,
self.tr("Applies to the document editor only.") self.tr("Applies to the document editor only.")
) )
@@ -631,8 +592,7 @@ class GuiPreferences(QDialog):
self.doReplace.setChecked(CONFIG.doReplace) self.doReplace.setChecked(CONFIG.doReplace)
self.doReplace.toggled.connect(self._toggleAutoReplaceMain) self.doReplace.toggled.connect(self._toggleAutoReplaceMain)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Auto-replace text as you type"), self.tr("Auto-replace text as you type"), self.doReplace,
self.doReplace,
self.tr("Allow the editor to replace symbols as you type.") self.tr("Allow the editor to replace symbols as you type.")
) )
@@ -641,8 +601,7 @@ class GuiPreferences(QDialog):
self.doReplaceSQuote.setChecked(CONFIG.doReplaceSQuote) self.doReplaceSQuote.setChecked(CONFIG.doReplaceSQuote)
self.doReplaceSQuote.setEnabled(CONFIG.doReplace) self.doReplaceSQuote.setEnabled(CONFIG.doReplace)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Auto-replace single quotes"), self.tr("Auto-replace single quotes"), self.doReplaceSQuote,
self.doReplaceSQuote,
self.tr("Try to guess which is an opening or a closing quote.") self.tr("Try to guess which is an opening or a closing quote.")
) )
@@ -651,8 +610,7 @@ class GuiPreferences(QDialog):
self.doReplaceDQuote.setChecked(CONFIG.doReplaceDQuote) self.doReplaceDQuote.setChecked(CONFIG.doReplaceDQuote)
self.doReplaceDQuote.setEnabled(CONFIG.doReplace) self.doReplaceDQuote.setEnabled(CONFIG.doReplace)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Auto-replace double quotes"), self.tr("Auto-replace double quotes"), self.doReplaceDQuote,
self.doReplaceDQuote,
self.tr("Try to guess which is an opening or a closing quote.") self.tr("Try to guess which is an opening or a closing quote.")
) )
@@ -661,8 +619,7 @@ class GuiPreferences(QDialog):
self.doReplaceDash.setChecked(CONFIG.doReplaceDash) self.doReplaceDash.setChecked(CONFIG.doReplaceDash)
self.doReplaceDash.setEnabled(CONFIG.doReplace) self.doReplaceDash.setEnabled(CONFIG.doReplace)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Auto-replace dashes"), self.tr("Auto-replace dashes"), self.doReplaceDash,
self.doReplaceDash,
self.tr("Double and triple hyphens become short and long dashes.") self.tr("Double and triple hyphens become short and long dashes.")
) )
@@ -671,31 +628,28 @@ class GuiPreferences(QDialog):
self.doReplaceDots.setChecked(CONFIG.doReplaceDots) self.doReplaceDots.setChecked(CONFIG.doReplaceDots)
self.doReplaceDots.setEnabled(CONFIG.doReplace) self.doReplaceDots.setEnabled(CONFIG.doReplace)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Auto-replace dots"), self.tr("Auto-replace dots"), self.doReplaceDots,
self.doReplaceDots,
self.tr("Three consecutive dots become ellipsis.") self.tr("Three consecutive dots become ellipsis.")
) )
# Pad Before # Pad Before
self.fmtPadBefore = QLineEdit(self) self.fmtPadBefore = QLineEdit(self)
self.fmtPadBefore.setMaxLength(32) self.fmtPadBefore.setMaxLength(32)
self.fmtPadBefore.setMaximumWidth(boxWidth) self.fmtPadBefore.setMinimumWidth(boxWidth)
self.fmtPadBefore.setText(CONFIG.fmtPadBefore) self.fmtPadBefore.setText(CONFIG.fmtPadBefore)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Insert non-breaking space before"), self.tr("Insert non-breaking space before"), self.fmtPadBefore,
self.fmtPadBefore, self.tr("Automatically add space before any of these symbols."), stretch=(2, 1)
self.tr("Automatically add space before any of these symbols."),
) )
# Pad After # Pad After
self.fmtPadAfter = QLineEdit(self) self.fmtPadAfter = QLineEdit(self)
self.fmtPadAfter.setMaxLength(32) self.fmtPadAfter.setMaxLength(32)
self.fmtPadAfter.setMaximumWidth(boxWidth) self.fmtPadAfter.setMinimumWidth(boxWidth)
self.fmtPadAfter.setText(CONFIG.fmtPadAfter) self.fmtPadAfter.setText(CONFIG.fmtPadAfter)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Insert non-breaking space after"), self.tr("Insert non-breaking space after"), self.fmtPadAfter,
self.fmtPadAfter, self.tr("Automatically add space after any of these symbols."), stretch=(2, 1)
self.tr("Automatically add space after any of these symbols."),
) )
# Use Thin Space # Use Thin Space
@@ -703,8 +657,7 @@ class GuiPreferences(QDialog):
self.fmtPadThin.setChecked(CONFIG.fmtPadThin) self.fmtPadThin.setChecked(CONFIG.fmtPadThin)
self.fmtPadThin.setEnabled(CONFIG.doReplace) self.fmtPadThin.setEnabled(CONFIG.doReplace)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Use thin space instead"), self.tr("Use thin space instead"), self.fmtPadThin,
self.fmtPadThin,
self.tr("Inserts a thin space instead of a regular space.") self.tr("Inserts a thin space instead of a regular space.")
) )
@@ -730,8 +683,7 @@ class GuiPreferences(QDialog):
self.btnSingleStyleO.setIcon(mIcon) self.btnSingleStyleO.setIcon(mIcon)
self.btnSingleStyleO.clicked.connect(lambda: self._getQuote("SO")) self.btnSingleStyleO.clicked.connect(lambda: self._getQuote("SO"))
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Single quote open style"), self.tr("Single quote open style"), self.quoteSym["SO"],
self.quoteSym["SO"],
self.tr("The symbol to use for a leading single quote."), self.tr("The symbol to use for a leading single quote."),
button=self.btnSingleStyleO button=self.btnSingleStyleO
) )
@@ -746,8 +698,7 @@ class GuiPreferences(QDialog):
self.btnSingleStyleC.setIcon(mIcon) self.btnSingleStyleC.setIcon(mIcon)
self.btnSingleStyleC.clicked.connect(lambda: self._getQuote("SC")) self.btnSingleStyleC.clicked.connect(lambda: self._getQuote("SC"))
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Single quote close style"), self.tr("Single quote close style"), self.quoteSym["SC"],
self.quoteSym["SC"],
self.tr("The symbol to use for a trailing single quote."), self.tr("The symbol to use for a trailing single quote."),
button=self.btnSingleStyleC button=self.btnSingleStyleC
) )
@@ -763,8 +714,7 @@ class GuiPreferences(QDialog):
self.btnDoubleStyleO.setIcon(mIcon) self.btnDoubleStyleO.setIcon(mIcon)
self.btnDoubleStyleO.clicked.connect(lambda: self._getQuote("DO")) self.btnDoubleStyleO.clicked.connect(lambda: self._getQuote("DO"))
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Double quote open style"), self.tr("Double quote open style"), self.quoteSym["DO"],
self.quoteSym["DO"],
self.tr("The symbol to use for a leading double quote."), self.tr("The symbol to use for a leading double quote."),
button=self.btnDoubleStyleO button=self.btnDoubleStyleO
) )
@@ -779,8 +729,7 @@ class GuiPreferences(QDialog):
self.btnDoubleStyleC.setIcon(mIcon) self.btnDoubleStyleC.setIcon(mIcon)
self.btnDoubleStyleC.clicked.connect(lambda: self._getQuote("DC")) self.btnDoubleStyleC.clicked.connect(lambda: self._getQuote("DC"))
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Double quote close style"), self.tr("Double quote close style"), self.quoteSym["DC"],
self.quoteSym["DC"],
self.tr("The symbol to use for a trailing double quote."), self.tr("The symbol to use for a trailing double quote."),
button=self.btnDoubleStyleC button=self.btnDoubleStyleC
) )
+26 -137
View File
@@ -3,8 +3,7 @@ novelWriter Custom Widget: Config Layout
========================================== ==========================================
File History: File History:
Created: 2020-05-03 [0.4.5] NConfigLayout, NColourLabel Created: 2020-05-03 [0.4.5] NColourLabel
Created: 2023-05-23 [2.1b1] NSimpleLayout
Created: 2024-01-08 [2.3b1] NScrollableForm Created: 2024-01-08 [2.3b1] NScrollableForm
Created: 2024-01-26 [2.3b1] NScrollablePage Created: 2024-01-26 [2.3b1] NScrollablePage
Created: 2024-01-26 [2.3b1] NFixedPage Created: 2024-01-26 [2.3b1] NFixedPage
@@ -30,8 +29,8 @@ from __future__ import annotations
from PyQt5.QtGui import QColor, QPalette from PyQt5.QtGui import QColor, QPalette
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QAbstractButton, QFrame, QGridLayout, QHBoxLayout, QLabel, QLayout, QAbstractButton, QFrame, QHBoxLayout, QLabel, QLayout, QScrollArea,
QScrollArea, QSizePolicy, QVBoxLayout, QWidget QVBoxLayout, QWidget
) )
from novelwriter import CONFIG from novelwriter import CONFIG
@@ -52,7 +51,18 @@ class NFixedPage(QFrame):
super().__init__(parent=parent) super().__init__(parent=parent)
self.setFrameShadow(QFrame.Shadow.Sunken) self.setFrameShadow(QFrame.Shadow.Sunken)
self.setFrameShape(QFrame.Shape.StyledPanel) self.setFrameShape(QFrame.Shape.StyledPanel)
self.setCentralLayout = self.setLayout return
def setCentralLayout(self, layout: QLayout) -> None:
"""Set a layout as the central object."""
self.setLayout(layout)
return
def setCentralWidget(self, widget: QWidget) -> None:
"""Set a layout as the central object."""
layout = QHBoxLayout()
layout.addWidget(widget)
self.setLayout(layout)
return return
# END Class NFixedPage # END Class NFixedPage
@@ -162,7 +172,7 @@ class NScrollableForm(QScrollArea):
self.verticalScrollBar().setValue(yPos) self.verticalScrollBar().setValue(yPos)
return return
def addGroupLabel(self, label: str, identifier: int) -> None: def addGroupLabel(self, label: str, identifier: int | None = None) -> None:
"""Add a text label to separate groups of settings.""" """Add a text label to separate groups of settings."""
hM = CONFIG.pxInt(4) hM = CONFIG.pxInt(4)
qLabel = QLabel(f"<b>{label}</b>", self) qLabel = QLabel(f"<b>{label}</b>", self)
@@ -170,13 +180,14 @@ class NScrollableForm(QScrollArea):
if not self._first: if not self._first:
self._layout.addSpacing(5*hM) self._layout.addSpacing(5*hM)
self._layout.addWidget(qLabel) self._layout.addWidget(qLabel)
self._sections[identifier] = qLabel
self._first = False self._first = False
if identifier is not None:
self._sections[identifier] = qLabel
return return
def addRow(self, label: str, widget: QWidget, helpText: str = "", unit: str | None = None, def addRow(self, label: str, widget: QWidget, helpText: str = "", unit: str | None = None,
button: QWidget | None = None, editable: str | None = None, button: QWidget | None = None, editable: str | None = None,
stretch: tuple[int, int] = (0, 0)) -> None: stretch: tuple[int, int] = (1, 0)) -> None:
"""Add a label and a widget as a new row of the form.""" """Add a label and a widget as a new row of the form."""
row = QHBoxLayout() row = QHBoxLayout()
row.setSpacing(CONFIG.pxInt(12)) row.setSpacing(CONFIG.pxInt(12))
@@ -191,8 +202,8 @@ class NScrollableForm(QScrollArea):
scale=self._fontScale, wrap=True, indent=self._indent scale=self._fontScale, wrap=True, indent=self._indent
) )
labelBox = QVBoxLayout() labelBox = QVBoxLayout()
labelBox.addWidget(qLabel) labelBox.addWidget(qLabel, 0)
labelBox.addWidget(qHelp) labelBox.addWidget(qHelp, 1)
labelBox.setSpacing(0) labelBox.setSpacing(0)
row.addLayout(labelBox, stretch[0]) row.addLayout(labelBox, stretch[0])
if editable: if editable:
@@ -202,13 +213,13 @@ class NScrollableForm(QScrollArea):
if isinstance(unit, str): if isinstance(unit, str):
box = QHBoxLayout() box = QHBoxLayout()
box.addWidget(widget) box.addWidget(widget, 1)
box.addWidget(QLabel(unit, self)) box.addWidget(QLabel(unit, self), 0)
row.addLayout(box, stretch[1]) row.addLayout(box, stretch[1])
elif isinstance(button, QAbstractButton): elif isinstance(button, QAbstractButton):
box = QHBoxLayout() box = QHBoxLayout()
box.addWidget(widget) box.addWidget(widget, 1)
box.addWidget(button) box.addWidget(button, 0)
row.addLayout(box, stretch[1]) row.addLayout(box, stretch[1])
else: else:
row.addWidget(widget, stretch[1]) row.addWidget(widget, stretch[1])
@@ -228,125 +239,6 @@ class NScrollableForm(QScrollArea):
# END Class NScrollableForm # END Class NScrollableForm
class NConfigLayout(QGridLayout):
def __init__(self) -> None:
super().__init__()
self._nextRow = 0
self._helpCol = QColor(0, 0, 0)
self._fontScale = DEFAULT_SCALE
self._itemMap = {}
wSp = CONFIG.pxInt(8)
self.setHorizontalSpacing(wSp)
self.setVerticalSpacing(wSp)
self.setColumnStretch(0, 1)
return
##
# Class Methods
##
def addGroupLabel(self, label: str) -> None:
"""Add a text label to separate groups of settings."""
hM = CONFIG.pxInt(4)
qLabel = QLabel("<b>%s</b>" % label)
qLabel.setContentsMargins(0, hM, 0, hM)
self.addWidget(qLabel, self._nextRow, 0, 1, 2, Qt.AlignLeft)
self.setRowStretch(self._nextRow, 0)
self.setRowStretch(self._nextRow + 1, 1)
self._nextRow += 1
return
def addRow(self, label: str, widget: QWidget, unit: str | None = None,
button: QWidget | None = None) -> int:
"""Add a label and a widget as a new row of the grid."""
wSp = CONFIG.pxInt(8)
qLabel = QLabel(label)
qLabel.setIndent(wSp)
qLabel.setBuddy(widget)
qHelp = None
self.addWidget(qLabel, self._nextRow, 0, 1, 1, LEFT_TOP)
if isinstance(unit, str):
controlBox = QHBoxLayout()
controlBox.addWidget(widget, 0, Qt.AlignVCenter)
controlBox.addWidget(QLabel(unit), 0, Qt.AlignVCenter)
controlBox.setSpacing(wSp)
self.addLayout(controlBox, self._nextRow, 1, 1, 1, RIGHT_TOP)
elif isinstance(button, QAbstractButton):
controlBox = QHBoxLayout()
controlBox.addWidget(widget, 0, Qt.AlignVCenter)
controlBox.addWidget(button, 0, Qt.AlignVCenter)
controlBox.setSpacing(wSp)
self.addLayout(controlBox, self._nextRow, 1, 1, 1, RIGHT_TOP)
else:
self.addWidget(widget, self._nextRow, 1, 1, 1, RIGHT_TOP)
self.setRowStretch(self._nextRow, 0)
self.setRowStretch(self._nextRow+1, 1)
self._itemMap[self._nextRow] = (qLabel, qHelp, widget)
self._nextRow += 1
return self._nextRow - 1
# END Class NConfigLayout
class NSimpleLayout(QGridLayout):
"""Similar to NConfigLayout, but only has a label + widget two
column layout.
"""
def __init__(self, stretcColumn: int = 0) -> None:
super().__init__()
self._nextRow = 0
wSp = CONFIG.pxInt(8)
self.setHorizontalSpacing(wSp)
self.setVerticalSpacing(wSp)
self.setColumnStretch(stretcColumn, 1)
return
##
# Methods
##
def addGroupLabel(self, label: str) -> None:
"""Add a text label to separate groups of settings."""
hM = CONFIG.pxInt(4)
qLabel = QLabel("<b>%s</b>" % label)
qLabel.setContentsMargins(0, hM, 0, hM)
self.addWidget(qLabel, self._nextRow, 0, 1, 2, Qt.AlignLeft)
self.setRowStretch(self._nextRow, 0)
self.setRowStretch(self._nextRow + 1, 1)
self._nextRow += 1
return
def addRow(self, label: str, widget: QWidget) -> None:
"""Add a label and a widget as a new row of the grid."""
wSp = CONFIG.pxInt(8)
qLabel = QLabel(label)
qLabel.setIndent(wSp)
qLabel.setBuddy(widget)
self.addWidget(qLabel, self._nextRow, 0, 1, 1, LEFT_TOP)
self.addWidget(widget, self._nextRow, 1, 1, 1, RIGHT_TOP)
self.setRowStretch(self._nextRow, 0)
self.setRowStretch(self._nextRow+1, 1)
self._nextRow += 1
return
# END Class NSimpleLayout
class NColourLabel(QLabel): class NColourLabel(QLabel):
"""Extension: A Coloured Label """Extension: A Coloured Label
@@ -369,10 +261,7 @@ class NColourLabel(QLabel):
self.setPalette(colour) self.setPalette(colour)
self.setFont(font) self.setFont(font)
self.setIndent(indent) self.setIndent(indent)
self.setWordWrap(wrap)
if wrap:
self.setWordWrap(True)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
return return
-8
View File
@@ -71,14 +71,6 @@ class NPagedSideBar(QToolBar):
self._labelCol = color self._labelCol = color
return return
def addSeparator(self) -> None:
"""Add a spacer widget."""
spacer = QWidget(self)
spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
spacer.setFixedHeight(self._spacerHeight)
self.insertWidget(self._stretchAction, spacer)
return
def addLabel(self, text: str) -> None: def addLabel(self, text: str) -> None:
"""Add a new label to the toolbar.""" """Add a new label to the toolbar."""
label = _NPagedToolLabel(self, self._labelCol) label = _NPagedToolLabel(self, self._labelCol)
+110 -173
View File
@@ -42,7 +42,9 @@ from novelwriter.constants import nwHeadFmt, nwLabels, trConst
from novelwriter.core.buildsettings import BuildSettings, FilterMode from novelwriter.core.buildsettings import BuildSettings, FilterMode
from novelwriter.extensions.switch import NSwitch from novelwriter.extensions.switch import NSwitch
from novelwriter.extensions.switchbox import NSwitchBox from novelwriter.extensions.switchbox import NSwitchBox
from novelwriter.extensions.configlayout import NConfigLayout, NSimpleLayout from novelwriter.extensions.configlayout import (
NColourLabel, NFixedPage, NScrollableForm, NScrollablePage
)
from novelwriter.extensions.pagedsidebar import NPagedSideBar from novelwriter.extensions.pagedsidebar import NPagedSideBar
if TYPE_CHECKING: # pragma: no cover if TYPE_CHECKING: # pragma: no cover
@@ -90,34 +92,37 @@ class GuiBuildSettings(QDialog):
CONFIG.pxInt(pOptions.getInt("GuiBuildSettings", "winHeight", hWin)) CONFIG.pxInt(pOptions.getInt("GuiBuildSettings", "winHeight", hWin))
) )
# Options SideBar # Title
# =============== self.titleLabel = NColourLabel(
self.tr("Manuscript Build Settings"), SHARED.theme.helpText,
parent=self, scale=NColourLabel.HEADER_SCALE, indent=CONFIG.pxInt(4)
)
self.optSideBar = NPagedSideBar(self) # Settings Name
self.optSideBar.setMinimumWidth(mPx) self.lblBuildName = QLabel(self.tr("Name"))
self.optSideBar.setMaximumWidth(mPx) self.editBuildName = QLineEdit(self)
self.optSideBar.setLabelColor(SHARED.theme.helpText)
self.optSideBar.addLabel(self.tr("Options")) # SideBar
self.optSideBar.addButton(self.tr("Selection"), self.OPT_FILTERS) self.sidebar = NPagedSideBar(self)
self.optSideBar.addButton(self.tr("Headings"), self.OPT_HEADINGS) self.sidebar.setMinimumWidth(mPx)
self.optSideBar.addButton(self.tr("Content"), self.OPT_CONTENT) self.sidebar.setMaximumWidth(mPx)
self.optSideBar.addButton(self.tr("Format"), self.OPT_FORMAT) self.sidebar.setLabelColor(SHARED.theme.helpText)
self.optSideBar.addButton(self.tr("Output"), self.OPT_OUTPUT)
self.optSideBar.buttonClicked.connect(self._stackPageSelected) self.sidebar.addButton(self.tr("Selection"), self.OPT_FILTERS)
self.sidebar.addButton(self.tr("Headings"), self.OPT_HEADINGS)
self.sidebar.addButton(self.tr("Content"), self.OPT_CONTENT)
self.sidebar.addButton(self.tr("Format"), self.OPT_FORMAT)
self.sidebar.addButton(self.tr("Output"), self.OPT_OUTPUT)
# Options Area self.sidebar.buttonClicked.connect(self._stackPageSelected)
# ============
# Create Tabs # Content
self.optTabSelect = _FilterTab(self, self._build) self.optTabSelect = _FilterTab(self, self._build)
self.optTabHeadings = _HeadingsTab(self, self._build) self.optTabHeadings = _HeadingsTab(self, self._build)
self.optTabContent = _ContentTab(self, self._build) self.optTabContent = _ContentTab(self, self._build)
self.optTabFormat = _FormatTab(self, self._build) self.optTabFormat = _FormatTab(self, self._build)
self.optTabOutput = _OutputTab(self, self._build) self.optTabOutput = _OutputTab(self, self._build)
# Add Tabs
self.toolStack = QStackedWidget(self) self.toolStack = QStackedWidget(self)
self.toolStack.addWidget(self.optTabSelect) self.toolStack.addWidget(self.optTabSelect)
self.toolStack.addWidget(self.optTabHeadings) self.toolStack.addWidget(self.optTabHeadings)
@@ -125,38 +130,36 @@ class GuiBuildSettings(QDialog):
self.toolStack.addWidget(self.optTabContent) self.toolStack.addWidget(self.optTabContent)
self.toolStack.addWidget(self.optTabOutput) self.toolStack.addWidget(self.optTabOutput)
# Main Settings + Buttons # Buttons
# ======================= self.buttonBox = QDialogButtonBox(
QDialogButtonBox.StandardButton.Apply
self.lblBuildName = QLabel(self.tr("Name")) | QDialogButtonBox.StandardButton.Save
self.editBuildName = QLineEdit() | QDialogButtonBox.StandardButton.Close
self.dlgButtons = QDialogButtonBox(
QDialogButtonBox.Apply | QDialogButtonBox.Save | QDialogButtonBox.Close
) )
self.dlgButtons.clicked.connect(self._dialogButtonClicked) self.buttonBox.clicked.connect(self._dialogButtonClicked)
self.buttonBox = QHBoxLayout() # Assemble
self.buttonBox.addWidget(self.lblBuildName) self.topBox = QHBoxLayout()
self.buttonBox.addWidget(self.editBuildName) self.topBox.addWidget(self.titleLabel)
self.buttonBox.addWidget(self.dlgButtons) self.topBox.addStretch(1)
self.topBox.addWidget(self.lblBuildName)
# Assemble GUI self.topBox.addWidget(self.editBuildName, 1)
# ============
self.mainBox = QHBoxLayout() self.mainBox = QHBoxLayout()
self.mainBox.addWidget(self.optSideBar) self.mainBox.addWidget(self.sidebar)
self.mainBox.addWidget(self.toolStack) self.mainBox.addWidget(self.toolStack)
self.mainBox.setContentsMargins(0, 0, 0, 0) self.mainBox.setContentsMargins(0, 0, 0, 0)
self.outerBox = QVBoxLayout() self.outerBox = QVBoxLayout()
self.outerBox.addLayout(self.topBox)
self.outerBox.addLayout(self.mainBox) self.outerBox.addLayout(self.mainBox)
self.outerBox.addLayout(self.buttonBox) self.outerBox.addWidget(self.buttonBox)
self.outerBox.setSpacing(CONFIG.pxInt(12)) self.outerBox.setSpacing(CONFIG.pxInt(12))
self.setLayout(self.outerBox) self.setLayout(self.outerBox)
# Set Default Tab # Set Default Tab
self.optSideBar.setSelected(self.OPT_FILTERS) self.sidebar.setSelected(self.OPT_FILTERS)
logger.debug("Ready: GuiBuildSettings") logger.debug("Ready: GuiBuildSettings")
@@ -185,6 +188,21 @@ class GuiBuildSettings(QDialog):
"""The build ID of the build of the dialog.""" """The build ID of the build of the dialog."""
return self._build.buildID return self._build.buildID
##
# Events
##
def closeEvent(self, event: QEvent) -> None:
"""Capture the user closing the window so we can save
settings.
"""
logger.debug("Closing: GuiBuildSettings")
self._askToSaveBuild()
self._saveSettings()
event.accept()
self.deleteLater()
return
## ##
# Private Slots # Private Slots
## ##
@@ -207,7 +225,7 @@ class GuiBuildSettings(QDialog):
@pyqtSlot("QAbstractButton*") @pyqtSlot("QAbstractButton*")
def _dialogButtonClicked(self, button: QAbstractButton) -> None: def _dialogButtonClicked(self, button: QAbstractButton) -> None:
"""Handle button clicks from the dialog button box.""" """Handle button clicks from the dialog button box."""
role = self.dlgButtons.buttonRole(button) role = self.buttonBox.buttonRole(button)
if role == QDialogButtonBox.ApplyRole: if role == QDialogButtonBox.ApplyRole:
self._emitBuildData() self._emitBuildData()
elif role == QDialogButtonBox.AcceptRole: elif role == QDialogButtonBox.AcceptRole:
@@ -217,21 +235,6 @@ class GuiBuildSettings(QDialog):
self.close() self.close()
return return
##
# Events
##
def closeEvent(self, event: QEvent) -> None:
"""Capture the user closing the window so we can save
settings.
"""
logger.debug("Closing: GuiBuildSettings")
self._askToSaveBuild()
self._saveSettings()
event.accept()
self.deleteLater()
return
## ##
# Internal Functions # Internal Functions
## ##
@@ -279,7 +282,7 @@ class GuiBuildSettings(QDialog):
# END Class GuiBuildSettings # END Class GuiBuildSettings
class _FilterTab(QWidget): class _FilterTab(NFixedPage):
C_DATA = 0 C_DATA = 0
C_NAME = 0 C_NAME = 0
@@ -395,11 +398,7 @@ class _FilterTab(QWidget):
CONFIG.pxInt(pOptions.getInt("GuiBuildSettings", "filterWidth", 300)) CONFIG.pxInt(pOptions.getInt("GuiBuildSettings", "filterWidth", 300))
]) ])
self.outerBox = QHBoxLayout() self.setCentralWidget(self.mainSplit)
self.outerBox.addWidget(self.mainSplit)
self.outerBox.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.outerBox)
return return
@@ -580,7 +579,7 @@ class _FilterTab(QWidget):
# END Class _FilterTab # END Class _FilterTab
class _HeadingsTab(QWidget): class _HeadingsTab(NScrollablePage):
EDIT_TITLE = 1 EDIT_TITLE = 1
EDIT_CHAPTER = 2 EDIT_CHAPTER = 2
@@ -758,7 +757,7 @@ class _HeadingsTab(QWidget):
self.outerBox.addLayout(self.editFormBox) self.outerBox.addLayout(self.editFormBox)
self.outerBox.addStretch(1) self.outerBox.addStretch(1)
self.setLayout(self.outerBox) self.setCentralLayout(self.outerBox)
return return
@@ -825,6 +824,7 @@ class _HeadingsTab(QWidget):
# Private Slots # Private Slots
## ##
@pyqtSlot()
def _saveFormat(self) -> None: def _saveFormat(self) -> None:
"""Save the format from the edit text box.""" """Save the format from the edit text box."""
heading = self._editing heading = self._editing
@@ -881,7 +881,7 @@ class _HeadingSyntaxHighlighter(QSyntaxHighlighter):
# END Class _HeadingSyntaxHighlighter # END Class _HeadingSyntaxHighlighter
class _ContentTab(QWidget): class _ContentTab(NScrollableForm):
def __init__(self, buildMain: GuiBuildSettings, build: BuildSettings) -> None: def __init__(self, buildMain: GuiBuildSettings, build: BuildSettings) -> None:
super().__init__(parent=buildMain) super().__init__(parent=buildMain)
@@ -890,42 +890,26 @@ class _ContentTab(QWidget):
iPx = SHARED.theme.baseIconSize iPx = SHARED.theme.baseIconSize
# Left Form # Text Content
# =========
self.formLeft = NSimpleLayout()
self.formLeft.addGroupLabel(self._build.getLabel("text.grpContent"))
self.incSynopsis = NSwitch(self, width=2*iPx, height=iPx) self.incSynopsis = NSwitch(self, width=2*iPx, height=iPx)
self.incComments = NSwitch(self, width=2*iPx, height=iPx) self.incComments = NSwitch(self, width=2*iPx, height=iPx)
self.incKeywords = NSwitch(self, width=2*iPx, height=iPx) self.incKeywords = NSwitch(self, width=2*iPx, height=iPx)
self.incBodyText = NSwitch(self, width=2*iPx, height=iPx) self.incBodyText = NSwitch(self, width=2*iPx, height=iPx)
self.formLeft.addRow(self._build.getLabel("text.includeSynopsis"), self.incSynopsis) self.addGroupLabel(self._build.getLabel("text.grpContent"))
self.formLeft.addRow(self._build.getLabel("text.includeComments"), self.incComments) self.addRow(self._build.getLabel("text.includeSynopsis"), self.incSynopsis)
self.formLeft.addRow(self._build.getLabel("text.includeKeywords"), self.incKeywords) self.addRow(self._build.getLabel("text.includeComments"), self.incComments)
self.formLeft.addRow(self._build.getLabel("text.includeBodyText"), self.incBodyText) self.addRow(self._build.getLabel("text.includeKeywords"), self.incKeywords)
self.addRow(self._build.getLabel("text.includeBodyText"), self.incBodyText)
# Right Form
# ==========
self.formRight = NSimpleLayout()
self.formRight.addGroupLabel(self._build.getLabel("text.grpInsert"))
# Insert Content
self.addNoteHead = NSwitch(self, width=2*iPx, height=iPx) self.addNoteHead = NSwitch(self, width=2*iPx, height=iPx)
self.formRight.addRow(self._build.getLabel("text.addNoteHeadings"), self.addNoteHead) self.addGroupLabel(self._build.getLabel("text.grpInsert"))
self.addRow(self._build.getLabel("text.addNoteHeadings"), self.addNoteHead)
# Assemble GUI # Finalise
# ============ self.finalise()
self.outerBox = QHBoxLayout()
self.outerBox.addLayout(self.formLeft, 1)
self.outerBox.addLayout(self.formRight, 1)
self.outerBox.setContentsMargins(0, 0, 0, 0)
self.outerBox.setSpacing(CONFIG.pxInt(16))
self.setLayout(self.outerBox)
return return
@@ -950,7 +934,7 @@ class _ContentTab(QWidget):
# END Class _ContentTab # END Class _ContentTab
class _FormatTab(QWidget): class _FormatTab(NScrollableForm):
def __init__(self, buildMain: GuiBuildSettings, build: BuildSettings) -> None: def __init__(self, buildMain: GuiBuildSettings, build: BuildSettings) -> None:
super().__init__(parent=buildMain) super().__init__(parent=buildMain)
@@ -964,20 +948,20 @@ class _FormatTab(QWidget):
spW = 6*SHARED.theme.textNWidth spW = 6*SHARED.theme.textNWidth
dbW = 8*SHARED.theme.textNWidth dbW = 8*SHARED.theme.textNWidth
# Text Format Form # Text Format
# ================ # ===========
self.formFormat = NConfigLayout() self.addGroupLabel(self._build.getLabel("format.grpFormat"))
self.formFormat.addGroupLabel(self._build.getLabel("format.grpFormat"))
# Font Family # Font Family
self.textFont = QLineEdit() self.textFont = QLineEdit(self)
self.textFont.setReadOnly(True) self.textFont.setReadOnly(True)
self.btnTextFont = QPushButton("...") self.btnTextFont = QPushButton("...")
self.btnTextFont.setMaximumWidth(int(2.5*SHARED.theme.getTextWidth("..."))) self.btnTextFont.setMaximumWidth(int(2.5*SHARED.theme.getTextWidth("...")))
self.btnTextFont.clicked.connect(self._selectFont) self.btnTextFont.clicked.connect(self._selectFont)
self.formFormat.addRow( self.addRow(
self._build.getLabel("format.textFont"), self.textFont, button=self.btnTextFont self._build.getLabel("format.textFont"), self.textFont,
button=self.btnTextFont, stretch=(3, 2)
) )
# Font Size # Font Size
@@ -986,9 +970,7 @@ class _FormatTab(QWidget):
self.textSize.setMaximum(60) self.textSize.setMaximum(60)
self.textSize.setSingleStep(1) self.textSize.setSingleStep(1)
self.textSize.setMinimumWidth(spW) self.textSize.setMinimumWidth(spW)
self.formFormat.addRow( self.addRow(self._build.getLabel("format.textSize"), self.textSize, unit="pt")
self._build.getLabel("format.textSize"), self.textSize, unit="pt"
)
# Line Height # Line Height
self.lineHeight = QDoubleSpinBox(self) self.lineHeight = QDoubleSpinBox(self)
@@ -997,31 +979,25 @@ class _FormatTab(QWidget):
self.lineHeight.setMaximum(3.0) self.lineHeight.setMaximum(3.0)
self.lineHeight.setSingleStep(0.05) self.lineHeight.setSingleStep(0.05)
self.lineHeight.setDecimals(2) self.lineHeight.setDecimals(2)
self.formFormat.addRow( self.addRow(self._build.getLabel("format.lineHeight"), self.lineHeight, unit="em")
self._build.getLabel("format.lineHeight"), self.lineHeight, unit="em"
)
# Text Options Form # Text Options
# ================= # ============
self.formOptions = NSimpleLayout() self.addGroupLabel(self._build.getLabel("format.grpOptions"))
self.formOptions.addGroupLabel(self._build.getLabel("format.grpOptions"))
self.formOptions.setContentsMargins(0, 0, 0, 0)
self.justifyText = NSwitch(self, width=2*iPx, height=iPx) self.justifyText = NSwitch(self, width=2*iPx, height=iPx)
self.stripUnicode = NSwitch(self, width=2*iPx, height=iPx) self.stripUnicode = NSwitch(self, width=2*iPx, height=iPx)
self.replaceTabs = NSwitch(self, width=2*iPx, height=iPx) self.replaceTabs = NSwitch(self, width=2*iPx, height=iPx)
self.formOptions.addRow(self._build.getLabel("format.justifyText"), self.justifyText) self.addRow(self._build.getLabel("format.justifyText"), self.justifyText)
self.formOptions.addRow(self._build.getLabel("format.stripUnicode"), self.stripUnicode) self.addRow(self._build.getLabel("format.stripUnicode"), self.stripUnicode)
self.formOptions.addRow(self._build.getLabel("format.replaceTabs"), self.replaceTabs) self.addRow(self._build.getLabel("format.replaceTabs"), self.replaceTabs)
# Page Layout Form # Page Layout
# ================ # ===========
self.formLayout = NSimpleLayout() self.addGroupLabel(self._build.getLabel("format.grpPage"))
self.formLayout.addGroupLabel(self._build.getLabel("format.grpPage"))
self.formLayout.setContentsMargins(0, 0, 0, 0)
self.pageUnit = QComboBox(self) self.pageUnit = QComboBox(self)
for key, name in nwLabels.UNIT_NAME.items(): for key, name in nwLabels.UNIT_NAME.items():
@@ -1053,38 +1029,17 @@ class _FormatTab(QWidget):
self.rightMargin = QDoubleSpinBox(self) self.rightMargin = QDoubleSpinBox(self)
self.rightMargin.setFixedWidth(dbW) self.rightMargin.setFixedWidth(dbW)
self.formLayout.addRow(self._build.getLabel("format.pageUnit"), self.pageUnit) self.addRow(self._build.getLabel("format.pageUnit"), self.pageUnit)
self.formLayout.addRow(self._build.getLabel("format.pageSize"), self.pageSize) self.addRow(self._build.getLabel("format.pageSize"), self.pageSize)
self.formLayout.addRow(self._build.getLabel("format.pageWidth"), self.pageWidth) self.addRow(self._build.getLabel("format.pageWidth"), self.pageWidth)
self.formLayout.addRow(self._build.getLabel("format.pageHeight"), self.pageHeight) self.addRow(self._build.getLabel("format.pageHeight"), self.pageHeight)
self.formLayout.addRow(self._build.getLabel("format.topMargin"), self.topMargin) self.addRow(self._build.getLabel("format.topMargin"), self.topMargin)
self.formLayout.addRow(self._build.getLabel("format.bottomMargin"), self.bottomMargin) self.addRow(self._build.getLabel("format.bottomMargin"), self.bottomMargin)
self.formLayout.addRow(self._build.getLabel("format.leftMargin"), self.leftMargin) self.addRow(self._build.getLabel("format.leftMargin"), self.leftMargin)
self.formLayout.addRow(self._build.getLabel("format.rightMargin"), self.rightMargin) self.addRow(self._build.getLabel("format.rightMargin"), self.rightMargin)
# Assemble GUI # Finalise
# ============ self.finalise()
self.formLeft = QVBoxLayout()
self.formLeft.addLayout(self.formFormat)
self.formLeft.addLayout(self.formOptions)
self.formLeft.addStretch(1)
self.formLeft.setContentsMargins(0, 0, 0, 0)
self.formLeft.setSpacing(CONFIG.pxInt(8))
self.formRight = QVBoxLayout()
self.formRight.addLayout(self.formLayout)
self.formRight.addStretch(1)
self.formRight.setContentsMargins(0, 0, 0, 0)
self.formRight.setSpacing(CONFIG.pxInt(8))
self.outerBox = QHBoxLayout()
self.outerBox.addLayout(self.formLeft, 1)
self.outerBox.addLayout(self.formRight, 1)
self.outerBox.setContentsMargins(0, 0, 0, 0)
self.outerBox.setSpacing(CONFIG.pxInt(16))
self.setLayout(self.outerBox)
return return
@@ -1248,7 +1203,7 @@ class _FormatTab(QWidget):
# END Class _FormatTab # END Class _FormatTab
class _OutputTab(QWidget): class _OutputTab(NScrollableForm):
def __init__(self, buildMain: GuiBuildSettings, build: BuildSettings) -> None: def __init__(self, buildMain: GuiBuildSettings, build: BuildSettings) -> None:
super().__init__(parent=buildMain) super().__init__(parent=buildMain)
@@ -1257,36 +1212,18 @@ class _OutputTab(QWidget):
iPx = SHARED.theme.baseIconSize iPx = SHARED.theme.baseIconSize
# Left Form # Open Document
# ========= self.addGroupLabel(self._build.getLabel("odt"))
self.formLeft = NSimpleLayout()
self.formLeft.addGroupLabel(self._build.getLabel("odt"))
self.odtAddColours = NSwitch(self, width=2*iPx, height=iPx) self.odtAddColours = NSwitch(self, width=2*iPx, height=iPx)
self.addRow(self._build.getLabel("odt.addColours"), self.odtAddColours)
self.formLeft.addRow(self._build.getLabel("odt.addColours"), self.odtAddColours) # HTML Document
self.addGroupLabel(self._build.getLabel("html"))
# Right Form
# ==========
self.formRight = NSimpleLayout()
self.formRight.addGroupLabel(self._build.getLabel("html"))
self.htmlAddStyles = NSwitch(self, width=2*iPx, height=iPx) self.htmlAddStyles = NSwitch(self, width=2*iPx, height=iPx)
self.addRow(self._build.getLabel("html.addStyles"), self.htmlAddStyles)
self.formRight.addRow(self._build.getLabel("html.addStyles"), self.htmlAddStyles) # Finalise
self.finalise()
# Assemble GUI
# ============
self.outerBox = QHBoxLayout()
self.outerBox.addLayout(self.formLeft, 1)
self.outerBox.addLayout(self.formRight, 1)
self.outerBox.setContentsMargins(0, 0, 0, 0)
self.outerBox.setSpacing(CONFIG.pxInt(16))
self.setLayout(self.outerBox)
return return
+2 -2
View File
@@ -116,7 +116,7 @@ def testManuscript_Builds(qtbot: QtBot, nwGUI: GuiMain, projPath: Path):
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000): with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
bSettings.newSettingsReady.connect(_testNewSettingsReady) bSettings.newSettingsReady.connect(_testNewSettingsReady)
bSettings.dlgButtons.button(QDialogButtonBox.Save).click() bSettings.buttonBox.button(QDialogButtonBox.Save).click()
assert isinstance(build, BuildSettings) assert isinstance(build, BuildSettings)
assert build.name == "Test Build" assert build.name == "Test Build"
@@ -133,7 +133,7 @@ def testManuscript_Builds(qtbot: QtBot, nwGUI: GuiMain, projPath: Path):
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000): with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
bSettings.newSettingsReady.connect(_testNewSettingsReady) bSettings.newSettingsReady.connect(_testNewSettingsReady)
bSettings.dlgButtons.button(QDialogButtonBox.Apply).click() # Should leave the dialog open bSettings.buttonBox.button(QDialogButtonBox.Apply).click() # Should leave the dialog open
assert isinstance(build, BuildSettings) assert isinstance(build, BuildSettings)
assert build.name == "Test Build" assert build.name == "Test Build"
+18 -18
View File
@@ -53,19 +53,19 @@ def testBuildSettings_Init(qtbot: QtBot, nwGUI: GuiMain, projPath: Path, mockRnd
bSettings.loadContent() bSettings.loadContent()
# Flip through pages # Flip through pages
bSettings.optSideBar._group.button(bSettings.OPT_OUTPUT).click() bSettings.sidebar._group.button(bSettings.OPT_OUTPUT).click()
assert isinstance(bSettings.toolStack.currentWidget(), _OutputTab) assert isinstance(bSettings.toolStack.currentWidget(), _OutputTab)
bSettings.optSideBar._group.button(bSettings.OPT_FORMAT).click() bSettings.sidebar._group.button(bSettings.OPT_FORMAT).click()
assert isinstance(bSettings.toolStack.currentWidget(), _FormatTab) assert isinstance(bSettings.toolStack.currentWidget(), _FormatTab)
bSettings.optSideBar._group.button(bSettings.OPT_CONTENT).click() bSettings.sidebar._group.button(bSettings.OPT_CONTENT).click()
assert isinstance(bSettings.toolStack.currentWidget(), _ContentTab) assert isinstance(bSettings.toolStack.currentWidget(), _ContentTab)
bSettings.optSideBar._group.button(bSettings.OPT_HEADINGS).click() bSettings.sidebar._group.button(bSettings.OPT_HEADINGS).click()
assert isinstance(bSettings.toolStack.currentWidget(), _HeadingsTab) assert isinstance(bSettings.toolStack.currentWidget(), _HeadingsTab)
bSettings.optSideBar._group.button(bSettings.OPT_FILTERS).click() bSettings.sidebar._group.button(bSettings.OPT_FILTERS).click()
assert isinstance(bSettings.toolStack.currentWidget(), _FilterTab) assert isinstance(bSettings.toolStack.currentWidget(), _FilterTab)
# Check dialog buttons # Check dialog buttons
@@ -80,7 +80,7 @@ def testBuildSettings_Init(qtbot: QtBot, nwGUI: GuiMain, projPath: Path, mockRnd
# Capture Apply button # Capture Apply button
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000): with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
bSettings.newSettingsReady.connect(_testNewSettingsReady) bSettings.newSettingsReady.connect(_testNewSettingsReady)
bSettings._dialogButtonClicked(bSettings.dlgButtons.button(QDialogButtonBox.Apply)) bSettings._dialogButtonClicked(bSettings.buttonBox.button(QDialogButtonBox.Apply))
assert triggered assert triggered
@@ -89,7 +89,7 @@ def testBuildSettings_Init(qtbot: QtBot, nwGUI: GuiMain, projPath: Path, mockRnd
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000): with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
bSettings.newSettingsReady.connect(_testNewSettingsReady) bSettings.newSettingsReady.connect(_testNewSettingsReady)
bSettings._dialogButtonClicked(bSettings.dlgButtons.button(QDialogButtonBox.Save)) bSettings._dialogButtonClicked(bSettings.buttonBox.button(QDialogButtonBox.Save))
assert triggered assert triggered
@@ -106,7 +106,7 @@ def testBuildSettings_Init(qtbot: QtBot, nwGUI: GuiMain, projPath: Path, mockRnd
assert triggered assert triggered
# Finish # Finish
bSettings._dialogButtonClicked(bSettings.dlgButtons.button(QDialogButtonBox.Close)) bSettings._dialogButtonClicked(bSettings.buttonBox.button(QDialogButtonBox.Close))
# qtbot.stop() # qtbot.stop()
# END Test testBuildSettings_Init # END Test testBuildSettings_Init
@@ -141,7 +141,7 @@ def testBuildSettings_Filter(qtbot: QtBot, nwGUI: GuiMain, projPath: Path, mockR
bSettings.loadContent() bSettings.loadContent()
filterTab = bSettings.optTabSelect filterTab = bSettings.optTabSelect
bSettings.optSideBar._group.button(bSettings.OPT_FILTERS).click() bSettings.sidebar._group.button(bSettings.OPT_FILTERS).click()
assert bSettings.toolStack.currentWidget() is filterTab assert bSettings.toolStack.currentWidget() is filterTab
# Check content # Check content
@@ -312,7 +312,7 @@ def testBuildSettings_Filter(qtbot: QtBot, nwGUI: GuiMain, projPath: Path, mockR
] ]
# Finish # Finish
bSettings._dialogButtonClicked(bSettings.dlgButtons.button(QDialogButtonBox.Close)) bSettings._dialogButtonClicked(bSettings.buttonBox.button(QDialogButtonBox.Close))
# qtbot.stop() # qtbot.stop()
# END Test testBuildSettings_Filter # END Test testBuildSettings_Filter
@@ -343,7 +343,7 @@ def testBuildSettings_Headings(qtbot: QtBot, nwGUI: GuiMain):
bSettings.loadContent() bSettings.loadContent()
headTab = bSettings.optTabHeadings headTab = bSettings.optTabHeadings
bSettings.optSideBar._group.button(bSettings.OPT_HEADINGS).click() bSettings.sidebar._group.button(bSettings.OPT_HEADINGS).click()
assert bSettings.toolStack.currentWidget() is headTab assert bSettings.toolStack.currentWidget() is headTab
# Check initial values # Check initial values
@@ -468,7 +468,7 @@ def testBuildSettings_Headings(qtbot: QtBot, nwGUI: GuiMain):
assert build.getBool("headings.hideSection") is True assert build.getBool("headings.hideSection") is True
# Finish # Finish
bSettings._dialogButtonClicked(bSettings.dlgButtons.button(QDialogButtonBox.Close)) bSettings._dialogButtonClicked(bSettings.buttonBox.button(QDialogButtonBox.Close))
# qtbot.stop() # qtbot.stop()
# END Test testBuildSettings_Headings # END Test testBuildSettings_Headings
@@ -492,7 +492,7 @@ def testBuildSettings_Content(qtbot: QtBot, nwGUI: GuiMain):
bSettings.loadContent() bSettings.loadContent()
contTab = bSettings.optTabContent contTab = bSettings.optTabContent
bSettings.optSideBar._group.button(bSettings.OPT_CONTENT).click() bSettings.sidebar._group.button(bSettings.OPT_CONTENT).click()
assert bSettings.toolStack.currentWidget() is contTab assert bSettings.toolStack.currentWidget() is contTab
# Check initial values # Check initial values
@@ -522,7 +522,7 @@ def testBuildSettings_Content(qtbot: QtBot, nwGUI: GuiMain):
assert build.getBool("text.addNoteHeadings") is True assert build.getBool("text.addNoteHeadings") is True
# Finish # Finish
bSettings._dialogButtonClicked(bSettings.dlgButtons.button(QDialogButtonBox.Close)) bSettings._dialogButtonClicked(bSettings.buttonBox.button(QDialogButtonBox.Close))
# qtbot.stop() # qtbot.stop()
# END Test testBuildSettings_Content # END Test testBuildSettings_Content
@@ -559,7 +559,7 @@ def testBuildSettings_Format(monkeypatch, qtbot: QtBot, nwGUI: GuiMain):
bSettings.loadContent() bSettings.loadContent()
fmtTab = bSettings.optTabFormat fmtTab = bSettings.optTabFormat
bSettings.optSideBar._group.button(bSettings.OPT_FORMAT).click() bSettings.sidebar._group.button(bSettings.OPT_FORMAT).click()
assert bSettings.toolStack.currentWidget() is fmtTab assert bSettings.toolStack.currentWidget() is fmtTab
# Check initial values # Check initial values
@@ -624,7 +624,7 @@ def testBuildSettings_Format(monkeypatch, qtbot: QtBot, nwGUI: GuiMain):
assert fmtTab.textSize.value() == 10 assert fmtTab.textSize.value() == 10
# Finish # Finish
bSettings._dialogButtonClicked(bSettings.dlgButtons.button(QDialogButtonBox.Close)) bSettings._dialogButtonClicked(bSettings.buttonBox.button(QDialogButtonBox.Close))
# qtbot.stop() # qtbot.stop()
# END Test testBuildSettings_Format # END Test testBuildSettings_Format
@@ -644,7 +644,7 @@ def testBuildSettings_Output(qtbot: QtBot, nwGUI: GuiMain):
bSettings.loadContent() bSettings.loadContent()
outTab = bSettings.optTabOutput outTab = bSettings.optTabOutput
bSettings.optSideBar._group.button(bSettings.OPT_OUTPUT).click() bSettings.sidebar._group.button(bSettings.OPT_OUTPUT).click()
assert bSettings.toolStack.currentWidget() is outTab assert bSettings.toolStack.currentWidget() is outTab
# Check initial values # Check initial values
@@ -662,7 +662,7 @@ def testBuildSettings_Output(qtbot: QtBot, nwGUI: GuiMain):
assert build.getBool("html.addStyles") is True assert build.getBool("html.addStyles") is True
# Finish # Finish
bSettings._dialogButtonClicked(bSettings.dlgButtons.button(QDialogButtonBox.Close)) bSettings._dialogButtonClicked(bSettings.buttonBox.button(QDialogButtonBox.Close))
# qtbot.stop() # qtbot.stop()
# END Test testBuildSettings_Output # END Test testBuildSettings_Output