Use "Duplicate" for both context menu types in project tree

This commit is contained in:
Veronica Berglyd Olsen
2024-03-03 20:37:44 +01:00
parent 58a7dc0a5a
commit 72ba4ae74d
2 changed files with 8 additions and 12 deletions
+3 -5
View File
@@ -1949,11 +1949,9 @@ class _TreeContextMenu(QMenu):
action.triggered.connect(lambda: tree.setExpandedFromHandle(tHandle, True))
action = self.addAction(self.tr("Collapse All"))
action.triggered.connect(lambda: tree.setExpandedFromHandle(tHandle, False))
action = self.addAction(self.tr("Duplicate from Here"))
action.triggered.connect(lambda: tree._duplicateFromHandle(tHandle))
elif isFile:
action = self.addAction(self.tr("Duplicate Document"))
action.triggered.connect(lambda: tree._duplicateFromHandle(tHandle))
action = self.addAction(self.tr("Duplicate"))
action.triggered.connect(lambda: tree._duplicateFromHandle(tHandle))
if self._item.itemClass == nwItemClass.TRASH or isRoot or (isFolder and not hasChild):
action = self.addAction(self.tr("Delete Permanently"))
+5 -7
View File
@@ -1196,7 +1196,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
actions = [x.text() for x in ctxMenu.actions() if x.text()]
assert actions == [
"Create New ...", "Rename", "Set Status to ...", "Expand All",
"Collapse All", "Duplicate from Here", "Delete Permanently",
"Collapse All", "Duplicate", "Delete Permanently",
]
# Context Menu on Folder Item
@@ -1207,7 +1207,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
actions = [x.text() for x in ctxMenu.actions() if x.text()]
assert actions == [
"Create New ...", "Rename", "Set Status to ...", "Transform ...", "Expand All",
"Collapse All", "Duplicate from Here", "Move to Trash",
"Collapse All", "Duplicate", "Move to Trash",
]
def getTransformSubMenu(menu: QMenu) -> list[str]:
@@ -1225,7 +1225,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
assert actions == [
"Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading",
"Toggle Active", "Set Status to ...", "Transform ...", "Expand All", "Collapse All",
"Duplicate from Here", "Move to Trash",
"Duplicate", "Move to Trash",
]
assert getTransformSubMenu(ctxMenu) == [
"Convert to Project Note", "Merge Child Items into Self",
@@ -1240,8 +1240,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
actions = [x.text() for x in ctxMenu.actions() if x.text()]
assert actions == [
"Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading",
"Toggle Active", "Set Importance to ...", "Transform ...", "Duplicate Document",
"Move to Trash",
"Toggle Active", "Set Importance to ...", "Transform ...", "Duplicate", "Move to Trash",
]
assert getTransformSubMenu(ctxMenu) == [
"Split Document by Headings",
@@ -1255,8 +1254,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
actions = [x.text() for x in ctxMenu.actions() if x.text()]
assert actions == [
"Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading",
"Toggle Active", "Set Status to ...", "Transform ...", "Duplicate Document",
"Move to Trash",
"Toggle Active", "Set Status to ...", "Transform ...", "Duplicate", "Move to Trash",
]
assert getTransformSubMenu(ctxMenu) == [
"Convert to Novel Document", "Split Document by Headings",