Apply open document shortcuts to the tree that has focus (#945)

* Better handling of Enter/Return on GUI trees, resolves #913
* Update test
* Generalise open selected handle functions
* Improve test coverage
* Update docstring
This commit is contained in:
Veronica Berglyd Olsen
2021-12-31 19:51:26 +01:00
committed by GitHub
parent 7024254960
commit b0f939af32
7 changed files with 188 additions and 74 deletions
+2 -6
View File
@@ -29,7 +29,7 @@ from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox
from tools import writeFile
from novelwriter.gui.doceditor import GuiDocEditor
from novelwriter.enum import nwDocAction, nwDocInsert, nwWidget
from novelwriter.enum import nwDocAction, nwDocInsert
from novelwriter.constants import nwKeyWords, nwUnicode
keyDelay = 2
@@ -471,11 +471,7 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
assert nwGUI.newProject({"projPath": fncProj})
assert nwGUI.treeView._getTreeItem("0e17daca5f3e1") is not None
nwGUI.switchFocus(nwWidget.TREE)
nwGUI.treeView.clearSelection()
nwGUI.treeView._getTreeItem("0e17daca5f3e1").setSelected(True)
assert nwGUI.openSelectedItem()
assert nwGUI.openDocument("0e17daca5f3e1") is True
nwGUI.docEditor.clear()
# Test Faulty Inserts