mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
added delete action to context menu
This commit is contained in:
parent
a993504fa8
commit
fe52e249d9
1 changed files with 16 additions and 1 deletions
|
|
@ -13,7 +13,8 @@ from openpype.lib import ApplicationManager
|
|||
from .constants import (
|
||||
REMOVED_ROLE,
|
||||
IDENTIFIER_ROLE,
|
||||
ITEM_TYPE_ROLE
|
||||
ITEM_TYPE_ROLE,
|
||||
HIERARCHY_CHANGE_ABLE_ROLE
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -497,9 +498,23 @@ class HierarchyView(QtWidgets.QTreeView):
|
|||
|
||||
# Remove delete tag on items
|
||||
removed_item_ids = []
|
||||
show_delete_items = False
|
||||
for item_id, item in items_by_id.items():
|
||||
if item.data(REMOVED_ROLE):
|
||||
removed_item_ids.append(item_id)
|
||||
elif (
|
||||
not show_delete_items
|
||||
and item.data(ITEM_TYPE_ROLE) != "project"
|
||||
and item.data(HIERARCHY_CHANGE_ABLE_ROLE)
|
||||
):
|
||||
show_delete_items = True
|
||||
|
||||
if show_delete_items:
|
||||
action = QtWidgets.QAction("Delete items", context_menu)
|
||||
action.triggered.connect(
|
||||
lambda: self._delete_items()
|
||||
)
|
||||
actions.append(action)
|
||||
|
||||
if removed_item_ids:
|
||||
action = QtWidgets.QAction("Keep items", context_menu)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue