mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
use unchanged ayon project entity in codebase
This commit is contained in:
parent
2450f17939
commit
b227c6936c
43 changed files with 470 additions and 375 deletions
|
|
@ -3,11 +3,9 @@ import collections
|
|||
|
||||
from qtpy import QtWidgets, QtCore, QtGui
|
||||
import qtawesome
|
||||
import ayon_api
|
||||
|
||||
from ayon_core.client import (
|
||||
get_project,
|
||||
get_assets,
|
||||
)
|
||||
from ayon_core.client import get_assets
|
||||
from ayon_core.style import (
|
||||
get_default_tools_icon_color,
|
||||
get_default_entity_icon_color,
|
||||
|
|
@ -407,8 +405,8 @@ class _AssetModel(QtGui.QStandardItemModel):
|
|||
if not project_name:
|
||||
return []
|
||||
|
||||
project_doc = get_project(project_name, fields=["_id"])
|
||||
if not project_doc:
|
||||
project_entity = ayon_api.get_project(project_name, fields=["name"])
|
||||
if not project_entity:
|
||||
return []
|
||||
|
||||
# Get all assets sorted by name
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ def get_default_task_icon(color=None):
|
|||
return get_qta_icon_by_name_and_color("fa.male", color)
|
||||
|
||||
|
||||
def get_task_icon(project_doc, asset_doc, task_name):
|
||||
def get_task_icon(project_entity, asset_doc, task_name):
|
||||
"""Get icon for a task.
|
||||
|
||||
Icon should be defined by task type which is stored on project.
|
||||
|
|
@ -257,9 +257,12 @@ def get_task_icon(project_doc, asset_doc, task_name):
|
|||
return icon
|
||||
|
||||
task_type = task_info.get("type")
|
||||
task_types = project_doc["config"]["tasks"]
|
||||
task_types_by_name = {
|
||||
task_type["name"]: task_type
|
||||
for task_type in project_entity["taskTypes"]
|
||||
}
|
||||
|
||||
task_type_info = task_types.get(task_type) or {}
|
||||
task_type_info = task_types_by_name.get(task_type) or {}
|
||||
task_type_icon = task_type_info.get("icon")
|
||||
if task_type_icon:
|
||||
icon = get_qta_icon_by_name_and_color(task_icon, color)
|
||||
|
|
|
|||
|
|
@ -3,12 +3,6 @@ import logging
|
|||
|
||||
import qtpy
|
||||
from qtpy import QtCore, QtGui
|
||||
from ayon_core.client import get_projects
|
||||
from .constants import (
|
||||
PROJECT_IS_ACTIVE_ROLE,
|
||||
PROJECT_NAME_ROLE,
|
||||
DEFAULT_PROJECT_LABEL
|
||||
)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue