Add some more unicode constants and rename thin non-breaking space variable

This commit is contained in:
Veronica K. B. Olsen
2021-01-13 23:52:09 +01:00
parent 5f17b28e05
commit f6b7a35c81
5 changed files with 13 additions and 9 deletions
+3 -3
View File
@@ -152,11 +152,11 @@ def formatInt(theInt):
theVal /= 1000.0 theVal /= 1000.0
if theVal < 1000.0: if theVal < 1000.0:
if theVal < 10.0: if theVal < 10.0:
return f"{theVal:4.2f}{nwUnicode.U_THNSP}{pF}" return f"{theVal:4.2f}{nwUnicode.U_THSP}{pF}"
elif theVal < 100.0: elif theVal < 100.0:
return f"{theVal:4.1f}{nwUnicode.U_THNSP}{pF}" return f"{theVal:4.1f}{nwUnicode.U_THSP}{pF}"
else: else:
return f"{theVal:3.0f}{nwUnicode.U_THNSP}{pF}" return f"{theVal:3.0f}{nwUnicode.U_THSP}{pF}"
return str(theInt) return str(theInt)
+7 -3
View File
@@ -241,7 +241,7 @@ class nwQuotes():
# END Class nwQuotes # END Class nwQuotes
class nwUnicode: class nwUnicode:
"""Supported unicode character constants and translation maps for HTML. """Supported unicode character constants and their HTML equivalents.
""" """
# Unicode Constants # Unicode Constants
@@ -276,8 +276,10 @@ class nwUnicode:
## Spaces and Lines ## Spaces and Lines
U_NBSP = "\u00a0" # Non-breaking space U_NBSP = "\u00a0" # Non-breaking space
U_THNSP = "\u2009" # Thin space U_THSP = "\u2009" # Thin space
U_THNBSP = "\u202f" # Thin non-breaking space U_THNBSP = "\u202f" # Thin non-breaking space
U_ENSP = "\u2002" # Short (en) space
U_EMSP = "\u2003" # Long (em) space
U_LSEP = "\u2028" # Line separator U_LSEP = "\u2028" # Line separator
U_PSEP = "\u2029" # Paragraph separator U_PSEP = "\u2029" # Paragraph separator
@@ -328,8 +330,10 @@ class nwUnicode:
## Spaces ## Spaces
H_NBSP = "&nbsp;" H_NBSP = "&nbsp;"
H_THNSP = "&thinsp;" H_THSP = "&thinsp;"
H_THNBSP = "&#8239;" H_THNBSP = "&#8239;"
H_ENSP = "&ensp;"
H_EMSP = "&emsp;"
## Symbols ## Symbols
H_CHECK = "&#10004;" H_CHECK = "&#10004;"
+1 -1
View File
@@ -53,7 +53,7 @@ class ToHtml(Tokenizer):
nwUnicode.U_EMDASH : nwUnicode.H_EMDASH, nwUnicode.U_EMDASH : nwUnicode.H_EMDASH,
nwUnicode.U_HELLIP : nwUnicode.H_HELLIP, nwUnicode.U_HELLIP : nwUnicode.H_HELLIP,
nwUnicode.U_NBSP : nwUnicode.H_NBSP, nwUnicode.U_NBSP : nwUnicode.H_NBSP,
nwUnicode.U_THNSP : nwUnicode.H_THNSP, nwUnicode.U_THSP : nwUnicode.H_THSP,
nwUnicode.U_THNBSP : nwUnicode.H_THNBSP, nwUnicode.U_THNBSP : nwUnicode.H_THNBSP,
nwUnicode.U_MAPOSS : nwUnicode.H_RSQUO, nwUnicode.U_MAPOSS : nwUnicode.H_RSQUO,
} }
+1 -1
View File
@@ -734,7 +734,7 @@ class GuiDocEditor(QTextEdit):
elif theInsert == nwDocInsert.NB_SPACE: elif theInsert == nwDocInsert.NB_SPACE:
theText = nwUnicode.U_NBSP theText = nwUnicode.U_NBSP
elif theInsert == nwDocInsert.THIN_SPACE: elif theInsert == nwDocInsert.THIN_SPACE:
theText = nwUnicode.U_THNSP theText = nwUnicode.U_THSP
elif theInsert == nwDocInsert.THIN_NB_SPACE: elif theInsert == nwDocInsert.THIN_NB_SPACE:
theText = nwUnicode.U_THNBSP theText = nwUnicode.U_THNBSP
elif theInsert == nwDocInsert.SHORT_DASH: elif theInsert == nwDocInsert.SHORT_DASH:
+1 -1
View File
@@ -410,7 +410,7 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
nwGUI.docEditor.clear() nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsThinSpace.activate(QAction.Trigger) nwGUI.mainMenu.aInsThinSpace.activate(QAction.Trigger)
assert nwGUI.docEditor.getText() == nwUnicode.U_THNSP assert nwGUI.docEditor.getText() == nwUnicode.U_THSP
nwGUI.docEditor.clear() nwGUI.docEditor.clear()
nwGUI.mainMenu.aInsThinNBSpace.activate(QAction.Trigger) nwGUI.mainMenu.aInsThinNBSpace.activate(QAction.Trigger)