Add more insert menu entries

This commit is contained in:
Veronica K. B. Olsen
2021-01-25 17:09:39 +01:00
parent c29e9bb68d
commit a420c1749a
5 changed files with 94 additions and 12 deletions
+10
View File
@@ -268,10 +268,13 @@ class nwUnicode:
U_RECQUO = "\u300f" # Right white corner bracket
## Punctuation
U_FGDASH = "\u2012" # Figure dash
U_ENDASH = "\u2013" # Short dash
U_EMDASH = "\u2014" # Long dash
U_HELLIP = "\u2026" # Ellipsis
U_MAPOSS = "\u02bc" # Modifier letter single apostrophe
U_PRIME = "\u2032" # Prime
U_DPRIME = "\u2033" # Double prime
## Spaces and Lines
U_NBSP = "\u00a0" # Non-breaking space
@@ -286,6 +289,8 @@ class nwUnicode:
U_CHECK = "\u2714" # Heavy check mark
U_MULT = "\u2715" # Multiplication x
U_BULL = "\u2022" # List bullet
U_FLOWER = "\u2055" # Flower punctuation mark
U_PERMIL = "\u2030" # Per mille sign
## Arrows
U_UTRI = "\u25b2" # Up-pointing triangle
@@ -322,10 +327,13 @@ class nwUnicode:
H_LWCQUO = "『"
## Punctuation
H_FGDASH = "‒"
H_ENDASH = "–"
H_EMDASH = "—"
H_HELLIP = "…"
H_MAPOSS = "ʼ"
H_PRIME = "′"
H_DPRIME = "″"
## Spaces
H_NBSP = " "
@@ -338,6 +346,8 @@ class nwUnicode:
H_CHECK = "✔"
H_MULT = "✕"
H_BULL = "•"
H_FLOWER = "⁕"
H_PERMIL = "‰"
## Arrows
H_UTRI = "▲"
+6
View File
@@ -112,6 +112,12 @@ class nwDocInsert(Enum):
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
+14 -2
View File
@@ -744,10 +744,16 @@ class GuiDocEditor(QTextEdit):
theText = nwUnicode.U_ENDASH
elif theInsert == nwDocInsert.LONG_DASH:
theText = nwUnicode.U_EMDASH
elif theInsert == nwDocInsert.ELLIPSIS:
theText = nwUnicode.U_HELLIP
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:
theText = self.typSQOpen
elif theInsert == nwDocInsert.QUOTE_RS:
@@ -756,6 +762,12 @@ class GuiDocEditor(QTextEdit):
theText = self.typDQOpen
elif theInsert == nwDocInsert.QUOTE_RD:
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:
return False
else:
+57 -9
View File
@@ -511,8 +511,8 @@ class GuiMainMenu(QMenuBar):
# Insert
self.insertMenu = self.addMenu("&Insert")
# Insert > Dashes and Dots
self.mInsDashes = self.insertMenu.addMenu("Dashes and Dots")
# Insert > Dashes
self.mInsDashes = self.insertMenu.addMenu("Dashes")
# Insert > Short Dash
self.aInsENDash = QAction("Short Dash", self)
@@ -528,12 +528,12 @@ class GuiMainMenu(QMenuBar):
self.aInsEMDash.triggered.connect(lambda: self._docInsert(nwDocInsert.LONG_DASH))
self.mInsDashes.addAction(self.aInsEMDash)
# Insert > Ellipsis
self.aInsEllipsis = QAction("Ellipsis", self)
self.aInsEllipsis.setStatusTip("Insert ellipsis")
self.aInsEllipsis.setShortcut("Ctrl+K, .")
self.aInsEllipsis.triggered.connect(lambda: self._docInsert(nwDocInsert.ELLIPSIS))
self.mInsDashes.addAction(self.aInsEllipsis)
# Insert > Figure Dash
self.aInsFigDash = QAction("Figure Dash", self)
self.aInsFigDash.setStatusTip("Insert figure dash (same width as a number character)")
self.aInsFigDash.setShortcut("Ctrl+K, ~")
self.aInsFigDash.triggered.connect(lambda: self._docInsert(nwDocInsert.FIGURE_DASH))
self.mInsDashes.addAction(self.aInsFigDash)
# Insert > Quote Marks
self.mInsQuotes = self.insertMenu.addMenu("Quote Marks")
@@ -568,11 +568,35 @@ class GuiMainMenu(QMenuBar):
# Insert > Alternative Apostrophe
self.aInsMSApos = QAction("Alternative Apostrophe", self)
self.aInsMSApos.setStatusTip("Insert unicode modifier letter single apostrophe")
self.aInsMSApos.setStatusTip("Insert modifier letter single apostrophe")
self.aInsMSApos.setShortcut("Ctrl+K, '")
self.aInsMSApos.triggered.connect(lambda: self._docInsert(nwDocInsert.MODAPOS_S))
self.mInsQuotes.addAction(self.aInsMSApos)
# Insert > Symbols
self.mInsPunct = self.insertMenu.addMenu("General Punctuation")
# Insert > Ellipsis
self.aInsEllipsis = QAction("Ellipsis", self)
self.aInsEllipsis.setStatusTip("Insert ellipsis")
self.aInsEllipsis.setShortcut("Ctrl+K, .")
self.aInsEllipsis.triggered.connect(lambda: self._docInsert(nwDocInsert.ELLIPSIS))
self.mInsPunct.addAction(self.aInsEllipsis)
# Insert > Prime
self.aInsPrime = QAction("Prime", self)
self.aInsPrime.setStatusTip("Insert a prime symbol")
self.aInsPrime.setShortcut("Ctrl+K, Ctrl+'")
self.aInsPrime.triggered.connect(lambda: self._docInsert(nwDocInsert.SINGLE_PRIME))
self.mInsPunct.addAction(self.aInsPrime)
# Insert > Double Prime
self.aInsDPrime = QAction("Double Prime", self)
self.aInsDPrime.setStatusTip("Insert a double prime symbol")
self.aInsDPrime.setShortcut("Ctrl+K, Ctrl+\"")
self.aInsDPrime.triggered.connect(lambda: self._docInsert(nwDocInsert.DOUBLE_PRIME))
self.mInsPunct.addAction(self.aInsDPrime)
# Insert > Breaks and Spaces
self.mInsBreaks = self.insertMenu.addMenu("Breaks and Spaces")
@@ -604,6 +628,30 @@ class GuiMainMenu(QMenuBar):
self.aInsThinNBSpace.triggered.connect(lambda: self._docInsert(nwDocInsert.THIN_NB_SPACE))
self.mInsBreaks.addAction(self.aInsThinNBSpace)
# Insert > Symbols
self.mInsSymbol = self.insertMenu.addMenu("Other Symbols")
# Insert > List Bullet
self.aInsBullet = QAction("List Bullet", self)
self.aInsBullet.setStatusTip("Insert a list bullet")
self.aInsBullet.setShortcut("Ctrl+K, *")
self.aInsBullet.triggered.connect(lambda: self._docInsert(nwDocInsert.LIST_BULLET))
self.mInsSymbol.addAction(self.aInsBullet)
# Insert > Flower Mark
self.aInsFlower = QAction("Flower Mark", self)
self.aInsFlower.setStatusTip("Insert a flower mark (alternative bullet)")
self.aInsFlower.setShortcut("Ctrl+K, Ctrl+*")
self.aInsFlower.triggered.connect(lambda: self._docInsert(nwDocInsert.FLOWER_MARK))
self.mInsSymbol.addAction(self.aInsFlower)
# Insert > Per Mille
self.aInsPerMille = QAction("Per Mille", self)
self.aInsPerMille.setStatusTip("Insert a per mille symbol")
self.aInsPerMille.setShortcut("Ctrl+K, %")
self.aInsPerMille.triggered.connect(lambda: self._docInsert(nwDocInsert.PER_MILLE))
self.mInsSymbol.addAction(self.aInsPerMille)
# Insert > Separator
self.insertMenu.addSeparator()
+7 -1
View File
@@ -1240,16 +1240,22 @@ class GuiMain(QMainWindow):
# Insert
self.addAction(self.mainMenu.aInsENDash)
self.addAction(self.mainMenu.aInsEMDash)
self.addAction(self.mainMenu.aInsEllipsis)
self.addAction(self.mainMenu.aInsFigDash)
self.addAction(self.mainMenu.aInsQuoteLS)
self.addAction(self.mainMenu.aInsQuoteRS)
self.addAction(self.mainMenu.aInsQuoteLD)
self.addAction(self.mainMenu.aInsQuoteRD)
self.addAction(self.mainMenu.aInsMSApos)
self.addAction(self.mainMenu.aInsEllipsis)
self.addAction(self.mainMenu.aInsPrime)
self.addAction(self.mainMenu.aInsDPrime)
self.addAction(self.mainMenu.aInsHardBreak)
self.addAction(self.mainMenu.aInsNBSpace)
self.addAction(self.mainMenu.aInsThinSpace)
self.addAction(self.mainMenu.aInsThinNBSpace)
self.addAction(self.mainMenu.aInsBullet)
self.addAction(self.mainMenu.aInsFlower)
self.addAction(self.mainMenu.aInsPerMille)
for mAction, _ in self.mainMenu.mInsKWItems.values():
self.addAction(mAction)