mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merge branch 'develop' into enhancement/plugin-paths-interface
This commit is contained in:
commit
0d876e1c72
2 changed files with 27 additions and 10 deletions
|
|
@ -1072,10 +1072,13 @@ class IWorkfileHost:
|
|||
prepared_data=prepared_data,
|
||||
)
|
||||
|
||||
workfile_entities_by_path = {
|
||||
workfile_entity["path"]: workfile_entity
|
||||
for workfile_entity in list_workfiles_context.workfile_entities
|
||||
}
|
||||
workfile_entities_by_path = {}
|
||||
for workfile_entity in list_workfiles_context.workfile_entities:
|
||||
rootless_path = workfile_entity["path"]
|
||||
path = os.path.normpath(
|
||||
list_workfiles_context.anatomy.fill_root(rootless_path)
|
||||
)
|
||||
workfile_entities_by_path[path] = workfile_entity
|
||||
|
||||
workdir_data = get_template_data(
|
||||
list_workfiles_context.project_entity,
|
||||
|
|
@ -1114,10 +1117,10 @@ class IWorkfileHost:
|
|||
|
||||
rootless_path = f"{rootless_workdir}/{filename}"
|
||||
workfile_entity = workfile_entities_by_path.pop(
|
||||
rootless_path, None
|
||||
filepath, None
|
||||
)
|
||||
version = comment = None
|
||||
if workfile_entity:
|
||||
if workfile_entity is not None:
|
||||
_data = workfile_entity["data"]
|
||||
version = _data.get("version")
|
||||
comment = _data.get("comment")
|
||||
|
|
@ -1137,7 +1140,7 @@ class IWorkfileHost:
|
|||
)
|
||||
items.append(item)
|
||||
|
||||
for workfile_entity in workfile_entities_by_path.values():
|
||||
for filepath, workfile_entity in workfile_entities_by_path.items():
|
||||
# Workfile entity is not in the filesystem
|
||||
# but it is in the database
|
||||
rootless_path = workfile_entity["path"]
|
||||
|
|
@ -1154,13 +1157,13 @@ class IWorkfileHost:
|
|||
version = parsed_data.version
|
||||
comment = parsed_data.comment
|
||||
|
||||
filepath = list_workfiles_context.anatomy.fill_root(rootless_path)
|
||||
available = os.path.exists(filepath)
|
||||
items.append(WorkfileInfo.new(
|
||||
filepath,
|
||||
rootless_path,
|
||||
version=version,
|
||||
comment=comment,
|
||||
available=False,
|
||||
available=available,
|
||||
workfile_entity=workfile_entity,
|
||||
))
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,10 @@ def get_addons_resources_dir(addon_name: str, *args) -> str:
|
|||
return os.path.join(addons_resources_dir, addon_name, *args)
|
||||
|
||||
|
||||
class _FakeException(Exception):
|
||||
"""Placeholder exception used if real exception is not available."""
|
||||
|
||||
|
||||
class AYONSecureRegistry:
|
||||
"""Store information using keyring.
|
||||
|
||||
|
|
@ -205,7 +209,17 @@ class AYONSecureRegistry:
|
|||
"""
|
||||
import keyring
|
||||
|
||||
value = keyring.get_password(self._name, name)
|
||||
# Capture 'ItemNotFoundException' exception (on linux)
|
||||
try:
|
||||
from secretstorage.exceptions import ItemNotFoundException
|
||||
except ImportError:
|
||||
ItemNotFoundException = _FakeException
|
||||
|
||||
try:
|
||||
value = keyring.get_password(self._name, name)
|
||||
except ItemNotFoundException:
|
||||
value = None
|
||||
|
||||
if value is not None:
|
||||
return value
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue