Update widget flow on preferences dialog

This commit is contained in:
Veronica Berglyd Olsen
2024-01-27 18:06:41 +01:00
parent 51314804bf
commit 6c75bdecdc
2 changed files with 75 additions and 134 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
) )
-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)