From 4aa6e25acd48425b3faa771c9d808ffc5feaff91 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 10 Jun 2019 23:14:53 +0200 Subject: [PATCH] Connected the last items added to preferences gui to config --- nw/config.py | 24 ++++++++++++++++++------ nw/constants.py | 10 +++++++++- nw/gui/configeditor.py | 12 ++++++++++++ 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/nw/config.py b/nw/config.py index db9bfe59..8cb91674 100644 --- a/nw/config.py +++ b/nw/config.py @@ -182,12 +182,8 @@ class Config: for i in range(10): self.recentList[i] = self._parseLine(cnfParse, cnfSec, "recent%d" % i,self.CNF_STR, self.recentList[i]) - if self.styleSQuote >= 0 and self.styleSQuote < len(nwQuotes.SINGLE): - self.fmtSingleQuotes[0] = nwQuotes.SINGLE[self.styleSQuote][0] - self.fmtSingleQuotes[1] = nwQuotes.SINGLE[self.styleSQuote][1] - if self.styleDQuote >= 0 and self.styleDQuote < len(nwQuotes.DOUBLE): - self.fmtDoubleQuotes[0] = nwQuotes.DOUBLE[self.styleDQuote][0] - self.fmtDoubleQuotes[1] = nwQuotes.DOUBLE[self.styleDQuote][1] + self.setSingleQuotes(self.styleSQuote) + self.setDoubleQuotes(self.styleDQuote) return True @@ -309,6 +305,22 @@ class Config: self.confChanged = True return True + def setSingleQuotes(self, quoteStyle): + if quoteStyle >= 0 and quoteStyle < len(nwQuotes.SINGLE): + self.fmtSingleQuotes[0] = nwQuotes.SINGLE[quoteStyle][0] + self.fmtSingleQuotes[1] = nwQuotes.SINGLE[quoteStyle][1] + self.styleSQuote = quoteStyle + return True + return False + + def setDoubleQuotes(self, quoteStyle): + if quoteStyle >= 0 and quoteStyle < len(nwQuotes.DOUBLE): + self.fmtDoubleQuotes[0] = nwQuotes.DOUBLE[quoteStyle][0] + self.fmtDoubleQuotes[1] = nwQuotes.DOUBLE[quoteStyle][1] + self.styleDQuote = quoteStyle + return True + return False + ## # Internal Functions ## diff --git a/nw/constants.py b/nw/constants.py index 79ec0c66..9c93901c 100644 --- a/nw/constants.py +++ b/nw/constants.py @@ -76,12 +76,20 @@ class nwQuotes(): SINGLE = [ ("'", "'", "Straight"), ("‘", "’", "English"), + ("‹", "›", "French"), + ("›", "‹", "Danish"), + ("’", "’", "Swedish"), + ("‚", "‘", "German"), + ("’", "‚", "Dutch"), ] DOUBLE = [ ("\"", "\"", "Straight"), ("“", "”", "English"), - ("«", "»", "Frensh"), + ("«", "»", "French"), ("»", "«", "Danish"), + ("”", "”", "Swedish"), + ("„", "“", "German"), + ("„", "”", "Dutch"), ] # END Class nwQuotes diff --git a/nw/gui/configeditor.py b/nw/gui/configeditor.py index 66193319..9ba93299 100644 --- a/nw/gui/configeditor.py +++ b/nw/gui/configeditor.py @@ -361,6 +361,18 @@ class GuiConfigEditEditor(QWidget): self.mainConf.textMargin[1] = textMarginV self.mainConf.tabWidth = tabWidth + doReplace = self.autoReplaceMain.isChecked() + doReplaceSQuote = self.autoReplaceSQ.isChecked() + doReplaceDQuote = self.autoReplaceDQ.isChecked() + styleSQuote = self.autoReplaceSStyle.currentData() + styleDQuote = self.autoReplaceDStyle.currentData() + + self.mainConf.doReplace = doReplace + self.mainConf.doReplaceSQuote = doReplaceSQuote + self.mainConf.doReplaceDQuote = doReplaceDQuote + self.mainConf.setSingleQuotes(styleSQuote) + self.mainConf.setDoubleQuotes(styleDQuote) + self.mainConf.confChanged = True return False