From 4b72c856c84b4e0d2e4992164e88241b66e3f8d5 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 11 Jun 2019 16:14:33 +0200 Subject: [PATCH] Added the complete list of horizontal text quote marks in unicode format from wikipedia --- nw/constants.py | 50 ++++++++++++++++++++++++++++++++++++++++++ nw/gui/configeditor.py | 13 +++-------- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/nw/constants.py b/nw/constants.py index 8a545d0c..9c56b012 100644 --- a/nw/constants.py +++ b/nw/constants.py @@ -70,3 +70,53 @@ class nwLabels(): } # END Class nwLabels + +class nwQuotes(): + """Allowed quotation marks. + Source: https://en.wikipedia.org/wiki/Quotation_mark + """ + + SYMBOLS = [ + "\u0022", # Quotation mark + "\u0027", # Apostrophe + "\u00ab", # Left-pointing double angle quotation mark + "\u00bb", # Right-pointing double angle quotation mark + "\u2018", # Left single quotation mark + "\u2019", # Right single quotation mark + "\u201a", # Single low-9 quotation mark + "\u201b", # Single high-reversed-9 quotation mark + "\u201c", # Left double quotation mark + "\u201d", # Right double quotation mark + "\u201e", # Double low-9 quotation mark + "\u201f", # Double high-reversed-9 quotation mark + "\u2039", # Single left-pointing angle quotation mark + "\u203a", # Single right-pointing angle quotation mark + "\u2e42", # Double low-reversed-9 quotation mark + "\u300c", # Left corner bracket + "\u300d", # Right corner bracket + "\u300e", # Left white corner bracket + "\u300f", # Right white corner bracket + ] + HTML = { + "\u0022" : """, + "\u0027" : "'", + "\u00ab" : "«", + "\u00bb" : "»", + "\u2018" : "‘", + "\u2019" : "’", + "\u201a" : "‚", + "\u201b" : "‛", + "\u201c" : "“", + "\u201d" : "”", + "\u201e" : "„", + "\u201f" : "‟", + "\u2039" : "‹", + "\u203a" : "›", + "\u2e42" : "⹂", + "\u300c" : "「", + "\u300d" : "」", + "\u300e" : "『", + "\u300f" : "』", + } + +# END Class nwQuotes \ No newline at end of file diff --git a/nw/gui/configeditor.py b/nw/gui/configeditor.py index d78e9990..de5dc88b 100644 --- a/nw/gui/configeditor.py +++ b/nw/gui/configeditor.py @@ -23,7 +23,8 @@ from PyQt5.QtWidgets import ( QWidget, QTabWidget, QDialogButtonBox, QSpinBox, QGroupBox, QComboBox, QMessageBox, QCheckBox, QGridLayout, QFontComboBox ) -from nw.enum import nwAlert +from nw.enum import nwAlert +from nw.constants import nwQuotes logger = logging.getLogger(__name__) @@ -460,17 +461,9 @@ class GuiConfigEditEditor(QWidget): ## def _checkQuoteSymbol(self, toCheck): - validOnes = [ - "\"","'", - "“","”","„", - "‘","’","‚", - "«","»","‹","›", - "『","』","「","」", - "《","》","〈","〉" - ] if len(toCheck) != 1: return False - if toCheck in validOnes: + if toCheck in nwQuotes.SYMBOLS: return True return False