use icon color from project anatomy for tasks

This commit is contained in:
Jakub Trllo 2025-09-15 12:04:45 +02:00
parent 6f2cefb8bd
commit 7082905e5e
2 changed files with 14 additions and 4 deletions

View file

@ -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"),
)

View file

@ -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: