diff --git a/docs/source/usage_interface.rst b/docs/source/usage_interface.rst index f8c419a1..e9d9c4ae 100644 --- a/docs/source/usage_interface.rst +++ b/docs/source/usage_interface.rst @@ -377,9 +377,10 @@ Most features are available as keyboard shortcuts. These are as follows: ":kbd:`Ctrl`:kbd:`Z`", "Undo latest changes." ":kbd:`Ctrl`:kbd:`F7`", "Toggle spell checking." ":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:`Up`", "Move item one step up in the project tree." ":kbd:`Ctrl`:kbd:`Down`", "Move item one step down in the project tree." + ":kbd:`Ctrl`:kbd:`Del`", "Delete next word in editor." + ":kbd:`Ctrl`:kbd:`Backspace`", "Delete previous word in editor." ":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." @@ -395,6 +396,7 @@ Most features are available as keyboard shortcuts. These are as follows: ":kbd:`Ctrl`:kbd:`Shift`:kbd:`S`", "Save the current project." ":kbd:`Ctrl`:kbd:`Shift`:kbd:`W`", "Close the current project." ":kbd:`Ctrl`:kbd:`Shift`:kbd:`Z`", "Undo move of project tree item." + ":kbd:`Ctrl`:kbd:`Shift`:kbd:`Del`", "If in the project tree, move a document to trash, or delete a folder." ":kbd:`F1`", "Open the documentation. This will either open the Qt Assistant, if available, or send you to the documentation website." ":kbd:`F2`", "If in the project tree, edit a document or folder settings. (Same as :kbd:`Ctrl`:kbd:`E`)" ":kbd:`F3`", "Find next occurrence of search word in current document. (Same as :kbd:`Ctrl`:kbd:`G`)" diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index e91679ef..4cf4960a 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -269,7 +269,7 @@ class GuiMainMenu(QMenuBar): # Project > Delete self.aDeleteItem = QAction("Delete Item", self) self.aDeleteItem.setStatusTip("Delete selected project item") - self.aDeleteItem.setShortcut("Ctrl+Del") + self.aDeleteItem.setShortcut("Ctrl+Shift+Del") self.aDeleteItem.triggered.connect(lambda: self.theParent.treeView.deleteItem(None)) self.projMenu.addAction(self.aDeleteItem) diff --git a/nw/gui/projtree.py b/nw/gui/projtree.py index a2e7c7b0..eff1ae7c 100644 --- a/nw/gui/projtree.py +++ b/nw/gui/projtree.py @@ -451,7 +451,7 @@ class GuiProjectTree(QTreeWidget): for tHandle in self.getTreeFromHandle(trashHandle): if tHandle == trashHandle: continue - self.deleteItem(tHandle, True) + self.deleteItem(tHandle, alreadyAsked=True) if nTrash > 0: self._setTreeChanged(True) diff --git a/nw/gui/writingstats.py b/nw/gui/writingstats.py index c225762a..dec1fef4 100644 --- a/nw/gui/writingstats.py +++ b/nw/gui/writingstats.py @@ -215,7 +215,7 @@ class GuiWritingStats(QDialog): self.filterForm.addWidget(QLabel("Hide zero word count"), 2, 0) self.filterForm.addWidget(QLabel("Hide negative word count"), 3, 0) self.filterForm.addWidget(QLabel("Group entries by day"), 4, 0) - self.filterForm.addWidget(QLabel("Show idle time column"), 5, 0) + self.filterForm.addWidget(QLabel("Show idle time"), 5, 0) self.filterForm.addWidget(self.incNovel, 0, 1) self.filterForm.addWidget(self.incNotes, 1, 1) self.filterForm.addWidget(self.hideZeros, 2, 1) diff --git a/nw/guimain.py b/nw/guimain.py index c72c6d46..cb2756cc 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -800,7 +800,11 @@ class GuiMain(QMainWindow): return False if tHandle is None: - tHandle = self.treeView.getSelectedHandle() + if self.treeView.hasFocus(): + tHandle = self.treeView.getSelectedHandle() + elif self.docEditor.hasFocus(): + tHandle = self.docEditor.theHandle + if tHandle is None: logger.warning("No item selected") return diff --git a/tests/test_gui/test_gui_itemeditor.py b/tests/test_gui/test_gui_itemeditor.py index 453aac68..aacdd4b7 100644 --- a/tests/test_gui/test_gui_itemeditor.py +++ b/tests/test_gui/test_gui_itemeditor.py @@ -28,7 +28,7 @@ from tools import cmpFiles, getGuiItem from PyQt5.QtWidgets import QAction, QMessageBox -from nw.gui import GuiItemEditor +from nw.gui import GuiItemEditor, GuiProjectTree from nw.constants import nwItemLayout keyDelay = 2 @@ -45,6 +45,7 @@ def testGuiItemEditor_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, # Block message box monkeypatch.setattr(QMessageBox, "question", lambda *args: QMessageBox.Yes) + monkeypatch.setattr(GuiProjectTree, "hasFocus", lambda *args: True) # Create new, save, open project nwGUI.theProject.projTree.setSeed(42)