Merge pull request #604 from vkbo/insert_symbols

More Insert Symbols
This commit is contained in:
Veronica K. Berglyd Olsen
2021-01-26 15:09:08 +00:00
committed by GitHub
16 changed files with 204 additions and 135 deletions
+9 -4
View File
@@ -349,7 +349,6 @@ Most features are available as keyboard shortcuts. These are as follows:
":kbd:`Ctrl`:kbd:`.`", "Open menu to correct word under cursor." ":kbd:`Ctrl`:kbd:`.`", "Open menu to correct word under cursor."
":kbd:`Ctrl`:kbd:`,`", "Open the :guilabel:`Preferences` dialog." ":kbd:`Ctrl`:kbd:`,`", "Open the :guilabel:`Preferences` dialog."
":kbd:`Ctrl`:kbd:`/`", "Change block format to comment." ":kbd:`Ctrl`:kbd:`/`", "Change block format to comment."
":kbd:`Ctrl`:kbd:`-`", "Strikethrough selected text, or word under cursor."
":kbd:`Ctrl`:kbd:`0`", "Remove block formatting for block under cursor." ":kbd:`Ctrl`:kbd:`0`", "Remove block formatting for block under cursor."
":kbd:`Ctrl`:kbd:`1`", "Change block format to header level 1." ":kbd:`Ctrl`:kbd:`1`", "Change block format to header level 1."
":kbd:`Ctrl`:kbd:`2`", "Change block format to header level 2." ":kbd:`Ctrl`:kbd:`2`", "Change block format to header level 2."
@@ -358,7 +357,7 @@ Most features are available as keyboard shortcuts. These are as follows:
":kbd:`Ctrl`:kbd:`A`", "Select all text in the document." ":kbd:`Ctrl`:kbd:`A`", "Select all text in the document."
":kbd:`Ctrl`:kbd:`B`", "Format selected text, or word under cursor, with strong emphasis (bold)." ":kbd:`Ctrl`:kbd:`B`", "Format selected text, or word under cursor, with strong emphasis (bold)."
":kbd:`Ctrl`:kbd:`C`", "Copy selected text to clipboard." ":kbd:`Ctrl`:kbd:`C`", "Copy selected text to clipboard."
":kbd:`Ctrl`:kbd:`D`", "Wrap selected text, or word under cursor, in double quotes." ":kbd:`Ctrl`:kbd:`D`", "Strikethrough selected text, or word under cursor."
":kbd:`Ctrl`:kbd:`E`", "If in the project tree, edit a document or folder settings. (Same as :kbd:`F2`.)" ":kbd:`Ctrl`:kbd:`E`", "If in the project tree, edit a document or folder settings. (Same as :kbd:`F2`.)"
":kbd:`Ctrl`:kbd:`F`", "Open the search bar and search for the selected word, if any is selected." ":kbd:`Ctrl`:kbd:`F`", "Open the search bar and search for the selected word, if any is selected."
":kbd:`Ctrl`:kbd:`G`", "Find next occurrence of search word in current document. (Same as :kbd:`F3`.)" ":kbd:`Ctrl`:kbd:`G`", "Find next occurrence of search word in current document. (Same as :kbd:`F3`.)"
@@ -378,12 +377,13 @@ Most features are available as keyboard shortcuts. These are as follows:
":kbd:`Ctrl`:kbd:`F7`", "Toggle spell checking." ":kbd:`Ctrl`:kbd:`F7`", "Toggle spell checking."
":kbd:`Ctrl`:kbd:`F10`", "Toggle automatic updating of project outline." ":kbd:`Ctrl`:kbd:`F10`", "Toggle automatic updating of project outline."
":kbd:`Ctrl`:kbd:`Del`", "If in the project tree, move a document to trash, or delete a folder." ":kbd:`Ctrl`:kbd:`Del`", "If in the project tree, move a document to trash, or delete a folder."
":kbd:`Ctrl`:kbd:`'`", "Wrap selected text, or word under cursor, in single quotes."
":kbd:`Ctrl`:kbd:`""`", "Wrap selected text, or word under cursor, in double quotes."
":kbd:`Ctrl`:kbd:`Enter`", "Open the tag or reference under the cursor in the Viewer." ":kbd:`Ctrl`:kbd:`Enter`", "Open the tag or reference under the cursor in the Viewer."
":kbd:`Ctrl`:kbd:`Shift`:kbd:`,`", "Open the :guilabel:`Project Settings` dialog." ":kbd:`Ctrl`:kbd:`Shift`:kbd:`,`", "Open the :guilabel:`Project Settings` dialog."
":kbd:`Ctrl`:kbd:`Shift`:kbd:`/`", "Remove block formatting for block under cursor." ":kbd:`Ctrl`:kbd:`Shift`:kbd:`/`", "Remove block formatting for block under cursor."
":kbd:`Ctrl`:kbd:`Shift`:kbd:`1`", "Replace occurrence of search word in current document, and search for next occurrence." ":kbd:`Ctrl`:kbd:`Shift`:kbd:`1`", "Replace occurrence of search word in current document, and search for next occurrence."
":kbd:`Ctrl`:kbd:`Shift`:kbd:`A`", "Select all text in current paragraph." ":kbd:`Ctrl`:kbd:`Shift`:kbd:`A`", "Select all text in current paragraph."
":kbd:`Ctrl`:kbd:`Shift`:kbd:`D`", "Wrap selected text, or word under cursor, in single quotes."
":kbd:`Ctrl`:kbd:`Shift`:kbd:`G`", "Find previous occurrence of search word in current document. (Same as :kbd:`Shift`:kbd:`F3`.)" ":kbd:`Ctrl`:kbd:`Shift`:kbd:`G`", "Find previous occurrence of search word in current document. (Same as :kbd:`Shift`:kbd:`F3`.)"
":kbd:`Ctrl`:kbd:`Shift`:kbd:`I`", "Import text to the current document from a text file." ":kbd:`Ctrl`:kbd:`Shift`:kbd:`I`", "Import text to the current document from a text file."
":kbd:`Ctrl`:kbd:`Shift`:kbd:`N`", "Create new folder." ":kbd:`Ctrl`:kbd:`Shift`:kbd:`N`", "Create new folder."
@@ -427,8 +427,9 @@ a key or key combination for the inserted content.
:widths: 40, 60 :widths: 40, 60
:class: "tight-table" :class: "tight-table"
":kbd:`Ctrl`:kbd:`K`, :kbd:`-`", "Insert a short dash (en dash)." ":kbd:`Ctrl`:kbd:`K`, :kbd:``", "Insert a short dash (en dash)."
":kbd:`Ctrl`:kbd:`K`, :kbd:`_`", "Insert a long dash (em dash)." ":kbd:`Ctrl`:kbd:`K`, :kbd:`_`", "Insert a long dash (em dash)."
":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:`_`", "Insert a horizontal bar (quotation dash)."
":kbd:`Ctrl`:kbd:`K`, :kbd:`~`", "Insert a figure dash (same width as a number)." ":kbd:`Ctrl`:kbd:`K`, :kbd:`~`", "Insert a figure dash (same width as a number)."
":kbd:`Ctrl`:kbd:`K`, :kbd:`1`", "Insert a left single quote." ":kbd:`Ctrl`:kbd:`K`, :kbd:`1`", "Insert a left single quote."
":kbd:`Ctrl`:kbd:`K`, :kbd:`2`", "Insert a right single quote." ":kbd:`Ctrl`:kbd:`K`, :kbd:`2`", "Insert a right single quote."
@@ -443,8 +444,12 @@ a key or key combination for the inserted content.
":kbd:`Ctrl`:kbd:`K`, :kbd:`Shift`:kbd:`Space`", "Insert a thin space." ":kbd:`Ctrl`:kbd:`K`, :kbd:`Shift`:kbd:`Space`", "Insert a thin space."
":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:`Space`", "Insert a thin non-breaking space." ":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:`Space`", "Insert a thin non-breaking space."
":kbd:`Ctrl`:kbd:`K`, :kbd:`*`", "Insert a list bullet." ":kbd:`Ctrl`:kbd:`K`, :kbd:`*`", "Insert a list bullet."
":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:``", "Insert a hyphen bullet (alternative bullet)."
":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:`*`", "Insert a flower mark (alternative bullet)." ":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:`*`", "Insert a flower mark (alternative bullet)."
":kbd:`Ctrl`:kbd:`K`, :kbd:`%`", "Insert a per mille symbol." ":kbd:`Ctrl`:kbd:`K`, :kbd:`%`", "Insert a per mille symbol."
":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:`O`", "Insert a degree symbol."
":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:`X`", "Insert a times sign."
":kbd:`Ctrl`:kbd:`K`, :kbd:`Ctrl`:kbd:`D`", "Insert a division sign."
":kbd:`Ctrl`:kbd:`K`, :kbd:`G`", "Insert a ``@tag`` keyword." ":kbd:`Ctrl`:kbd:`K`, :kbd:`G`", "Insert a ``@tag`` keyword."
":kbd:`Ctrl`:kbd:`K`, :kbd:`V`", "Insert a ``@pov`` keyword." ":kbd:`Ctrl`:kbd:`K`, :kbd:`V`", "Insert a ``@pov`` keyword."
":kbd:`Ctrl`:kbd:`K`, :kbd:`C`", "Insert a ``@char`` keyword." ":kbd:`Ctrl`:kbd:`K`, :kbd:`C`", "Insert a ``@char`` keyword."
+17
View File
@@ -28,6 +28,10 @@ automatically to short and long dashes, and three dots to ellipsis. The last aut
always be reverted with the undo command :kbd:`Ctrl`:kbd:`Z`, reverting the text to what you typed always be reverted with the undo command :kbd:`Ctrl`:kbd:`Z`, reverting the text to what you typed
before the automatic replacement occurred. before the automatic replacement occurred.
The symbols are available in the :guilabel:`Insert` menu. In addition, "Figure Dash" is also
available. The Figure Dash is a dash that has the same width as the numbers of the same font, which
tend to be the same width so that numbers align nicely in columns.
Single and Double Quotes Single and Double Quotes
------------------------ ------------------------
@@ -48,6 +52,19 @@ re-format a selected section of text with the correct quote symbols.
.. _Quotation Mark: https://en.wikipedia.org/wiki/Quotation_mark .. _Quotation Mark: https://en.wikipedia.org/wiki/Quotation_mark
Single and Double Prime
------------------------
Both single and double prime symbols are available in the :guilabel:`Insert` menu. These symbols
are the correct symbols to use for unit symbols for feet, inches, minutes and seconds. The usage of
these is described in more detail on the Wikipedia Prime_ page. They look very similar to single
and double straight quotes, but may be renderred similarly by the font, but they have different
codes. Using these correctly will also prevent the auto-replace and dialogue highlighting features
to understand their meaning in the text.
.. _Prime: https://en.wikipedia.org/wiki/Prime_(symbol)
Modifier Letter Apostrophe Modifier Letter Apostrophe
-------------------------- --------------------------
+16 -2
View File
@@ -271,6 +271,7 @@ class nwUnicode:
U_FGDASH = "\u2012" # Figure dash U_FGDASH = "\u2012" # Figure dash
U_ENDASH = "\u2013" # Short dash U_ENDASH = "\u2013" # Short dash
U_EMDASH = "\u2014" # Long dash U_EMDASH = "\u2014" # Long dash
U_HBAR = "\u2015" # Horizontal bar
U_HELLIP = "\u2026" # Ellipsis U_HELLIP = "\u2026" # Ellipsis
U_MAPOSS = "\u02bc" # Modifier letter single apostrophe U_MAPOSS = "\u02bc" # Modifier letter single apostrophe
U_PRIME = "\u2032" # Prime U_PRIME = "\u2032" # Prime
@@ -287,10 +288,16 @@ class nwUnicode:
## Symbols ## Symbols
U_CHECK = "\u2714" # Heavy check mark U_CHECK = "\u2714" # Heavy check mark
U_MULT = "\u2715" # Multiplication x U_CROSS = "\u2715" # Heavy cross mark
U_BULL = "\u2022" # List bullet U_BULL = "\u2022" # List bullet
U_TRBULL = "\u2023" # Triangle bullet
U_HYBULL = "\u2043" # Hyphen bullet
U_FLOWER = "\u2055" # Flower punctuation mark U_FLOWER = "\u2055" # Flower punctuation mark
U_PERMIL = "\u2030" # Per mille sign U_PERMIL = "\u2030" # Per mille sign
U_DEGREE = "\u00b0" # Degree symbol
U_MINUS = "\u2212" # Minus sign
U_TIMES = "\u00d7" # Multiplaction sign
U_DIVIDE = "\u00f7" # Division sign
## Arrows ## Arrows
U_UTRI = "\u25b2" # Up-pointing triangle U_UTRI = "\u25b2" # Up-pointing triangle
@@ -330,6 +337,7 @@ class nwUnicode:
H_FGDASH = "‒" H_FGDASH = "‒"
H_ENDASH = "–" H_ENDASH = "–"
H_EMDASH = "—" H_EMDASH = "—"
H_HBAR = "―"
H_HELLIP = "…" H_HELLIP = "…"
H_MAPOSS = "ʼ" H_MAPOSS = "ʼ"
H_PRIME = "′" H_PRIME = "′"
@@ -344,10 +352,16 @@ class nwUnicode:
## Symbols ## Symbols
H_CHECK = "✔" H_CHECK = "✔"
H_MULT = "✕" H_CROSS = "✕"
H_BULL = "•" H_BULL = "•"
H_TRBULL = "‣"
H_HYBULL = "⁃"
H_FLOWER = "⁕" H_FLOWER = "⁕"
H_PERMIL = "‰" H_PERMIL = "‰"
H_DEGREE = "°"
H_MINUS = "−"
H_TIMES = "×"
H_DIVIDE = "÷"
## Arrows ## Arrows
H_UTRI = "▲" H_UTRI = "▲"
+4 -17
View File
@@ -101,23 +101,10 @@ class nwDocInsert(Enum):
NO_INSERT = 0 NO_INSERT = 0
HARD_BREAK = 1 HARD_BREAK = 1
NB_SPACE = 2 QUOTE_LS = 2
THIN_SPACE = 3 QUOTE_RS = 3
THIN_NB_SPACE = 4 QUOTE_LD = 4
SHORT_DASH = 5 QUOTE_RD = 5
LONG_DASH = 6
ELLIPSIS = 7
QUOTE_LS = 8
QUOTE_RS = 9
QUOTE_LD = 10
QUOTE_RD = 11
MODAPOS_S = 12
FIGURE_DASH = 13
LIST_BULLET = 14
PER_MILLE = 15
SINGLE_PRIME = 16
DOUBLE_PRIME = 17
FLOWER_MARK = 18
# END Enum nwDocInsert # END Enum nwDocInsert
+1 -1
View File
@@ -303,7 +303,7 @@ class QSwitch(QAbstractButton):
trackBrush = qPalette.dark() trackBrush = qPalette.dark()
thumbBrush = qPalette.light() thumbBrush = qPalette.light()
textColor = qPalette.dark().color() textColor = qPalette.dark().color()
thumbText = nwUnicode.U_MULT thumbText = nwUnicode.U_CROSS
if self.isEnabled(): if self.isEnabled():
trackOpacity = 1.0 trackOpacity = 1.0
-26
View File
@@ -734,26 +734,6 @@ class GuiDocEditor(QTextEdit):
elif isinstance(theInsert, nwDocInsert): elif isinstance(theInsert, nwDocInsert):
if theInsert == nwDocInsert.HARD_BREAK: if theInsert == nwDocInsert.HARD_BREAK:
theText = " \n" theText = " \n"
elif theInsert == nwDocInsert.NB_SPACE:
theText = nwUnicode.U_NBSP
elif theInsert == nwDocInsert.THIN_SPACE:
theText = nwUnicode.U_THSP
elif theInsert == nwDocInsert.THIN_NB_SPACE:
theText = nwUnicode.U_THNBSP
elif theInsert == nwDocInsert.SHORT_DASH:
theText = nwUnicode.U_ENDASH
elif theInsert == nwDocInsert.LONG_DASH:
theText = nwUnicode.U_EMDASH
elif theInsert == nwDocInsert.FIGURE_DASH:
theText = nwUnicode.U_FGDASH
elif theInsert == nwDocInsert.MODAPOS_S:
theText = nwUnicode.U_MAPOSS
elif theInsert == nwDocInsert.ELLIPSIS:
theText = nwUnicode.U_HELLIP
elif theInsert == nwDocInsert.SINGLE_PRIME:
theText = nwUnicode.U_PRIME
elif theInsert == nwDocInsert.DOUBLE_PRIME:
theText = nwUnicode.U_DPRIME
elif theInsert == nwDocInsert.QUOTE_LS: elif theInsert == nwDocInsert.QUOTE_LS:
theText = self.typSQOpen theText = self.typSQOpen
elif theInsert == nwDocInsert.QUOTE_RS: elif theInsert == nwDocInsert.QUOTE_RS:
@@ -762,12 +742,6 @@ class GuiDocEditor(QTextEdit):
theText = self.typDQOpen theText = self.typDQOpen
elif theInsert == nwDocInsert.QUOTE_RD: elif theInsert == nwDocInsert.QUOTE_RD:
theText = self.typDQClose theText = self.typDQClose
elif theInsert == nwDocInsert.LIST_BULLET:
theText = nwUnicode.U_BULL
elif theInsert == nwDocInsert.FLOWER_MARK:
theText = nwUnicode.U_FLOWER
elif theInsert == nwDocInsert.PER_MILLE:
theText = nwUnicode.U_PERMIL
else: else:
return False return False
else: else:
+62 -19
View File
@@ -32,7 +32,8 @@ from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import QMenuBar, QAction from PyQt5.QtWidgets import QMenuBar, QAction
from nw.constants import ( from nw.constants import (
nwItemType, nwItemClass, nwDocAction, nwDocInsert, nwKeyWords, nwLabels nwItemType, nwItemClass, nwDocAction, nwDocInsert, nwKeyWords, nwLabels,
nwUnicode
) )
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -516,23 +517,30 @@ class GuiMainMenu(QMenuBar):
# Insert > Short Dash # Insert > Short Dash
self.aInsENDash = QAction("Short Dash", self) self.aInsENDash = QAction("Short Dash", self)
self.aInsENDash.setStatusTip("Insert short dash") self.aInsENDash.setStatusTip("Insert short dash (en dash)")
self.aInsENDash.setShortcut("Ctrl+K, -") self.aInsENDash.setShortcut("Ctrl+K, -")
self.aInsENDash.triggered.connect(lambda: self._docInsert(nwDocInsert.SHORT_DASH)) self.aInsENDash.triggered.connect(lambda: self._docInsert(nwUnicode.U_ENDASH))
self.mInsDashes.addAction(self.aInsENDash) self.mInsDashes.addAction(self.aInsENDash)
# Insert > Long Dash # Insert > Long Dash
self.aInsEMDash = QAction("Long Dash", self) self.aInsEMDash = QAction("Long Dash", self)
self.aInsEMDash.setStatusTip("Insert long dash") self.aInsEMDash.setStatusTip("Insert long dash (em dash)")
self.aInsEMDash.setShortcut("Ctrl+K, _") self.aInsEMDash.setShortcut("Ctrl+K, _")
self.aInsEMDash.triggered.connect(lambda: self._docInsert(nwDocInsert.LONG_DASH)) self.aInsEMDash.triggered.connect(lambda: self._docInsert(nwUnicode.U_EMDASH))
self.mInsDashes.addAction(self.aInsEMDash) self.mInsDashes.addAction(self.aInsEMDash)
# Insert > Long Dash
self.aInsHorBar = QAction("Horizontal Bar", self)
self.aInsHorBar.setStatusTip("Insert a horizontal bar (quotation dash)")
self.aInsHorBar.setShortcut("Ctrl+K, Ctrl+_")
self.aInsHorBar.triggered.connect(lambda: self._docInsert(nwUnicode.U_HBAR))
self.mInsDashes.addAction(self.aInsHorBar)
# Insert > Figure Dash # Insert > Figure Dash
self.aInsFigDash = QAction("Figure Dash", self) self.aInsFigDash = QAction("Figure Dash", self)
self.aInsFigDash.setStatusTip("Insert figure dash (same width as a number character)") self.aInsFigDash.setStatusTip("Insert figure dash (same width as a number character)")
self.aInsFigDash.setShortcut("Ctrl+K, ~") self.aInsFigDash.setShortcut("Ctrl+K, ~")
self.aInsFigDash.triggered.connect(lambda: self._docInsert(nwDocInsert.FIGURE_DASH)) self.aInsFigDash.triggered.connect(lambda: self._docInsert(nwUnicode.U_FGDASH))
self.mInsDashes.addAction(self.aInsFigDash) self.mInsDashes.addAction(self.aInsFigDash)
# Insert > Quote Marks # Insert > Quote Marks
@@ -570,7 +578,7 @@ class GuiMainMenu(QMenuBar):
self.aInsMSApos = QAction("Alternative Apostrophe", self) self.aInsMSApos = QAction("Alternative Apostrophe", self)
self.aInsMSApos.setStatusTip("Insert modifier letter single apostrophe") self.aInsMSApos.setStatusTip("Insert modifier letter single apostrophe")
self.aInsMSApos.setShortcut("Ctrl+K, '") self.aInsMSApos.setShortcut("Ctrl+K, '")
self.aInsMSApos.triggered.connect(lambda: self._docInsert(nwDocInsert.MODAPOS_S)) self.aInsMSApos.triggered.connect(lambda: self._docInsert(nwUnicode.U_MAPOSS))
self.mInsQuotes.addAction(self.aInsMSApos) self.mInsQuotes.addAction(self.aInsMSApos)
# Insert > Symbols # Insert > Symbols
@@ -580,21 +588,21 @@ class GuiMainMenu(QMenuBar):
self.aInsEllipsis = QAction("Ellipsis", self) self.aInsEllipsis = QAction("Ellipsis", self)
self.aInsEllipsis.setStatusTip("Insert ellipsis") self.aInsEllipsis.setStatusTip("Insert ellipsis")
self.aInsEllipsis.setShortcut("Ctrl+K, .") self.aInsEllipsis.setShortcut("Ctrl+K, .")
self.aInsEllipsis.triggered.connect(lambda: self._docInsert(nwDocInsert.ELLIPSIS)) self.aInsEllipsis.triggered.connect(lambda: self._docInsert(nwUnicode.U_HELLIP))
self.mInsPunct.addAction(self.aInsEllipsis) self.mInsPunct.addAction(self.aInsEllipsis)
# Insert > Prime # Insert > Prime
self.aInsPrime = QAction("Prime", self) self.aInsPrime = QAction("Prime", self)
self.aInsPrime.setStatusTip("Insert a prime symbol") self.aInsPrime.setStatusTip("Insert a prime symbol")
self.aInsPrime.setShortcut("Ctrl+K, Ctrl+'") self.aInsPrime.setShortcut("Ctrl+K, Ctrl+'")
self.aInsPrime.triggered.connect(lambda: self._docInsert(nwDocInsert.SINGLE_PRIME)) self.aInsPrime.triggered.connect(lambda: self._docInsert(nwUnicode.U_PRIME))
self.mInsPunct.addAction(self.aInsPrime) self.mInsPunct.addAction(self.aInsPrime)
# Insert > Double Prime # Insert > Double Prime
self.aInsDPrime = QAction("Double Prime", self) self.aInsDPrime = QAction("Double Prime", self)
self.aInsDPrime.setStatusTip("Insert a double prime symbol") self.aInsDPrime.setStatusTip("Insert a double prime symbol")
self.aInsDPrime.setShortcut("Ctrl+K, Ctrl+\"") self.aInsDPrime.setShortcut("Ctrl+K, Ctrl+\"")
self.aInsDPrime.triggered.connect(lambda: self._docInsert(nwDocInsert.DOUBLE_PRIME)) self.aInsDPrime.triggered.connect(lambda: self._docInsert(nwUnicode.U_DPRIME))
self.mInsPunct.addAction(self.aInsDPrime) self.mInsPunct.addAction(self.aInsDPrime)
# Insert > Breaks and Spaces # Insert > Breaks and Spaces
@@ -611,21 +619,21 @@ class GuiMainMenu(QMenuBar):
self.aInsNBSpace = QAction("Non-Breaking Space", self) self.aInsNBSpace = QAction("Non-Breaking Space", self)
self.aInsNBSpace.setStatusTip("Insert a non-breaking space") self.aInsNBSpace.setStatusTip("Insert a non-breaking space")
self.aInsNBSpace.setShortcut("Ctrl+K, Space") self.aInsNBSpace.setShortcut("Ctrl+K, Space")
self.aInsNBSpace.triggered.connect(lambda: self._docInsert(nwDocInsert.NB_SPACE)) self.aInsNBSpace.triggered.connect(lambda: self._docInsert(nwUnicode.U_NBSP))
self.mInsBreaks.addAction(self.aInsNBSpace) self.mInsBreaks.addAction(self.aInsNBSpace)
# Insert > Thin Space # Insert > Thin Space
self.aInsThinSpace = QAction("Thin Space", self) self.aInsThinSpace = QAction("Thin Space", self)
self.aInsThinSpace.setStatusTip("Insert a thin space") self.aInsThinSpace.setStatusTip("Insert a thin space")
self.aInsThinSpace.setShortcut("Ctrl+K, Shift+Space") self.aInsThinSpace.setShortcut("Ctrl+K, Shift+Space")
self.aInsThinSpace.triggered.connect(lambda: self._docInsert(nwDocInsert.THIN_SPACE)) self.aInsThinSpace.triggered.connect(lambda: self._docInsert(nwUnicode.U_THSP))
self.mInsBreaks.addAction(self.aInsThinSpace) self.mInsBreaks.addAction(self.aInsThinSpace)
# Insert > Thin Non-Breaking Space # Insert > Thin Non-Breaking Space
self.aInsThinNBSpace = QAction("Thin Non-Breaking Space", self) self.aInsThinNBSpace = QAction("Thin Non-Breaking Space", self)
self.aInsThinNBSpace.setStatusTip("Insert a thin non-breaking space") self.aInsThinNBSpace.setStatusTip("Insert a thin non-breaking space")
self.aInsThinNBSpace.setShortcut("Ctrl+K, Ctrl+Space") self.aInsThinNBSpace.setShortcut("Ctrl+K, Ctrl+Space")
self.aInsThinNBSpace.triggered.connect(lambda: self._docInsert(nwDocInsert.THIN_NB_SPACE)) self.aInsThinNBSpace.triggered.connect(lambda: self._docInsert(nwUnicode.U_THNBSP))
self.mInsBreaks.addAction(self.aInsThinNBSpace) self.mInsBreaks.addAction(self.aInsThinNBSpace)
# Insert > Symbols # Insert > Symbols
@@ -635,23 +643,58 @@ class GuiMainMenu(QMenuBar):
self.aInsBullet = QAction("List Bullet", self) self.aInsBullet = QAction("List Bullet", self)
self.aInsBullet.setStatusTip("Insert a list bullet") self.aInsBullet.setStatusTip("Insert a list bullet")
self.aInsBullet.setShortcut("Ctrl+K, *") self.aInsBullet.setShortcut("Ctrl+K, *")
self.aInsBullet.triggered.connect(lambda: self._docInsert(nwDocInsert.LIST_BULLET)) self.aInsBullet.triggered.connect(lambda: self._docInsert(nwUnicode.U_BULL))
self.mInsSymbol.addAction(self.aInsBullet) self.mInsSymbol.addAction(self.aInsBullet)
# Insert > Hyphen Bullet
self.aInsHyBull = QAction("Hyphen Bullet", self)
self.aInsHyBull.setStatusTip("Insert a hyphen bullet (alternative bullet)")
self.aInsHyBull.setShortcut("Ctrl+K, Ctrl+-")
self.aInsHyBull.triggered.connect(lambda: self._docInsert(nwUnicode.U_HYBULL))
self.mInsSymbol.addAction(self.aInsHyBull)
# Insert > Flower Mark # Insert > Flower Mark
self.aInsFlower = QAction("Flower Mark", self) self.aInsFlower = QAction("Flower Mark", self)
self.aInsFlower.setStatusTip("Insert a flower mark (alternative bullet)") self.aInsFlower.setStatusTip("Insert a flower mark (alternative bullet)")
self.aInsFlower.setShortcut("Ctrl+K, Ctrl+*") self.aInsFlower.setShortcut("Ctrl+K, Ctrl+*")
self.aInsFlower.triggered.connect(lambda: self._docInsert(nwDocInsert.FLOWER_MARK)) self.aInsFlower.triggered.connect(lambda: self._docInsert(nwUnicode.U_FLOWER))
self.mInsSymbol.addAction(self.aInsFlower) self.mInsSymbol.addAction(self.aInsFlower)
# Insert > Per Mille # Insert > Per Mille
self.aInsPerMille = QAction("Per Mille", self) self.aInsPerMille = QAction("Per Mille", self)
self.aInsPerMille.setStatusTip("Insert a per mille symbol") self.aInsPerMille.setStatusTip("Insert a per mille symbol")
self.aInsPerMille.setShortcut("Ctrl+K, %") self.aInsPerMille.setShortcut("Ctrl+K, %")
self.aInsPerMille.triggered.connect(lambda: self._docInsert(nwDocInsert.PER_MILLE)) self.aInsPerMille.triggered.connect(lambda: self._docInsert(nwUnicode.U_PERMIL))
self.mInsSymbol.addAction(self.aInsPerMille) self.mInsSymbol.addAction(self.aInsPerMille)
# Insert > Degree Symbol
self.aInsDegree = QAction("Degree Symbol", self)
self.aInsDegree.setStatusTip("Insert a degree symbol")
self.aInsDegree.setShortcut("Ctrl+K, Ctrl+O")
self.aInsDegree.triggered.connect(lambda: self._docInsert(nwUnicode.U_DEGREE))
self.mInsSymbol.addAction(self.aInsDegree)
# Insert > Minus Sign
self.aInsMinus = QAction("Minus Sign", self)
self.aInsMinus.setStatusTip("Insert a minus sign (not a hypen or dash)")
self.aInsMinus.setShortcut("Ctrl+K, Ctrl+M")
self.aInsMinus.triggered.connect(lambda: self._docInsert(nwUnicode.U_MINUS))
self.mInsSymbol.addAction(self.aInsMinus)
# Insert > Times Sign
self.aInsTimes = QAction("Times Sign", self)
self.aInsTimes.setStatusTip("Insert a times sign (multiplication cross)")
self.aInsTimes.setShortcut("Ctrl+K, Ctrl+X")
self.aInsTimes.triggered.connect(lambda: self._docInsert(nwUnicode.U_TIMES))
self.mInsSymbol.addAction(self.aInsTimes)
# Insert > Division
self.aInsDivide = QAction("Division Sign", self)
self.aInsDivide.setStatusTip("Insert a division sign")
self.aInsDivide.setShortcut("Ctrl+K, Ctrl+D")
self.aInsDivide.triggered.connect(lambda: self._docInsert(nwUnicode.U_DIVIDE))
self.mInsSymbol.addAction(self.aInsDivide)
# Insert > Separator # Insert > Separator
self.insertMenu.addSeparator() self.insertMenu.addSeparator()
@@ -752,7 +795,7 @@ class GuiMainMenu(QMenuBar):
# Format > Strikethrough # Format > Strikethrough
self.aFmtStrike = QAction("Strikethrough", self) self.aFmtStrike = QAction("Strikethrough", self)
self.aFmtStrike.setStatusTip("Add strikethrough to selected text") self.aFmtStrike.setStatusTip("Add strikethrough to selected text")
self.aFmtStrike.setShortcut("Ctrl+-") self.aFmtStrike.setShortcut("Ctrl+D")
self.aFmtStrike.triggered.connect(lambda: self._docAction(nwDocAction.STRIKE)) self.aFmtStrike.triggered.connect(lambda: self._docAction(nwDocAction.STRIKE))
self.fmtMenu.addAction(self.aFmtStrike) self.fmtMenu.addAction(self.aFmtStrike)
@@ -762,14 +805,14 @@ class GuiMainMenu(QMenuBar):
# Format > Double Quotes # Format > Double Quotes
self.aFmtDQuote = QAction("Wrap Double Quotes", self) self.aFmtDQuote = QAction("Wrap Double Quotes", self)
self.aFmtDQuote.setStatusTip("Wrap selected text in double quotes") self.aFmtDQuote.setStatusTip("Wrap selected text in double quotes")
self.aFmtDQuote.setShortcut("Ctrl+D") self.aFmtDQuote.setShortcut("Ctrl+\"")
self.aFmtDQuote.triggered.connect(lambda: self._docAction(nwDocAction.D_QUOTE)) self.aFmtDQuote.triggered.connect(lambda: self._docAction(nwDocAction.D_QUOTE))
self.fmtMenu.addAction(self.aFmtDQuote) self.fmtMenu.addAction(self.aFmtDQuote)
# Format > Single Quotes # Format > Single Quotes
self.aFmtSQuote = QAction("Wrap Single Quotes", self) self.aFmtSQuote = QAction("Wrap Single Quotes", self)
self.aFmtSQuote.setStatusTip("Wrap selected text in single quotes") self.aFmtSQuote.setStatusTip("Wrap selected text in single quotes")
self.aFmtSQuote.setShortcut("Ctrl+Shift+D") self.aFmtSQuote.setShortcut("Ctrl+'")
self.aFmtSQuote.triggered.connect(lambda: self._docAction(nwDocAction.S_QUOTE)) self.aFmtSQuote.triggered.connect(lambda: self._docAction(nwDocAction.S_QUOTE))
self.fmtMenu.addAction(self.aFmtSQuote) self.fmtMenu.addAction(self.aFmtSQuote)
+2 -3
View File
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""novelWriter GUI Project Details """
novelWriter GUI Project Details novelWriter GUI Project Details
=================================== =================================
Class holding the project details dialog Class holding the project details dialog
File History: File History:
+6
View File
@@ -1240,6 +1240,7 @@ class GuiMain(QMainWindow):
# Insert # Insert
self.addAction(self.mainMenu.aInsENDash) self.addAction(self.mainMenu.aInsENDash)
self.addAction(self.mainMenu.aInsEMDash) self.addAction(self.mainMenu.aInsEMDash)
self.addAction(self.mainMenu.aInsHorBar)
self.addAction(self.mainMenu.aInsFigDash) self.addAction(self.mainMenu.aInsFigDash)
self.addAction(self.mainMenu.aInsQuoteLS) self.addAction(self.mainMenu.aInsQuoteLS)
self.addAction(self.mainMenu.aInsQuoteRS) self.addAction(self.mainMenu.aInsQuoteRS)
@@ -1254,8 +1255,13 @@ class GuiMain(QMainWindow):
self.addAction(self.mainMenu.aInsThinSpace) self.addAction(self.mainMenu.aInsThinSpace)
self.addAction(self.mainMenu.aInsThinNBSpace) self.addAction(self.mainMenu.aInsThinNBSpace)
self.addAction(self.mainMenu.aInsBullet) self.addAction(self.mainMenu.aInsBullet)
self.addAction(self.mainMenu.aInsHyBull)
self.addAction(self.mainMenu.aInsFlower) self.addAction(self.mainMenu.aInsFlower)
self.addAction(self.mainMenu.aInsPerMille) self.addAction(self.mainMenu.aInsPerMille)
self.addAction(self.mainMenu.aInsDegree)
self.addAction(self.mainMenu.aInsMinus)
self.addAction(self.mainMenu.aInsTimes)
self.addAction(self.mainMenu.aInsDivide)
for mAction, _ in self.mainMenu.mInsKWItems.values(): for mAction, _ in self.mainMenu.mInsKWItems.values():
self.addAction(mAction) self.addAction(mAction)
@@ -5,7 +5,7 @@
"authors": [ "authors": [
"lipsum.com" "lipsum.com"
], ],
"buildTime": 1611491561 "buildTime": 1611662802
}, },
"text": { "text": {
"css": [ "css": [
+24
View File
@@ -392,6 +392,10 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
assert nwGUI.docEditor.getText() == nwUnicode.U_EMDASH assert nwGUI.docEditor.getText() == nwUnicode.U_EMDASH
nwGUI.docEditor.clear() nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsHorBar.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_HBAR
nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsFigDash.activate(QAction.Trigger) nwGUI.mainMenu.aInsFigDash.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_FGDASH assert nwGUI.docEditor.getText() == nwUnicode.U_FGDASH
nwGUI.docEditor.clear() nwGUI.docEditor.clear()
@@ -432,6 +436,10 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
assert nwGUI.docEditor.getText() == nwUnicode.U_BULL assert nwGUI.docEditor.getText() == nwUnicode.U_BULL
nwGUI.docEditor.clear() nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsHyBull.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_HYBULL
nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsFlower.activate(QAction.Trigger) nwGUI.mainMenu.aInsFlower.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_FLOWER assert nwGUI.docEditor.getText() == nwUnicode.U_FLOWER
nwGUI.docEditor.clear() nwGUI.docEditor.clear()
@@ -440,6 +448,22 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
assert nwGUI.docEditor.getText() == nwUnicode.U_PERMIL assert nwGUI.docEditor.getText() == nwUnicode.U_PERMIL
nwGUI.docEditor.clear() nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsDegree.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_DEGREE
nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsMinus.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_MINUS
nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsTimes.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_TIMES
nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsDivide.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_DIVIDE
nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsHardBreak.activate(QAction.Trigger) nwGUI.mainMenu.aInsHardBreak.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == " \n" assert nwGUI.docEditor.getText() == " \n"
nwGUI.docEditor.clear() nwGUI.docEditor.clear()