Fix various bugs (#2242)

This commit is contained in:
Veronica Berglyd Olsen
2025-02-16 16:47:24 +01:00
committed by GitHub
4 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -246,7 +246,7 @@ careful when using this version on live writing projects, and make sure you take
markup processing and syntax highlighting. It is both slightly faster, and there are issues with
text encoding in at least some versions of Qt6 or PyQt6. PRs #2028 and #2043.
* Preparation for Qt6: Added a wrapper function for connecting signals to slots that has a
different function signature. Python lambdas generate warnings inn Qt6. PR #2075.
different function signature. Python lambdas generate warnings in Qt6. PR #2075.
* Refactored manuscript formats and moved most of the processing to the Tokenizer class to simplify
the format classes and also make them more consistent. PRs #2060, #2061 and #2062.
* The document builder has been refactored to support more generalised format classes. PR #2047.
@@ -1126,7 +1126,7 @@ _These Release Notes also include the changes from the 2.2 Beta 1 and 2.2 RC 1 r
of 1 second. PR #1634.
* The document viewer panel now shows the importance label next to each entry, and double-clicking
an entry will open it in the viewer. All entries also now show the content in tooltips so that
the columns can be shrunk to only view the icon if there is too little space. Issue #16220.
the columns can be shrunk to only view the icon if there is too little space. Issue #1620.
PR #1639.
* The editor toolbar no longer uses the same buttons for markdown and shortcodes style formatting.
They have each received their separate buttons. Some additional space has been added between the
+4 -2
View File
@@ -328,7 +328,7 @@ class ProjectModel(QAbstractItemModel):
def parent(self, index: QModelIndex) -> QModelIndex:
"""Get the parent model index of another index."""
if index.isValid() and (parent := index.internalPointer().parent()):
if index.isValid() and (node := index.internalPointer()) and (parent := node.parent()):
return self.createIndex(parent.row(), 0, parent)
return QModelIndex()
@@ -379,7 +379,9 @@ class ProjectModel(QAbstractItemModel):
row: int, column: int, parent: QModelIndex
) -> bool:
"""Check if mime data can be dropped on the current location."""
return data.hasFormat(nwConst.MIME_HANDLE) and action == Qt.DropAction.MoveAction
if parent.isValid() and parent.internalPointer() is not self._root:
return data.hasFormat(nwConst.MIME_HANDLE) and action == Qt.DropAction.MoveAction
return False
def dropMimeData(
self, data: QMimeData, action: Qt.DropAction,
+1
View File
@@ -177,6 +177,7 @@ class GuiProjectView(QWidget):
self.projTree.addAction(trash)
rename.triggered.connect(self.renameTreeItem)
delete.triggered.connect(self.projTree.processDeleteRequest)
trash.triggered.connect(self.projTree.emptyTrash)
return
##
+2 -1
View File
@@ -358,11 +358,12 @@ def testCoreItemModel_ProjectModel_DragNDrop(mockGUI, mockRnd, fncPath):
novel.item.itemHandle, folder.item.itemHandle, scene.item.itemHandle,
]
# Check that drop is possible
# Check that drop is possible, but only with valid items and not on root
invalidMime = QMimeData()
invalidMime.setData("plain/text", b"foobar")
assert model.canDropMimeData(invalidMime, Qt.DropAction.MoveAction, 0, 0, novelIdx) is False
assert model.canDropMimeData(sceneMime, Qt.DropAction.MoveAction, 0, 0, rootIdx) is False
assert model.canDropMimeData(sceneMime, Qt.DropAction.MoveAction, 0, 0, novelIdx) is True
# Drop the scene on the novel folder