Revert last commit and instead change delete item shortcut

This commit is contained in:
Veronica K. B. Olsen
2021-02-11 19:27:35 +01:00
parent 08651685d4
commit 525c9c8fd8
5 changed files with 8 additions and 20 deletions
+3 -1
View File
@@ -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:`Z`", "Undo latest changes."
":kbd:`Ctrl`:kbd:`F7`", "Toggle spell checking." ":kbd:`Ctrl`:kbd:`F7`", "Toggle spell checking."
":kbd:`Ctrl`:kbd:`F10`", "Toggle automatic updating of project outline." ":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:`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:`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 single quotes."
":kbd:`Ctrl`:kbd:`""`", "Wrap selected text, or word under cursor, in double 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." ":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:`S`", "Save the current project."
":kbd:`Ctrl`:kbd:`Shift`:kbd:`W`", "Close 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:`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:`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:`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`)" ":kbd:`F3`", "Find next occurrence of search word in current document. (Same as :kbd:`Ctrl`:kbd:`G`)"
-1
View File
@@ -94,7 +94,6 @@ class nwDocAction(Enum):
BLOCK_TXT = 23 BLOCK_TXT = 23
REPL_SNG = 24 REPL_SNG = 24
REPL_DBL = 25 REPL_DBL = 25
DEL_WORD = 26
# END Enum nwDocAction # END Enum nwDocAction
+2 -5
View File
@@ -37,11 +37,11 @@ from time import time
from PyQt5.QtCore import ( from PyQt5.QtCore import (
Qt, QSize, QTimer, pyqtSlot, pyqtSignal, QRegExp, QRegularExpression, Qt, QSize, QTimer, pyqtSlot, pyqtSignal, QRegExp, QRegularExpression,
QPointF, QObject, QRunnable, QPropertyAnimation, QEvent QPointF, QObject, QRunnable, QPropertyAnimation
) )
from PyQt5.QtGui import ( from PyQt5.QtGui import (
QTextCursor, QTextOption, QKeySequence, QFont, QColor, QPalette, QTextCursor, QTextOption, QKeySequence, QFont, QColor, QPalette,
QTextDocument, QCursor, QPixmap, QKeyEvent QTextDocument, QCursor, QPixmap
) )
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
qApp, QTextEdit, QAction, QMenu, QShortcut, QMessageBox, QWidget, QLabel, qApp, QTextEdit, QAction, QMenu, QShortcut, QMessageBox, QWidget, QLabel,
@@ -719,8 +719,6 @@ class GuiDocEditor(QTextEdit):
self._replaceQuotes("'", self.typSQOpen, self.typSQClose) self._replaceQuotes("'", self.typSQOpen, self.typSQClose)
elif theAction == nwDocAction.REPL_DBL: elif theAction == nwDocAction.REPL_DBL:
self._replaceQuotes("\"", self.typDQOpen, self.typDQClose) self._replaceQuotes("\"", self.typDQOpen, self.typDQClose)
elif theAction == nwDocAction.DEL_WORD:
self.keyPressEvent(QKeyEvent(QEvent.KeyPress, Qt.Key_Delete, Qt.ControlModifier))
else: else:
logger.debug("Unknown or unsupported document action %s" % str(theAction)) logger.debug("Unknown or unsupported document action %s" % str(theAction))
self._allowAutoReplace(True) self._allowAutoReplace(True)
@@ -845,7 +843,6 @@ class GuiDocEditor(QTextEdit):
* The undo/redo/select all sequences bypasses the docAction * The undo/redo/select all sequences bypasses the docAction
pathway from the menu, so we redirect them back from here. pathway from the menu, so we redirect them back from here.
""" """
print(keyEvent.type())
self.lastActive = time() self.lastActive = time()
isReturn = keyEvent.key() == Qt.Key_Return isReturn = keyEvent.key() == Qt.Key_Return
isReturn |= keyEvent.key() == Qt.Key_Enter isReturn |= keyEvent.key() == Qt.Key_Enter
+2 -12
View File
@@ -172,16 +172,6 @@ class GuiMainMenu(QMenuBar):
QDesktopServices.openUrl(QUrl(theUrl)) QDesktopServices.openUrl(QUrl(theUrl))
return True return True
def _handleCtrlDel(self):
"""Direct the Ctrl+Del key press to the correct widget.
"""
if self.theParent.treeView.hasFocus():
self.theParent.treeView.deleteItem(None)
elif self.theParent.docEditor.hasFocus():
self.theParent.docEditor.docAction(nwDocAction.DEL_WORD)
return
## ##
# Menu Builders # Menu Builders
## ##
@@ -279,8 +269,8 @@ class GuiMainMenu(QMenuBar):
# Project > Delete # Project > Delete
self.aDeleteItem = QAction("Delete Item", self) self.aDeleteItem = QAction("Delete Item", self)
self.aDeleteItem.setStatusTip("Delete selected project item") self.aDeleteItem.setStatusTip("Delete selected project item")
self.aDeleteItem.setShortcut("Ctrl+Del") self.aDeleteItem.setShortcut("Ctrl+Shift+Del")
self.aDeleteItem.triggered.connect(self._handleCtrlDel) self.aDeleteItem.triggered.connect(lambda: self.theParent.treeView.deleteItem(None))
self.projMenu.addAction(self.aDeleteItem) self.projMenu.addAction(self.aDeleteItem)
# Project > Move Up # Project > Move Up
+1 -1
View File
@@ -451,7 +451,7 @@ class GuiProjectTree(QTreeWidget):
for tHandle in self.getTreeFromHandle(trashHandle): for tHandle in self.getTreeFromHandle(trashHandle):
if tHandle == trashHandle: if tHandle == trashHandle:
continue continue
self.deleteItem(tHandle, True) self.deleteItem(tHandle, alreadyAsked=True)
if nTrash > 0: if nTrash > 0:
self._setTreeChanged(True) self._setTreeChanged(True)