Move quote symbols to new Preferences tab
This commit is contained in:
+52
-21
@@ -61,6 +61,7 @@ class GuiPreferences(PagedDialog):
|
|||||||
self.tabEditor = GuiPreferencesEditor(self.theParent)
|
self.tabEditor = GuiPreferencesEditor(self.theParent)
|
||||||
self.tabSyntax = GuiPreferencesSyntax(self.theParent)
|
self.tabSyntax = GuiPreferencesSyntax(self.theParent)
|
||||||
self.tabAuto = GuiPreferencesAutomation(self.theParent)
|
self.tabAuto = GuiPreferencesAutomation(self.theParent)
|
||||||
|
self.tabQuote = GuiPreferencesQuotes(self.theParent)
|
||||||
|
|
||||||
self.addTab(self.tabGeneral, self.tr("General"))
|
self.addTab(self.tabGeneral, self.tr("General"))
|
||||||
self.addTab(self.tabProjects, self.tr("Projects"))
|
self.addTab(self.tabProjects, self.tr("Projects"))
|
||||||
@@ -68,6 +69,7 @@ class GuiPreferences(PagedDialog):
|
|||||||
self.addTab(self.tabEditor, self.tr("Editor"))
|
self.addTab(self.tabEditor, self.tr("Editor"))
|
||||||
self.addTab(self.tabSyntax, self.tr("Highlighting"))
|
self.addTab(self.tabSyntax, self.tr("Highlighting"))
|
||||||
self.addTab(self.tabAuto, self.tr("Automation"))
|
self.addTab(self.tabAuto, self.tr("Automation"))
|
||||||
|
self.addTab(self.tabQuote, self.tr("Quotes"))
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
self.buttonBox.accepted.connect(self._doSave)
|
self.buttonBox.accepted.connect(self._doSave)
|
||||||
@@ -1034,6 +1036,55 @@ class GuiPreferencesAutomation(QWidget):
|
|||||||
self.tr("Three consecutive dots become ellipsis.")
|
self.tr("Three consecutive dots become ellipsis.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def saveValues(self):
|
||||||
|
"""Save the values set for this tab.
|
||||||
|
"""
|
||||||
|
# Automatic Features
|
||||||
|
self.mainConf.autoSelect = self.autoSelect.isChecked()
|
||||||
|
self.mainConf.doReplace = self.doReplace.isChecked()
|
||||||
|
|
||||||
|
# Replace as You Type
|
||||||
|
self.mainConf.doReplaceSQuote = self.doReplaceSQuote.isChecked()
|
||||||
|
self.mainConf.doReplaceDQuote = self.doReplaceDQuote.isChecked()
|
||||||
|
self.mainConf.doReplaceDash = self.doReplaceDash.isChecked()
|
||||||
|
self.mainConf.doReplaceDots = self.doReplaceDots.isChecked()
|
||||||
|
|
||||||
|
self.mainConf.confChanged = True
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
##
|
||||||
|
# Slots
|
||||||
|
##
|
||||||
|
|
||||||
|
def _toggleAutoReplaceMain(self, theState):
|
||||||
|
"""Enables or disables switches controlled by the main auto
|
||||||
|
replace switch.
|
||||||
|
"""
|
||||||
|
self.doReplaceSQuote.setEnabled(theState)
|
||||||
|
self.doReplaceDQuote.setEnabled(theState)
|
||||||
|
self.doReplaceDash.setEnabled(theState)
|
||||||
|
self.doReplaceDots.setEnabled(theState)
|
||||||
|
return
|
||||||
|
|
||||||
|
# END Class GuiPreferencesAutomation
|
||||||
|
|
||||||
|
class GuiPreferencesQuotes(QWidget):
|
||||||
|
|
||||||
|
def __init__(self, theParent):
|
||||||
|
QWidget.__init__(self, theParent)
|
||||||
|
|
||||||
|
self.mainConf = nw.CONFIG
|
||||||
|
self.theParent = theParent
|
||||||
|
self.theTheme = theParent.theTheme
|
||||||
|
|
||||||
|
# The Form
|
||||||
|
self.mainForm = QConfigLayout()
|
||||||
|
self.mainForm.setHelpTextStyle(self.theTheme.helpText)
|
||||||
|
self.setLayout(self.mainForm)
|
||||||
|
|
||||||
# Quotation Style
|
# Quotation Style
|
||||||
# ===============
|
# ===============
|
||||||
self.mainForm.addGroupLabel(self.tr("Quotation Style"))
|
self.mainForm.addGroupLabel(self.tr("Quotation Style"))
|
||||||
@@ -1113,16 +1164,6 @@ class GuiPreferencesAutomation(QWidget):
|
|||||||
def saveValues(self):
|
def saveValues(self):
|
||||||
"""Save the values set for this tab.
|
"""Save the values set for this tab.
|
||||||
"""
|
"""
|
||||||
# Automatic Features
|
|
||||||
self.mainConf.autoSelect = self.autoSelect.isChecked()
|
|
||||||
self.mainConf.doReplace = self.doReplace.isChecked()
|
|
||||||
|
|
||||||
# Replace as You Type
|
|
||||||
self.mainConf.doReplaceSQuote = self.doReplaceSQuote.isChecked()
|
|
||||||
self.mainConf.doReplaceDQuote = self.doReplaceDQuote.isChecked()
|
|
||||||
self.mainConf.doReplaceDash = self.doReplaceDash.isChecked()
|
|
||||||
self.mainConf.doReplaceDots = self.doReplaceDots.isChecked()
|
|
||||||
|
|
||||||
# Quotation Style
|
# Quotation Style
|
||||||
self.mainConf.fmtSingleQuotes[0] = self.quoteSym["SO"].text()
|
self.mainConf.fmtSingleQuotes[0] = self.quoteSym["SO"].text()
|
||||||
self.mainConf.fmtSingleQuotes[1] = self.quoteSym["SC"].text()
|
self.mainConf.fmtSingleQuotes[1] = self.quoteSym["SC"].text()
|
||||||
@@ -1137,16 +1178,6 @@ class GuiPreferencesAutomation(QWidget):
|
|||||||
# Slots
|
# Slots
|
||||||
##
|
##
|
||||||
|
|
||||||
def _toggleAutoReplaceMain(self, theState):
|
|
||||||
"""Enables or disables switches controlled by the main auto
|
|
||||||
replace switch.
|
|
||||||
"""
|
|
||||||
self.doReplaceSQuote.setEnabled(theState)
|
|
||||||
self.doReplaceDQuote.setEnabled(theState)
|
|
||||||
self.doReplaceDash.setEnabled(theState)
|
|
||||||
self.doReplaceDots.setEnabled(theState)
|
|
||||||
return
|
|
||||||
|
|
||||||
def _getQuote(self, qType):
|
def _getQuote(self, qType):
|
||||||
"""Dialog for single quote open.
|
"""Dialog for single quote open.
|
||||||
"""
|
"""
|
||||||
@@ -1156,4 +1187,4 @@ class GuiPreferencesAutomation(QWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiPreferencesAutomation
|
# END Class GuiPreferencesQuotes
|
||||||
|
|||||||
@@ -229,9 +229,14 @@ def testGuiPreferences_Main(qtbot, monkeypatch, fncDir, outDir, refDir):
|
|||||||
assert not tabAuto.doReplaceDash.isEnabled()
|
assert not tabAuto.doReplaceDash.isEnabled()
|
||||||
assert not tabAuto.doReplaceDots.isEnabled()
|
assert not tabAuto.doReplaceDots.isEnabled()
|
||||||
|
|
||||||
|
# Quotation Style
|
||||||
|
qtbot.wait(keyDelay)
|
||||||
|
tabQuote = nwPrefs.tabQuote
|
||||||
|
nwPrefs._tabBox.setCurrentWidget(tabQuote)
|
||||||
|
|
||||||
monkeypatch.setattr(QuotesDialog, "selectedQuote", "'")
|
monkeypatch.setattr(QuotesDialog, "selectedQuote", "'")
|
||||||
monkeypatch.setattr(QuotesDialog, "exec_", lambda *args: QDialog.Accepted)
|
monkeypatch.setattr(QuotesDialog, "exec_", lambda *args: QDialog.Accepted)
|
||||||
qtbot.mouseClick(tabAuto.btnDoubleStyleC, Qt.LeftButton)
|
qtbot.mouseClick(tabQuote.btnDoubleStyleC, Qt.LeftButton)
|
||||||
|
|
||||||
# Save and Check Config
|
# Save and Check Config
|
||||||
qtbot.mouseClick(nwPrefs.buttonBox.button(QDialogButtonBox.Ok), Qt.LeftButton)
|
qtbot.mouseClick(nwPrefs.buttonBox.button(QDialogButtonBox.Ok), Qt.LeftButton)
|
||||||
|
|||||||
Reference in New Issue
Block a user