mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
tasks widget also can know about assignees
This commit is contained in:
parent
557de8c3aa
commit
c874adfcb6
1 changed files with 9 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ from .views import DeselectableTreeView
|
|||
TASK_NAME_ROLE = QtCore.Qt.UserRole + 1
|
||||
TASK_TYPE_ROLE = QtCore.Qt.UserRole + 2
|
||||
TASK_ORDER_ROLE = QtCore.Qt.UserRole + 3
|
||||
TASK_ASSIGNEE_ROLE = QtCore.Qt.UserRole + 4
|
||||
|
||||
|
||||
class TasksModel(QtGui.QStandardItemModel):
|
||||
|
|
@ -144,11 +145,19 @@ class TasksModel(QtGui.QStandardItemModel):
|
|||
task_type_icon = task_type_info.get("icon")
|
||||
icon = self._get_icon(task_icon, task_type_icon)
|
||||
|
||||
task_assignees = set()
|
||||
assignees_data = task_info.get("assignees") or []
|
||||
for assignee in assignees_data:
|
||||
username = assignee.get("username")
|
||||
if username:
|
||||
task_assignees.add(username)
|
||||
|
||||
label = "{} ({})".format(task_name, task_type or "type N/A")
|
||||
item = QtGui.QStandardItem(label)
|
||||
item.setData(task_name, TASK_NAME_ROLE)
|
||||
item.setData(task_type, TASK_TYPE_ROLE)
|
||||
item.setData(task_order, TASK_ORDER_ROLE)
|
||||
item.setData(task_assignees, TASK_ASSIGNEE_ROLE)
|
||||
item.setData(icon, QtCore.Qt.DecorationRole)
|
||||
item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
|
||||
items.append(item)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue