mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merge pull request #1438 from ynput/enhancement/1437-task-icon-color-in-tools
Tasks widget: Use icon color from project anatomy
This commit is contained in:
commit
f71b7f3cc7
2 changed files with 14 additions and 4 deletions
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import contextlib
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Dict, Any
|
||||
from typing import Any, Optional
|
||||
from dataclasses import dataclass
|
||||
|
||||
import ayon_api
|
||||
|
|
@ -51,7 +51,7 @@ class StatusItem:
|
|||
self.icon: str = icon
|
||||
self.state: str = state
|
||||
|
||||
def to_data(self) -> Dict[str, Any]:
|
||||
def to_data(self) -> dict[str, Any]:
|
||||
return {
|
||||
"name": self.name,
|
||||
"color": self.color,
|
||||
|
|
@ -125,16 +125,24 @@ class TaskTypeItem:
|
|||
icon (str): Icon name in MaterialIcons ("fiber_new").
|
||||
|
||||
"""
|
||||
def __init__(self, name, short, icon):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
short: str,
|
||||
icon: str,
|
||||
color: Optional[str],
|
||||
):
|
||||
self.name = name
|
||||
self.short = short
|
||||
self.icon = icon
|
||||
self.color = color
|
||||
|
||||
def to_data(self):
|
||||
return {
|
||||
"name": self.name,
|
||||
"short": self.short,
|
||||
"icon": self.icon,
|
||||
"color": self.color,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
|
@ -147,6 +155,7 @@ class TaskTypeItem:
|
|||
name=task_type_data["name"],
|
||||
short=task_type_data["shortName"],
|
||||
icon=task_type_data["icon"],
|
||||
color=task_type_data.get("color"),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -234,10 +234,11 @@ class TasksQtModel(QtGui.QStandardItemModel):
|
|||
)
|
||||
icon = None
|
||||
if task_type_item is not None:
|
||||
color = task_type_item.color or get_default_entity_icon_color()
|
||||
icon = get_qt_icon({
|
||||
"type": "material-symbols",
|
||||
"name": task_type_item.icon,
|
||||
"color": get_default_entity_icon_color()
|
||||
"color": color,
|
||||
})
|
||||
|
||||
if icon is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue