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.triggered.connect(lambda: tree.setExpandedFromHandle(tHandle, True))
action = self.addAction(self.tr("Collapse All")) action = self.addAction(self.tr("Collapse All"))
action.triggered.connect(lambda: tree.setExpandedFromHandle(tHandle, False)) action.triggered.connect(lambda: tree.setExpandedFromHandle(tHandle, False))
action = self.addAction(self.tr("Duplicate from Here"))
action.triggered.connect(lambda: tree._duplicateFromHandle(tHandle)) action = self.addAction(self.tr("Duplicate"))
elif isFile: action.triggered.connect(lambda: tree._duplicateFromHandle(tHandle))
action = self.addAction(self.tr("Duplicate Document"))
action.triggered.connect(lambda: tree._duplicateFromHandle(tHandle))
if self._item.itemClass == nwItemClass.TRASH or isRoot or (isFolder and not hasChild): if self._item.itemClass == nwItemClass.TRASH or isRoot or (isFolder and not hasChild):
action = self.addAction(self.tr("Delete Permanently")) 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()] actions = [x.text() for x in ctxMenu.actions() if x.text()]
assert actions == [ assert actions == [
"Create New ...", "Rename", "Set Status to ...", "Expand All", "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 # 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()] actions = [x.text() for x in ctxMenu.actions() if x.text()]
assert actions == [ assert actions == [
"Create New ...", "Rename", "Set Status to ...", "Transform ...", "Expand All", "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]: def getTransformSubMenu(menu: QMenu) -> list[str]:
@@ -1225,7 +1225,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
assert actions == [ assert actions == [
"Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading", "Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading",
"Toggle Active", "Set Status to ...", "Transform ...", "Expand All", "Collapse All", "Toggle Active", "Set Status to ...", "Transform ...", "Expand All", "Collapse All",
"Duplicate from Here", "Move to Trash", "Duplicate", "Move to Trash",
] ]
assert getTransformSubMenu(ctxMenu) == [ assert getTransformSubMenu(ctxMenu) == [
"Convert to Project Note", "Merge Child Items into Self", "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()] actions = [x.text() for x in ctxMenu.actions() if x.text()]
assert actions == [ assert actions == [
"Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading", "Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading",
"Toggle Active", "Set Importance to ...", "Transform ...", "Duplicate Document", "Toggle Active", "Set Importance to ...", "Transform ...", "Duplicate", "Move to Trash",
"Move to Trash",
] ]
assert getTransformSubMenu(ctxMenu) == [ assert getTransformSubMenu(ctxMenu) == [
"Split Document by Headings", "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()] actions = [x.text() for x in ctxMenu.actions() if x.text()]
assert actions == [ assert actions == [
"Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading", "Open Document", "View Document", "Create New ...", "Rename", "Rename to Heading",
"Toggle Active", "Set Status to ...", "Transform ...", "Duplicate Document", "Toggle Active", "Set Status to ...", "Transform ...", "Duplicate", "Move to Trash",
"Move to Trash",
] ]
assert getTransformSubMenu(ctxMenu) == [ assert getTransformSubMenu(ctxMenu) == [
"Convert to Novel Document", "Split Document by Headings", "Convert to Novel Document", "Split Document by Headings",