ftrack module is python 2 compatible

This commit is contained in:
iLLiCiTiT 2021-03-18 09:45:07 +01:00
parent 329a39e444
commit 36eab984dd
3 changed files with 33 additions and 23 deletions

View file

@ -272,10 +272,9 @@ class PushFrameValuesToTaskEvent(BaseEvent):
if new_value == old_value:
continue
entity_key = collections.OrderedDict({
"configuration_id": attr_id,
"entity_id": entity_id
})
entity_key = collections.OrderedDict()
entity_key["configuration_id"] = attr_id
entity_key["entity_id"] = entity_id
self._cached_changes.append({
"attr_key": attr_key,
"entity_id": entity_id,

View file

@ -42,16 +42,21 @@ class FtrackModule(
self.ftrack_url = ftrack_settings["ftrack_server"]
current_dir = os.path.dirname(os.path.abspath(__file__))
self.server_event_handlers_paths = [
os.path.join(current_dir, "events"),
*ftrack_settings["ftrack_events_path"]
server_event_handlers_paths = [
os.path.join(current_dir, "events")
]
self.user_event_handlers_paths = [
os.path.join(current_dir, "actions"),
*ftrack_settings["ftrack_actions_path"]
server_event_handlers_paths.extend(
ftrack_settings["ftrack_events_path"]
)
user_event_handlers_paths = [
os.path.join(current_dir, "actions")
]
user_event_handlers_paths.extend(
ftrack_settings["ftrack_actions_path"]
)
# Prepare attribute
self.server_event_handlers_paths = server_event_handlers_paths
self.user_event_handlers_paths = user_event_handlers_paths
self.tray_module = None
def get_global_environments(self):

View file

@ -1,10 +1,16 @@
import os
import re
import queue
import json
import collections
import copy
import six
if six.PY3:
from queue import Queue
else:
from Queue import Queue
from avalon.api import AvalonMongoDB
import avalon
@ -135,7 +141,7 @@ def from_dict_to_set(data, is_project):
data.pop("data")
result = {"$set": {}}
dict_queue = queue.Queue()
dict_queue = Queue()
dict_queue.put((None, data))
while not dict_queue.empty():
@ -687,7 +693,7 @@ class SyncEntitiesFactory:
self.filter_by_duplicate_regex()
def filter_by_duplicate_regex(self):
filter_queue = queue.Queue()
filter_queue = Queue()
failed_regex_msg = "{} - Entity has invalid symbols in the name"
duplicate_msg = "There are multiple entities with the name: \"{}\":"
@ -741,7 +747,7 @@ class SyncEntitiesFactory:
) == "_notset_":
return
self.filter_queue = queue.Queue()
self.filter_queue = Queue()
self.filter_queue.put((self.ft_project_id, False))
while not self.filter_queue.empty():
parent_id, remove = self.filter_queue.get()
@ -778,8 +784,8 @@ class SyncEntitiesFactory:
selected_ids.append(entity["entityId"])
sync_ids = [self.ft_project_id]
parents_queue = queue.Queue()
children_queue = queue.Queue()
parents_queue = Queue()
children_queue = Queue()
for id in selected_ids:
# skip if already filtered with ignore sync custom attribute
if id in self.filtered_ids:
@ -1046,7 +1052,7 @@ class SyncEntitiesFactory:
if value is not None:
project_values[key] = value
hier_down_queue = queue.Queue()
hier_down_queue = Queue()
hier_down_queue.put((project_values, top_id))
while not hier_down_queue.empty():
@ -1225,7 +1231,7 @@ class SyncEntitiesFactory:
create_ftrack_ids.append(self.ft_project_id)
# make it go hierarchically
prepare_queue = queue.Queue()
prepare_queue = Queue()
for child_id in self.entities_dict[self.ft_project_id]["children"]:
prepare_queue.put(child_id)
@ -1348,7 +1354,7 @@ class SyncEntitiesFactory:
parent_id = ent_dict["parent_id"]
self.entities_dict[parent_id]["children"].remove(ftrack_id)
children_queue = queue.Queue()
children_queue = Queue()
children_queue.put(ftrack_id)
while not children_queue.empty():
_ftrack_id = children_queue.get()
@ -1361,7 +1367,7 @@ class SyncEntitiesFactory:
hierarchy_changing_ids = []
ignore_keys = collections.defaultdict(list)
update_queue = queue.Queue()
update_queue = Queue()
for ftrack_id in self.update_ftrack_ids:
update_queue.put(ftrack_id)
@ -1941,7 +1947,7 @@ class SyncEntitiesFactory:
entity["custom_attributes"][CUST_ATTR_ID_KEY] = str(new_id)
def _bubble_changeability(self, unchangeable_ids):
unchangeable_queue = queue.Queue()
unchangeable_queue = Queue()
for entity_id in unchangeable_ids:
unchangeable_queue.put((entity_id, False))
@ -2067,7 +2073,7 @@ class SyncEntitiesFactory:
self.dbcon.bulk_write(mongo_changes_bulk)
def reload_parents(self, hierarchy_changing_ids):
parents_queue = queue.Queue()
parents_queue = Queue()
parents_queue.put((self.ft_project_id, [], False))
while not parents_queue.empty():
ftrack_id, parent_parents, changed = parents_queue.get()