F2 should only edit item if project tree has focus, and edit current document meta if editor has focus
This commit is contained in:
+5
-1
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user