Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workfiles tool: Folder change update tasks correctly #657

Merged
merged 5 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions client/ayon_core/tools/common_models/hierarchy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import time
import collections
import contextlib
from abc import ABCMeta, abstractmethod
Expand Down Expand Up @@ -535,13 +536,15 @@ def _query_task_entities(self, project_name, task_ids):

def _refresh_tasks_cache(self, project_name, folder_id, sender=None):
if folder_id in self._tasks_refreshing:
while folder_id in self._tasks_refreshing:
time.sleep(0.01)
return

cache = self._task_items[project_name][folder_id]
with self._task_refresh_event_manager(
project_name, folder_id, sender
):
task_items = self._query_tasks(project_name, folder_id)
self._task_items[project_name][folder_id] = task_items
cache.update_data(self._query_tasks(project_name, folder_id))

def _query_tasks(self, project_name, folder_id):
tasks = list(ayon_api.get_tasks(
Expand Down
5 changes: 3 additions & 2 deletions client/ayon_core/tools/utils/tasks_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ def _refresh(self, project_name, folder_id):

def _thread_getter(self, project_name, folder_id):
task_items = self._controller.get_task_items(
project_name, folder_id
project_name, folder_id, sender=TASKS_MODEL_SENDER_NAME
)
task_type_items = {}
if hasattr(self._controller, "get_task_type_items"):
task_type_items = self._controller.get_task_type_items(
project_name
project_name, sender=TASKS_MODEL_SENDER_NAME
)
return task_items, task_type_items

Expand Down Expand Up @@ -580,6 +580,7 @@ def _update_expected_selection(self, expected_data=None):
return
if expected_data is None:
expected_data = self._controller.get_expected_selection_data()

folder_data = expected_data.get("folder")
task_data = expected_data.get("task")
if (
Expand Down