Merge pull request #717 from vkbo/issue716_focus_shortcuts
Issue #716: Focus Mode Improvement and Bugfix
This commit is contained in:
@@ -6,7 +6,7 @@ from nw.constants.constants import (
|
|||||||
)
|
)
|
||||||
from nw.constants.enum import (
|
from nw.constants.enum import (
|
||||||
nwAlert, nwDocAction, nwItemClass, nwItemLayout, nwItemType, nwOutline,
|
nwAlert, nwDocAction, nwItemClass, nwItemLayout, nwItemType, nwOutline,
|
||||||
nwDocInsert
|
nwDocInsert, nwWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -28,4 +28,5 @@ __all__ = [
|
|||||||
"nwItemType",
|
"nwItemType",
|
||||||
"nwOutline",
|
"nwOutline",
|
||||||
"nwDocInsert",
|
"nwDocInsert",
|
||||||
|
"nwWidget",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -112,6 +112,15 @@ class nwAlert(Enum):
|
|||||||
|
|
||||||
# END Enum nwAlert
|
# END Enum nwAlert
|
||||||
|
|
||||||
|
class nwWidget(Enum):
|
||||||
|
|
||||||
|
TREE = 1
|
||||||
|
EDITOR = 2
|
||||||
|
VIEWER = 3
|
||||||
|
OUTLINE = 4
|
||||||
|
|
||||||
|
# END Enum nwWidget
|
||||||
|
|
||||||
class nwOutline(Enum):
|
class nwOutline(Enum):
|
||||||
|
|
||||||
TITLE = 0
|
TITLE = 0
|
||||||
|
|||||||
+11
-13
@@ -2178,7 +2178,6 @@ class GuiDocEditHeader(QWidget):
|
|||||||
|
|
||||||
fPx = int(0.9*self.theTheme.fontPixelSize)
|
fPx = int(0.9*self.theTheme.fontPixelSize)
|
||||||
hSp = self.mainConf.pxInt(6)
|
hSp = self.mainConf.pxInt(6)
|
||||||
self.buttonSize = fPx + hSp
|
|
||||||
|
|
||||||
# Main Widget Settings
|
# Main Widget Settings
|
||||||
self.setAutoFillBackground(True)
|
self.setAutoFillBackground(True)
|
||||||
@@ -2324,6 +2323,17 @@ class GuiDocEditHeader(QWidget):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def updateFocusMode(self):
|
||||||
|
"""Update the minimise/maximise icon of the Focus Mode button.
|
||||||
|
This function is called by the GuiMain class via the
|
||||||
|
toggleFocusMode function and should not be activated directly.
|
||||||
|
"""
|
||||||
|
if self.theParent.isFocusMode:
|
||||||
|
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
||||||
|
else:
|
||||||
|
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
||||||
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
# Slots
|
# Slots
|
||||||
##
|
##
|
||||||
@@ -2354,18 +2364,6 @@ class GuiDocEditHeader(QWidget):
|
|||||||
"""Switch on or off Focus Mode.
|
"""Switch on or off Focus Mode.
|
||||||
"""
|
"""
|
||||||
self.theParent.toggleFocusMode()
|
self.theParent.toggleFocusMode()
|
||||||
if self.theParent.isFocusMode:
|
|
||||||
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
|
||||||
self.setContentsMargins(self.buttonSize, 0, 0, 0)
|
|
||||||
self.editButton.setVisible(False)
|
|
||||||
self.searchButton.setVisible(False)
|
|
||||||
self.closeButton.setVisible(False)
|
|
||||||
else:
|
|
||||||
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
|
|
||||||
self.setContentsMargins(0, 0, 0, 0)
|
|
||||||
self.editButton.setVisible(True)
|
|
||||||
self.searchButton.setVisible(True)
|
|
||||||
self.closeButton.setVisible(True)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
+5
-5
@@ -33,7 +33,7 @@ from PyQt5.QtWidgets import QMenuBar, QAction
|
|||||||
|
|
||||||
from nw.constants import (
|
from nw.constants import (
|
||||||
nwItemType, nwItemClass, nwDocAction, nwDocInsert, nwKeyWords, nwLabels,
|
nwItemType, nwItemClass, nwDocAction, nwDocInsert, nwKeyWords, nwLabels,
|
||||||
nwUnicode
|
nwUnicode, nwWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -469,28 +469,28 @@ class GuiMainMenu(QMenuBar):
|
|||||||
self.aFocusTree = QAction("Focus Project Tree", self)
|
self.aFocusTree = QAction("Focus Project Tree", self)
|
||||||
self.aFocusTree.setStatusTip("Move focus to project tree")
|
self.aFocusTree.setStatusTip("Move focus to project tree")
|
||||||
self.aFocusTree.setShortcut("Alt+1")
|
self.aFocusTree.setShortcut("Alt+1")
|
||||||
self.aFocusTree.triggered.connect(lambda: self.theParent.setFocus(1))
|
self.aFocusTree.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.TREE))
|
||||||
self.viewMenu.addAction(self.aFocusTree)
|
self.viewMenu.addAction(self.aFocusTree)
|
||||||
|
|
||||||
# View > Document Pane 1
|
# View > Document Pane 1
|
||||||
self.aFocusEditor = QAction("Focus Document Editor", self)
|
self.aFocusEditor = QAction("Focus Document Editor", self)
|
||||||
self.aFocusEditor.setStatusTip("Move focus to left document pane")
|
self.aFocusEditor.setStatusTip("Move focus to left document pane")
|
||||||
self.aFocusEditor.setShortcut("Alt+2")
|
self.aFocusEditor.setShortcut("Alt+2")
|
||||||
self.aFocusEditor.triggered.connect(lambda: self.theParent.setFocus(2))
|
self.aFocusEditor.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.EDITOR))
|
||||||
self.viewMenu.addAction(self.aFocusEditor)
|
self.viewMenu.addAction(self.aFocusEditor)
|
||||||
|
|
||||||
# View > Document Pane 2
|
# View > Document Pane 2
|
||||||
self.aFocusView = QAction("Focus Document Viewer", self)
|
self.aFocusView = QAction("Focus Document Viewer", self)
|
||||||
self.aFocusView.setStatusTip("Move focus to right document pane")
|
self.aFocusView.setStatusTip("Move focus to right document pane")
|
||||||
self.aFocusView.setShortcut("Alt+3")
|
self.aFocusView.setShortcut("Alt+3")
|
||||||
self.aFocusView.triggered.connect(lambda: self.theParent.setFocus(3))
|
self.aFocusView.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.VIEWER))
|
||||||
self.viewMenu.addAction(self.aFocusView)
|
self.viewMenu.addAction(self.aFocusView)
|
||||||
|
|
||||||
# View > Outline
|
# View > Outline
|
||||||
self.aFocusOutline = QAction("Focus Outline", self)
|
self.aFocusOutline = QAction("Focus Outline", self)
|
||||||
self.aFocusOutline.setStatusTip("Move focus to outline")
|
self.aFocusOutline.setStatusTip("Move focus to outline")
|
||||||
self.aFocusOutline.setShortcut("Alt+4")
|
self.aFocusOutline.setShortcut("Alt+4")
|
||||||
self.aFocusOutline.triggered.connect(lambda: self.theParent.setFocus(4))
|
self.aFocusOutline.triggered.connect(lambda: self.theParent.switchFocus(nwWidget.OUTLINE))
|
||||||
self.viewMenu.addAction(self.aFocusOutline)
|
self.viewMenu.addAction(self.aFocusOutline)
|
||||||
|
|
||||||
# View > Separator
|
# View > Separator
|
||||||
|
|||||||
+24
-10
@@ -46,7 +46,7 @@ from nw.gui import (
|
|||||||
GuiProjectTree, GuiProjectWizard, GuiTheme, GuiWordList, GuiWritingStats
|
GuiProjectTree, GuiProjectWizard, GuiTheme, GuiWordList, GuiWritingStats
|
||||||
)
|
)
|
||||||
from nw.core import NWProject, NWDoc, NWIndex
|
from nw.core import NWProject, NWDoc, NWIndex
|
||||||
from nw.constants import nwItemType, nwItemClass, nwAlert, nwLists
|
from nw.constants import nwItemType, nwItemClass, nwAlert, nwLists, nwWidget
|
||||||
from nw.common import getGuiItem, hexToInt
|
from nw.common import getGuiItem, hexToInt
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -558,6 +558,10 @@ class GuiMain(QMainWindow):
|
|||||||
logger.error("No project open")
|
logger.error("No project open")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Disable focus mode if it is active
|
||||||
|
if self.isFocusMode:
|
||||||
|
self.toggleFocusMode()
|
||||||
|
|
||||||
self.docEditor.saveCursorPosition()
|
self.docEditor.saveCursorPosition()
|
||||||
if self.docEditor.docChanged:
|
if self.docEditor.docChanged:
|
||||||
self.saveDocument()
|
self.saveDocument()
|
||||||
@@ -804,10 +808,10 @@ class GuiMain(QMainWindow):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if tHandle is None:
|
if tHandle is None:
|
||||||
if self.treeView.hasFocus():
|
if self.docEditor.anyFocus() or self.isFocusMode:
|
||||||
tHandle = self.treeView.getSelectedHandle()
|
|
||||||
elif self.docEditor.hasFocus():
|
|
||||||
tHandle = self.docEditor.theHandle
|
tHandle = self.docEditor.theHandle
|
||||||
|
else:
|
||||||
|
tHandle = self.treeView.getSelectedHandle()
|
||||||
|
|
||||||
if tHandle is None:
|
if tHandle is None:
|
||||||
logger.warning("No item selected")
|
logger.warning("No item selected")
|
||||||
@@ -1173,18 +1177,18 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def setFocus(self, paneNo):
|
def switchFocus(self, paneNo):
|
||||||
"""Switch focus between main GUI views.
|
"""Switch focus between main GUI views.
|
||||||
"""
|
"""
|
||||||
if paneNo == 1:
|
if paneNo == nwWidget.TREE:
|
||||||
self.treeView.setFocus()
|
self.treeView.setFocus()
|
||||||
elif paneNo == 2:
|
elif paneNo == nwWidget.EDITOR:
|
||||||
self.mainTabs.setCurrentWidget(self.splitDocs)
|
self.mainTabs.setCurrentWidget(self.splitDocs)
|
||||||
self.docEditor.setFocus()
|
self.docEditor.setFocus()
|
||||||
elif paneNo == 3:
|
elif paneNo == nwWidget.VIEWER:
|
||||||
self.mainTabs.setCurrentWidget(self.splitDocs)
|
self.mainTabs.setCurrentWidget(self.splitDocs)
|
||||||
self.docViewer.setFocus()
|
self.docViewer.setFocus()
|
||||||
elif paneNo == 4:
|
elif paneNo == nwWidget.OUTLINE:
|
||||||
self.mainTabs.setCurrentWidget(self.splitOutline)
|
self.mainTabs.setCurrentWidget(self.splitOutline)
|
||||||
self.projView.setFocus()
|
self.projView.setFocus()
|
||||||
return
|
return
|
||||||
@@ -1221,6 +1225,7 @@ class GuiMain(QMainWindow):
|
|||||||
if self.isFocusMode:
|
if self.isFocusMode:
|
||||||
logger.debug("Activating Focus Mode")
|
logger.debug("Activating Focus Mode")
|
||||||
self.mainTabs.setCurrentWidget(self.splitDocs)
|
self.mainTabs.setCurrentWidget(self.splitDocs)
|
||||||
|
self.switchFocus(nwWidget.EDITOR)
|
||||||
else:
|
else:
|
||||||
logger.debug("Deactivating Focus Mode")
|
logger.debug("Deactivating Focus Mode")
|
||||||
|
|
||||||
@@ -1232,6 +1237,7 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
hideDocFooter = self.isFocusMode and self.mainConf.hideFocusFooter
|
hideDocFooter = self.isFocusMode and self.mainConf.hideFocusFooter
|
||||||
self.docEditor.docFooter.setVisible(not hideDocFooter)
|
self.docEditor.docFooter.setVisible(not hideDocFooter)
|
||||||
|
self.docEditor.docHeader.updateFocusMode()
|
||||||
|
|
||||||
if self.splitView.isVisible():
|
if self.splitView.isVisible():
|
||||||
self.splitView.setVisible(False)
|
self.splitView.setVisible(False)
|
||||||
@@ -1269,11 +1275,12 @@ class GuiMain(QMainWindow):
|
|||||||
"""
|
"""
|
||||||
# Project
|
# Project
|
||||||
self.addAction(self.mainMenu.aSaveProject)
|
self.addAction(self.mainMenu.aSaveProject)
|
||||||
|
self.addAction(self.mainMenu.aEditItem)
|
||||||
self.addAction(self.mainMenu.aExitNW)
|
self.addAction(self.mainMenu.aExitNW)
|
||||||
|
|
||||||
# Document
|
# Document
|
||||||
self.addAction(self.mainMenu.aSaveDoc)
|
self.addAction(self.mainMenu.aSaveDoc)
|
||||||
self.addAction(self.mainMenu.aFileDetails)
|
self.addAction(self.mainMenu.aCloseDoc)
|
||||||
|
|
||||||
# Edit
|
# Edit
|
||||||
self.addAction(self.mainMenu.aEditUndo)
|
self.addAction(self.mainMenu.aEditUndo)
|
||||||
@@ -1317,6 +1324,13 @@ class GuiMain(QMainWindow):
|
|||||||
for mAction, _ in self.mainMenu.mInsKWItems.values():
|
for mAction, _ in self.mainMenu.mInsKWItems.values():
|
||||||
self.addAction(mAction)
|
self.addAction(mAction)
|
||||||
|
|
||||||
|
# Search
|
||||||
|
self.addAction(self.mainMenu.aFind)
|
||||||
|
self.addAction(self.mainMenu.aReplace)
|
||||||
|
self.addAction(self.mainMenu.aFindNext)
|
||||||
|
self.addAction(self.mainMenu.aFindPrev)
|
||||||
|
self.addAction(self.mainMenu.aReplaceNext)
|
||||||
|
|
||||||
# Format
|
# Format
|
||||||
self.addAction(self.mainMenu.aFmtEmph)
|
self.addAction(self.mainMenu.aFmtEmph)
|
||||||
self.addAction(self.mainMenu.aFmtStrong)
|
self.addAction(self.mainMenu.aFmtStrong)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ from PyQt5.QtWidgets import QAction, QMessageBox, QDialog
|
|||||||
from nw.gui.itemeditor import GuiItemEditor
|
from nw.gui.itemeditor import GuiItemEditor
|
||||||
from nw.gui.doceditor import GuiDocEditor
|
from nw.gui.doceditor import GuiDocEditor
|
||||||
from nw.gui.projtree import GuiProjectTree
|
from nw.gui.projtree import GuiProjectTree
|
||||||
from nw.constants import nwItemType, nwDocAction
|
from nw.constants import nwItemType, nwDocAction, nwWidget
|
||||||
|
|
||||||
keyDelay = 2
|
keyDelay = 2
|
||||||
typeDelay = 1
|
typeDelay = 1
|
||||||
@@ -117,14 +117,14 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi
|
|||||||
nwGUI.mainConf.autoScroll = True
|
nwGUI.mainConf.autoScroll = True
|
||||||
|
|
||||||
# Add a Character File
|
# Add a Character File
|
||||||
nwGUI.setFocus(1)
|
nwGUI.switchFocus(nwWidget.TREE)
|
||||||
nwGUI.treeView.clearSelection()
|
nwGUI.treeView.clearSelection()
|
||||||
nwGUI.treeView._getTreeItem("71ee45a3c0db9").setSelected(True)
|
nwGUI.treeView._getTreeItem("71ee45a3c0db9").setSelected(True)
|
||||||
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
|
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
|
||||||
assert nwGUI.openSelectedItem()
|
assert nwGUI.openSelectedItem()
|
||||||
|
|
||||||
# Type something into the document
|
# Type something into the document
|
||||||
nwGUI.setFocus(2)
|
nwGUI.switchFocus(nwWidget.EDITOR)
|
||||||
qtbot.keyClick(nwGUI.docEditor, "a", modifier=Qt.ControlModifier, delay=keyDelay)
|
qtbot.keyClick(nwGUI.docEditor, "a", modifier=Qt.ControlModifier, delay=keyDelay)
|
||||||
for c in "# Jane Doe":
|
for c in "# Jane Doe":
|
||||||
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
|
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
|
||||||
@@ -139,14 +139,14 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi
|
|||||||
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
|
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
|
||||||
|
|
||||||
# Add a Plot File
|
# Add a Plot File
|
||||||
nwGUI.setFocus(1)
|
nwGUI.switchFocus(nwWidget.TREE)
|
||||||
nwGUI.treeView.clearSelection()
|
nwGUI.treeView.clearSelection()
|
||||||
nwGUI.treeView._getTreeItem("44cb730c42048").setSelected(True)
|
nwGUI.treeView._getTreeItem("44cb730c42048").setSelected(True)
|
||||||
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
|
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
|
||||||
assert nwGUI.openSelectedItem()
|
assert nwGUI.openSelectedItem()
|
||||||
|
|
||||||
# Type something into the document
|
# Type something into the document
|
||||||
nwGUI.setFocus(2)
|
nwGUI.switchFocus(nwWidget.EDITOR)
|
||||||
qtbot.keyClick(nwGUI.docEditor, "a", modifier=Qt.ControlModifier, delay=keyDelay)
|
qtbot.keyClick(nwGUI.docEditor, "a", modifier=Qt.ControlModifier, delay=keyDelay)
|
||||||
for c in "# Main Plot":
|
for c in "# Main Plot":
|
||||||
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
|
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
|
||||||
@@ -161,7 +161,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi
|
|||||||
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
|
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
|
||||||
|
|
||||||
# Add a World File
|
# Add a World File
|
||||||
nwGUI.setFocus(1)
|
nwGUI.switchFocus(nwWidget.TREE)
|
||||||
nwGUI.treeView.clearSelection()
|
nwGUI.treeView.clearSelection()
|
||||||
nwGUI.treeView._getTreeItem("811786ad1ae74").setSelected(True)
|
nwGUI.treeView._getTreeItem("811786ad1ae74").setSelected(True)
|
||||||
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
|
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
|
||||||
@@ -173,7 +173,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi
|
|||||||
nwGUI.docEditor.replaceText("")
|
nwGUI.docEditor.replaceText("")
|
||||||
|
|
||||||
# Type something into the document
|
# Type something into the document
|
||||||
nwGUI.setFocus(2)
|
nwGUI.switchFocus(nwWidget.EDITOR)
|
||||||
qtbot.keyClick(nwGUI.docEditor, "a", modifier=Qt.ControlModifier, delay=keyDelay)
|
qtbot.keyClick(nwGUI.docEditor, "a", modifier=Qt.ControlModifier, delay=keyDelay)
|
||||||
for c in "# Main Location":
|
for c in "# Main Location":
|
||||||
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
|
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
|
||||||
@@ -192,7 +192,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi
|
|||||||
nwGUI._autoSaveProject()
|
nwGUI._autoSaveProject()
|
||||||
|
|
||||||
# Select the 'New Scene' file
|
# Select the 'New Scene' file
|
||||||
nwGUI.setFocus(1)
|
nwGUI.switchFocus(nwWidget.TREE)
|
||||||
nwGUI.treeView.clearSelection()
|
nwGUI.treeView.clearSelection()
|
||||||
nwGUI.treeView._getTreeItem("73475cb40a568").setExpanded(True)
|
nwGUI.treeView._getTreeItem("73475cb40a568").setExpanded(True)
|
||||||
nwGUI.treeView._getTreeItem("31489056e0916").setExpanded(True)
|
nwGUI.treeView._getTreeItem("31489056e0916").setExpanded(True)
|
||||||
@@ -200,7 +200,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi
|
|||||||
assert nwGUI.openSelectedItem()
|
assert nwGUI.openSelectedItem()
|
||||||
|
|
||||||
# Type something into the document
|
# Type something into the document
|
||||||
nwGUI.setFocus(2)
|
nwGUI.switchFocus(nwWidget.EDITOR)
|
||||||
qtbot.keyClick(nwGUI.docEditor, "a", modifier=Qt.ControlModifier, delay=keyDelay)
|
qtbot.keyClick(nwGUI.docEditor, "a", modifier=Qt.ControlModifier, delay=keyDelay)
|
||||||
for c in "# Novel":
|
for c in "# Novel":
|
||||||
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
|
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
|
||||||
@@ -300,7 +300,7 @@ def testGuiEditor_Main(qtbot, monkeypatch, nwGUI, fncDir, fncProj, refDir, outDi
|
|||||||
qtbot.wait(stepDelay)
|
qtbot.wait(stepDelay)
|
||||||
|
|
||||||
# Open and view the edited document
|
# Open and view the edited document
|
||||||
nwGUI.setFocus(3)
|
nwGUI.switchFocus(nwWidget.VIEWER)
|
||||||
assert nwGUI.openDocument("0e17daca5f3e1")
|
assert nwGUI.openDocument("0e17daca5f3e1")
|
||||||
assert nwGUI.viewDocument("0e17daca5f3e1")
|
assert nwGUI.viewDocument("0e17daca5f3e1")
|
||||||
qtbot.wait(stepDelay)
|
qtbot.wait(stepDelay)
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ from PyQt5.QtGui import QTextCursor, QTextBlock
|
|||||||
from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox
|
from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox
|
||||||
|
|
||||||
from nw.gui.doceditor import GuiDocEditor
|
from nw.gui.doceditor import GuiDocEditor
|
||||||
from nw.constants import nwUnicode, nwDocAction, nwDocInsert, nwKeyWords
|
from nw.constants import (
|
||||||
|
nwUnicode, nwDocAction, nwDocInsert, nwKeyWords, nwWidget
|
||||||
|
)
|
||||||
|
|
||||||
keyDelay = 2
|
keyDelay = 2
|
||||||
typeDelay = 1
|
typeDelay = 1
|
||||||
@@ -366,7 +368,7 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
|
|||||||
|
|
||||||
assert nwGUI.treeView._getTreeItem("0e17daca5f3e1") is not None
|
assert nwGUI.treeView._getTreeItem("0e17daca5f3e1") is not None
|
||||||
|
|
||||||
nwGUI.setFocus(1)
|
nwGUI.switchFocus(nwWidget.TREE)
|
||||||
nwGUI.treeView.clearSelection()
|
nwGUI.treeView.clearSelection()
|
||||||
nwGUI.treeView._getTreeItem("0e17daca5f3e1").setSelected(True)
|
nwGUI.treeView._getTreeItem("0e17daca5f3e1").setSelected(True)
|
||||||
assert nwGUI.openSelectedItem()
|
assert nwGUI.openSelectedItem()
|
||||||
|
|||||||
Reference in New Issue
Block a user