Add menu entry and update tests

This commit is contained in:
Veronica Berglyd Olsen
2024-03-12 18:12:47 +01:00
parent 44721fc797
commit 1bd82954c2
7 changed files with 76 additions and 16 deletions
+16 -15
View File
@@ -112,21 +112,22 @@ class nwDocAction(Enum):
BLOCK_TXT = 19
BLOCK_TTL = 20
BLOCK_UNN = 21
REPL_SNG = 22
REPL_DBL = 23
RM_BREAKS = 24
ALIGN_L = 25
ALIGN_C = 26
ALIGN_R = 27
INDENT_L = 28
INDENT_R = 29
SC_ITALIC = 30
SC_BOLD = 31
SC_STRIKE = 32
SC_ULINE = 33
SC_MARK = 34
SC_SUP = 35
SC_SUB = 36
BLOCK_HSC = 22
REPL_SNG = 23
REPL_DBL = 24
RM_BREAKS = 25
ALIGN_L = 26
ALIGN_C = 27
ALIGN_R = 28
INDENT_L = 29
INDENT_R = 30
SC_ITALIC = 31
SC_BOLD = 32
SC_STRIKE = 33
SC_ULINE = 34
SC_MARK = 35
SC_SUP = 36
SC_SUB = 37
# END Enum nwDocAction
+5
View File
@@ -744,6 +744,8 @@ class GuiDocEditor(QPlainTextEdit):
self._formatBlock(nwDocAction.BLOCK_TTL)
elif action == nwDocAction.BLOCK_UNN:
self._formatBlock(nwDocAction.BLOCK_UNN)
elif action == nwDocAction.BLOCK_HSC:
self._formatBlock(nwDocAction.BLOCK_HSC)
elif action == nwDocAction.REPL_SNG:
self._replaceQuotes("'", self._typSQuoteO, self._typSQuoteC)
elif action == nwDocAction.REPL_DBL:
@@ -1705,6 +1707,9 @@ class GuiDocEditor(QPlainTextEdit):
elif action == nwDocAction.BLOCK_UNN:
text = f"##! {temp}"
offset -= 4
elif action == nwDocAction.BLOCK_HSC:
text = f"###! {temp}"
offset -= 5
elif action == nwDocAction.ALIGN_L:
text = f"{temp} <<"
elif action == nwDocAction.ALIGN_C:
+6
View File
@@ -735,6 +735,12 @@ class GuiMainMenu(QMenuBar):
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_UNN)
)
# Format > Hard Scene
self.aFmtHardSc = self.fmtMenu.addAction(self.tr("Hard Scene"))
self.aFmtHardSc.triggered.connect(
lambda: self.requestDocAction.emit(nwDocAction.BLOCK_HSC)
)
# Format > Separator
self.fmtMenu.addSeparator()