F2 should only edit item if project tree has focus, and edit current document meta if editor has focus

This commit is contained in:
Veronica K. B. Olsen
2021-02-11 18:57:44 +01:00
parent 1e5d980b85
commit 3a60abaeee
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -800,7 +800,11 @@ class GuiMain(QMainWindow):
return False return False
if tHandle is None: 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: if tHandle is None:
logger.warning("No item selected") logger.warning("No item selected")
return return
+2 -1
View File
@@ -28,7 +28,7 @@ from tools import cmpFiles, getGuiItem
from PyQt5.QtWidgets import QAction, QMessageBox from PyQt5.QtWidgets import QAction, QMessageBox
from nw.gui import GuiItemEditor from nw.gui import GuiItemEditor, GuiProjectTree
from nw.constants import nwItemLayout from nw.constants import nwItemLayout
keyDelay = 2 keyDelay = 2
@@ -45,6 +45,7 @@ def testGuiItemEditor_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir,
# Block message box # Block message box
monkeypatch.setattr(QMessageBox, "question", lambda *args: QMessageBox.Yes) monkeypatch.setattr(QMessageBox, "question", lambda *args: QMessageBox.Yes)
monkeypatch.setattr(GuiProjectTree, "hasFocus", lambda *args: True)
# Create new, save, open project # Create new, save, open project
nwGUI.theProject.projTree.setSeed(42) nwGUI.theProject.projTree.setSeed(42)