Make some minor code and GUI fixes (#2202)
This commit is contained in:
@@ -1104,10 +1104,10 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
else:
|
else:
|
||||||
self._completer.setVisible(False)
|
self._completer.setVisible(False)
|
||||||
|
|
||||||
if self._doReplace and added == 1:
|
if self._doReplace and added == 1:
|
||||||
cursor = self.textCursor()
|
cursor = self.textCursor()
|
||||||
if self._autoReplace.process(text, cursor):
|
if self._autoReplace.process(text, cursor):
|
||||||
self._qDocument.syntaxHighlighter.rehighlightBlock(cursor.block())
|
self._qDocument.syntaxHighlighter.rehighlightBlock(cursor.block())
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1217,7 +1217,7 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
|
|
||||||
# Execute the context menu
|
# Execute the context menu
|
||||||
ctxMenu.exec(self.viewport().mapToGlobal(pos))
|
ctxMenu.exec(self.viewport().mapToGlobal(pos))
|
||||||
ctxMenu.deleteLater()
|
ctxMenu.setParent(None)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
|
|
||||||
# Open the context menu
|
# Open the context menu
|
||||||
ctxMenu.exec(self.viewport().mapToGlobal(point))
|
ctxMenu.exec(self.viewport().mapToGlobal(point))
|
||||||
ctxMenu.deleteLater()
|
ctxMenu.setParent(None)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ class GuiItemDetails(QWidget):
|
|||||||
self.statusData = QLabel("", self)
|
self.statusData = QLabel("", self)
|
||||||
self.statusData.setFont(fntValue)
|
self.statusData.setFont(fntValue)
|
||||||
self.statusData.setAlignment(QtAlignLeft)
|
self.statusData.setAlignment(QtAlignLeft)
|
||||||
|
self.statusData.setWordWrap(True)
|
||||||
|
|
||||||
# Class
|
# Class
|
||||||
self.className = QLabel(self.tr("Class"), self)
|
self.className = QLabel(self.tr("Class"), self)
|
||||||
|
|||||||
+12
-17
@@ -955,23 +955,18 @@ class GuiProjectTree(QTreeView):
|
|||||||
if model := self._getModel():
|
if model := self._getModel():
|
||||||
if point is None:
|
if point is None:
|
||||||
point = self.visualRect(self.currentIndex()).center()
|
point = self.visualRect(self.currentIndex()).center()
|
||||||
|
if point is not None:
|
||||||
if (
|
index = self.indexAt(point)
|
||||||
point is not None
|
if (node := self._getNode(index)) and (indices := self._selectedRows()):
|
||||||
and (node := self._getNode(self.currentIndex()))
|
ctxMenu = _TreeContextMenu(self, model, node, indices)
|
||||||
and (indices := self._selectedRows())
|
if node is SHARED.project.tree.trash:
|
||||||
):
|
ctxMenu.buildTrashMenu()
|
||||||
ctxMenu = _TreeContextMenu(self, model, node, indices)
|
elif len(indices) > 1:
|
||||||
if node is SHARED.project.tree.trash:
|
ctxMenu.buildMultiSelectMenu()
|
||||||
ctxMenu.buildTrashMenu()
|
else:
|
||||||
elif len(indices) > 1:
|
ctxMenu.buildSingleSelectMenu()
|
||||||
ctxMenu.buildMultiSelectMenu()
|
ctxMenu.exec(self.viewport().mapToGlobal(point))
|
||||||
else:
|
ctxMenu.setParent(None)
|
||||||
ctxMenu.buildSingleSelectMenu()
|
|
||||||
|
|
||||||
ctxMenu.exec(self.viewport().mapToGlobal(point))
|
|
||||||
ctxMenu.deleteLater()
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ class _OpenProjectPage(QWidget):
|
|||||||
action = ctxMenu.addAction(self.tr("Remove Project"))
|
action = ctxMenu.addAction(self.tr("Remove Project"))
|
||||||
action.triggered.connect(self._deleteSelectedItem)
|
action.triggered.connect(self._deleteSelectedItem)
|
||||||
ctxMenu.exec(self.mapToGlobal(pos))
|
ctxMenu.exec(self.mapToGlobal(pos))
|
||||||
ctxMenu.deleteLater()
|
ctxMenu.setParent(None)
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -332,6 +332,7 @@ def testGuiEditor_MetaData(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||||
"""Test the editor context menu."""
|
"""Test the editor context menu."""
|
||||||
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
|
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
|
||||||
|
monkeypatch.setattr(QMenu, "setParent", lambda *a: None)
|
||||||
|
|
||||||
buildTestProject(nwGUI, projPath)
|
buildTestProject(nwGUI, projPath)
|
||||||
assert nwGUI.openDocument(C.hSceneDoc) is True
|
assert nwGUI.openDocument(C.hSceneDoc) is True
|
||||||
@@ -471,6 +472,7 @@ def testGuiEditor_ContextMenu(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
|||||||
def testGuiEditor_SpellChecking(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd):
|
def testGuiEditor_SpellChecking(qtbot, monkeypatch, nwGUI, projPath, ipsumText, mockRnd):
|
||||||
"""Test the document spell checker."""
|
"""Test the document spell checker."""
|
||||||
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
|
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
|
||||||
|
monkeypatch.setattr(QMenu, "setParent", lambda *a: None)
|
||||||
|
|
||||||
buildTestProject(nwGUI, projPath)
|
buildTestProject(nwGUI, projPath)
|
||||||
assert nwGUI.openDocument(C.hSceneDoc) is True
|
assert nwGUI.openDocument(C.hSceneDoc) is True
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ def testToolWelcome_Main(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
|
|||||||
def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
|
def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
|
||||||
"""Test the open tab in the Welcome window."""
|
"""Test the open tab in the Welcome window."""
|
||||||
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
|
monkeypatch.setattr(QMenu, "exec", lambda *a: None)
|
||||||
|
monkeypatch.setattr(QMenu, "setParent", lambda *a: None)
|
||||||
|
|
||||||
CONFIG.recentProjects.update("/stuff/project_one", "Project One", 12345, 1690000000)
|
CONFIG.recentProjects.update("/stuff/project_one", "Project One", 12345, 1690000000)
|
||||||
CONFIG.recentProjects.update("/stuff/project_two", "Project Two", 54321, 1700000000)
|
CONFIG.recentProjects.update("/stuff/project_two", "Project Two", 54321, 1700000000)
|
||||||
|
|||||||
Reference in New Issue
Block a user