From 95e03d26842106d88160820f4cc910899cf77378 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 25 Jan 2021 23:45:11 +0100 Subject: [PATCH] Add triangle and hyphen bullets --- nw/constants/constants.py | 4 ++++ nw/gui/mainmenu.py | 14 ++++++++++++++ nw/guimain.py | 2 ++ tests/test_gui/test_gui_mainmenu.py | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/nw/constants/constants.py b/nw/constants/constants.py index 8bafd764..4f481e1e 100644 --- a/nw/constants/constants.py +++ b/nw/constants/constants.py @@ -289,6 +289,8 @@ class nwUnicode: U_CHECK = "\u2714" # Heavy check mark U_CROSS = "\u2715" # Heavy cross mark U_BULL = "\u2022" # List bullet + U_TRBULL = "\u2023" # Triangle bullet + U_HYBULL = "\u2043" # Hyphen bullet U_FLOWER = "\u2055" # Flower punctuation mark U_PERMIL = "\u2030" # Per mille sign U_DEGREE = "\u00b0" # Degree symbol @@ -349,6 +351,8 @@ class nwUnicode: H_CHECK = "✔" H_MULT = "✕" H_BULL = "•" + H_TRBULL = "‣" + H_HYBULL = "⁃" H_FLOWER = "⁕" H_PERMIL = "‰" H_DEGREE = "°" diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index 924a67a1..eb5dbbf5 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -639,6 +639,20 @@ class GuiMainMenu(QMenuBar): self.aInsBullet.triggered.connect(lambda: self._docInsert(nwUnicode.U_BULL)) self.mInsSymbol.addAction(self.aInsBullet) + # Insert > Triangle Bullet + self.aInsTriBull = QAction("Triangle Bullet", self) + self.aInsTriBull.setStatusTip("Insert a triangle bullet (alternative bullet)") + self.aInsTriBull.setShortcut("Ctrl+K, Ctrl+T") + self.aInsTriBull.triggered.connect(lambda: self._docInsert(nwUnicode.U_TRBULL)) + self.mInsSymbol.addAction(self.aInsTriBull) + + # 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 self.aInsFlower = QAction("Flower Mark", self) self.aInsFlower.setStatusTip("Insert a flower mark (alternative bullet)") diff --git a/nw/guimain.py b/nw/guimain.py index 30db5b32..86b5ec76 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -1254,6 +1254,8 @@ class GuiMain(QMainWindow): self.addAction(self.mainMenu.aInsThinSpace) self.addAction(self.mainMenu.aInsThinNBSpace) self.addAction(self.mainMenu.aInsBullet) + self.addAction(self.mainMenu.aInsTriBull) + self.addAction(self.mainMenu.aInsHyBull) self.addAction(self.mainMenu.aInsFlower) self.addAction(self.mainMenu.aInsPerMille) self.addAction(self.mainMenu.aInsDegree) diff --git a/tests/test_gui/test_gui_mainmenu.py b/tests/test_gui/test_gui_mainmenu.py index 0feac816..fa0fc723 100644 --- a/tests/test_gui/test_gui_mainmenu.py +++ b/tests/test_gui/test_gui_mainmenu.py @@ -432,6 +432,14 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj): assert nwGUI.docEditor.getText() == nwUnicode.U_BULL nwGUI.docEditor.clear() + nwGUI.mainMenu.aInsTriBull.activate(QAction.Trigger) + assert nwGUI.docEditor.getText() == nwUnicode.U_TRBULL + 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) assert nwGUI.docEditor.getText() == nwUnicode.U_FLOWER nwGUI.docEditor.clear()