From 896d7f12573ebd71fca34a7ab2f213fb07bd201c Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Fri, 5 Jun 2020 19:38:03 +0200 Subject: [PATCH] No focus shift on open document from tree --- nw/guimain.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nw/guimain.py b/nw/guimain.py index ea6c050e..e50b23c9 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -193,9 +193,11 @@ class GuiMain(QMainWindow): # Shortcuts and Actions self._connectMenuActions() + keyReturn = QShortcut(self.treeView) keyReturn.setKey(QKeySequence(Qt.Key_Return)) keyReturn.activated.connect(self._treeKeyPressReturn) + keyEscape = QShortcut(self) keyEscape.setKey(QKeySequence(Qt.Key_Escape)) keyEscape.activated.connect(self._keyPressEscape) @@ -1014,6 +1016,9 @@ class GuiMain(QMainWindow): ## def _treeSingleClick(self): + """Single click on a project tree item just updates the details + panel below the tree. + """ sHandle = self.treeView.getSelectedHandle() if sHandle is not None: self.treeMeta.updateViewBox(sHandle) @@ -1029,7 +1034,7 @@ class GuiMain(QMainWindow): if nwItem is not None: if nwItem.itemType == nwItemType.FILE: logger.verbose("Requested item %s is a file" % tHandle) - self.openDocument(tHandle) + self.openDocument(tHandle, changeFocus=False) else: logger.verbose("Requested item %s is a folder" % tHandle) return