mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merge branch 'develop' into enhancement/858-move-tray-actions-to-tray-tool
This commit is contained in:
commit
784d0409b7
2 changed files with 25 additions and 13 deletions
|
|
@ -2,6 +2,7 @@ import os
|
|||
import re
|
||||
import copy
|
||||
import platform
|
||||
from typing import Optional, Dict, Any
|
||||
|
||||
import ayon_api
|
||||
|
||||
|
|
@ -16,12 +17,12 @@ from ayon_core.pipeline.template_data import get_template_data
|
|||
|
||||
|
||||
def get_workfile_template_key_from_context(
|
||||
project_name,
|
||||
folder_path,
|
||||
task_name,
|
||||
host_name,
|
||||
project_settings=None
|
||||
):
|
||||
project_name: str,
|
||||
folder_path: str,
|
||||
task_name: str,
|
||||
host_name: str,
|
||||
project_settings: Optional[Dict[str, Any]] = None,
|
||||
) -> str:
|
||||
"""Helper function to get template key for workfile template.
|
||||
|
||||
Do the same as `get_workfile_template_key` but returns value for "session
|
||||
|
|
@ -34,15 +35,23 @@ def get_workfile_template_key_from_context(
|
|||
host_name (str): Host name.
|
||||
project_settings (Dict[str, Any]): Project settings for passed
|
||||
'project_name'. Not required at all but makes function faster.
|
||||
"""
|
||||
|
||||
Returns:
|
||||
str: Workfile template name.
|
||||
|
||||
"""
|
||||
folder_entity = ayon_api.get_folder_by_path(
|
||||
project_name, folder_path, fields={"id"}
|
||||
project_name,
|
||||
folder_path,
|
||||
fields={"id"},
|
||||
)
|
||||
task_entity = ayon_api.get_task_by_name(
|
||||
project_name, folder_entity["id"], task_name
|
||||
project_name,
|
||||
folder_entity["id"],
|
||||
task_name,
|
||||
fields={"taskType"},
|
||||
)
|
||||
task_type = task_entity.get("type")
|
||||
task_type = task_entity.get("taskType")
|
||||
|
||||
return get_workfile_template_key(
|
||||
project_name, task_type, host_name, project_settings
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ class FilesModel(QtGui.QStandardItemModel):
|
|||
"""Make sure that removed items are removed from items mapping.
|
||||
|
||||
Connected with '_on_insert'. When user drag item and drop it to same
|
||||
view the item is actually removed and creted again but it happens in
|
||||
view the item is actually removed and created again but it happens in
|
||||
inner calls of Qt.
|
||||
"""
|
||||
|
||||
|
|
@ -841,7 +841,7 @@ class FilesWidget(QtWidgets.QFrame):
|
|||
self._multivalue
|
||||
)
|
||||
widget.context_menu_requested.connect(
|
||||
self._on_context_menu_requested
|
||||
self._on_item_context_menu_request
|
||||
)
|
||||
self._files_view.setIndexWidget(index, widget)
|
||||
self._files_proxy_model.setData(
|
||||
|
|
@ -859,7 +859,7 @@ class FilesWidget(QtWidgets.QFrame):
|
|||
for row in range(self._files_proxy_model.rowCount()):
|
||||
index = self._files_proxy_model.index(row, 0)
|
||||
item_id = index.data(ITEM_ID_ROLE)
|
||||
available_item_ids.add(index.data(ITEM_ID_ROLE))
|
||||
available_item_ids.add(item_id)
|
||||
|
||||
widget_ids = set(self._widgets_by_id.keys())
|
||||
for item_id in available_item_ids:
|
||||
|
|
@ -923,6 +923,9 @@ class FilesWidget(QtWidgets.QFrame):
|
|||
if menu.actions():
|
||||
menu.popup(pos)
|
||||
|
||||
def _on_item_context_menu_request(self, pos):
|
||||
self._on_context_menu_requested(pos, True)
|
||||
|
||||
def dragEnterEvent(self, event):
|
||||
if self._multivalue:
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue