diff --git a/nw/gui/elements/docdetails.py b/nw/gui/elements/docdetails.py index 78fbf386..00b3aa89 100644 --- a/nw/gui/elements/docdetails.py +++ b/nw/gui/elements/docdetails.py @@ -23,11 +23,6 @@ logger = logging.getLogger(__name__) class GuiDocDetails(QFrame): - C_NAME = 0 - C_COUNT = 1 - C_FLAGS = 2 - C_HANDLE = 3 - def __init__(self, theParent, theProject): QFrame.__init__(self, theParent) diff --git a/nw/gui/elements/searchbar.py b/nw/gui/elements/searchbar.py index cb40878e..21be1cfb 100644 --- a/nw/gui/elements/searchbar.py +++ b/nw/gui/elements/searchbar.py @@ -86,13 +86,13 @@ class GuiSearchBar(QFrame): if not self.isVisible(): self.setVisible(True) self.searchBox.setText(theText) - self.searchBox.setFocus(True) + self.searchBox.setFocus() logger.verbose("Setting search text to '%s'" % theText) return True def setReplaceText(self, theText): self._replaceVisible(True) - self.replaceBox.setFocus(True) + self.replaceBox.setFocus() self.replaceBox.setText(theText) return True diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index b515576a..14ff2279 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -78,7 +78,7 @@ class GuiMainMenu(QMenuBar): if recentProject == "": continue menuItem = QAction("%s" % recentProject, self.projMenu) menuItem.triggered.connect( - lambda menuItem, n=n : self.openRecentProject(menuItem, n) + lambda a1=menuItem, a2=n : self.openRecentProject(a1, a2) ) self.recentMenu.addAction(menuItem) @@ -255,7 +255,7 @@ class GuiMainMenu(QMenuBar): self.rootItems[itemClass].triggered.connect( lambda nCount, itemClass=itemClass : self._newTreeItem(nwItemType.ROOT, itemClass) ) - self.rootMenu.addActions(self.rootItems.values()) + self.rootMenu.addAction(self.rootItems[itemClass]) # Project > New Folder self.aCreateFolder = QAction("Create Folder", self) diff --git a/nw/guimain.py b/nw/guimain.py index b1fdf031..670b1534 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -17,7 +17,7 @@ import nw from os import path from PyQt5.QtCore import Qt, QTimer -from PyQt5.QtGui import QIcon, QPixmap, QColor +from PyQt5.QtGui import QIcon, QPixmap, QColor, QKeySequence from PyQt5.QtWidgets import ( qApp, QMainWindow, QVBoxLayout, QFrame, QSplitter, QFileDialog, QShortcut, QMessageBox, QProgressDialog, QDialog @@ -152,17 +152,12 @@ class GuiMain(QMainWindow): # Shortcuts and Actions self._connectMenuActions() - QShortcut( - Qt.Key_Return, - self.treeView, - context=Qt.WidgetShortcut, - activated=self._treeKeyPressReturn - ) - QShortcut( - Qt.Key_Escape, - self, - activated=self._keyPressEscape - ) + 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) # Forward Functions self.setStatus = self.statusBar.setStatus diff --git a/pytest.ini b/pytest.ini index 17f2ac93..f266d081 100644 --- a/pytest.ini +++ b/pytest.ini @@ -4,3 +4,4 @@ markers = core: Core functionality tests gui: Qt5 GUI tests serial +qt_api = pyqt5