mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
added some docstrings
This commit is contained in:
parent
20cf87c07d
commit
ecd2686ad1
1 changed files with 62 additions and 33 deletions
|
|
@ -5,6 +5,13 @@ import six
|
||||||
|
|
||||||
|
|
||||||
class MissingMethodsError(ValueError):
|
class MissingMethodsError(ValueError):
|
||||||
|
"""Exception when host miss some required methods for specific workflow.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
host (HostBase): Host implementation where are missing methods.
|
||||||
|
missing_methods (list[str]): List of missing methods.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, host, missing_methods):
|
def __init__(self, host, missing_methods):
|
||||||
joined_missing = ", ".join(
|
joined_missing = ", ".join(
|
||||||
['"{}"'.format(item) for item in missing_methods]
|
['"{}"'.format(item) for item in missing_methods]
|
||||||
|
|
@ -53,15 +60,15 @@ class HostBase(object):
|
||||||
install_host(host)
|
install_host(host)
|
||||||
```
|
```
|
||||||
|
|
||||||
# TODOs
|
Todo:
|
||||||
- move content of 'install_host' as method of this class
|
- move content of 'install_host' as method of this class
|
||||||
- register host object
|
- register host object
|
||||||
- install legacy_io
|
- install legacy_io
|
||||||
- install global plugin paths
|
- install global plugin paths
|
||||||
- store registered plugin paths to this object
|
- store registered plugin paths to this object
|
||||||
- handle current context (project, asset, task)
|
- handle current context (project, asset, task)
|
||||||
- this must be done in many separated steps
|
- this must be done in many separated steps
|
||||||
- have it's object of host tools instead of using globals
|
- have it's object of host tools instead of using globals
|
||||||
|
|
||||||
This implementation will probably change over time when more
|
This implementation will probably change over time when more
|
||||||
functionality and responsibility will be added.
|
functionality and responsibility will be added.
|
||||||
|
|
@ -75,7 +82,7 @@ class HostBase(object):
|
||||||
Register DCC callbacks, host specific plugin paths, targets etc.
|
Register DCC callbacks, host specific plugin paths, targets etc.
|
||||||
(Part of what 'install' did in 'avalon' concept.)
|
(Part of what 'install' did in 'avalon' concept.)
|
||||||
|
|
||||||
NOTE:
|
Note:
|
||||||
At this moment global "installation" must happen before host
|
At this moment global "installation" must happen before host
|
||||||
installation. Because of this current limitation it is recommended
|
installation. Because of this current limitation it is recommended
|
||||||
to implement 'install' method which is triggered after global
|
to implement 'install' method which is triggered after global
|
||||||
|
|
@ -127,10 +134,10 @@ class HostBase(object):
|
||||||
|
|
||||||
Should return current context title if possible.
|
Should return current context title if possible.
|
||||||
|
|
||||||
NOTE: This method is used only for UI purposes so it is possible to
|
Note:
|
||||||
return some logical title for contextless cases.
|
This method is used only for UI purposes so it is possible to
|
||||||
|
return some logical title for contextless cases.
|
||||||
Is not meant for "Context menu" label.
|
Is not meant for "Context menu" label.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: Context title.
|
str: Context title.
|
||||||
|
|
@ -159,6 +166,9 @@ class HostBase(object):
|
||||||
|
|
||||||
This is DCC specific. Some may not allow to implement this ability
|
This is DCC specific. Some may not allow to implement this ability
|
||||||
that is reason why default implementation is empty context manager.
|
that is reason why default implementation is empty context manager.
|
||||||
|
|
||||||
|
Yields:
|
||||||
|
None: Yield when is ready to restore selected at the end.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -173,11 +183,11 @@ class ILoadHost:
|
||||||
The load plugins can do referencing even without implementation of methods
|
The load plugins can do referencing even without implementation of methods
|
||||||
here, but switch and removement of containers would not be possible.
|
here, but switch and removement of containers would not be possible.
|
||||||
|
|
||||||
QUESTIONS
|
Questions:
|
||||||
- Is list container dependency of host or load plugins?
|
- Is list container dependency of host or load plugins?
|
||||||
- Should this be directly in HostBase?
|
- Should this be directly in HostBase?
|
||||||
- how to find out if referencing is available?
|
- how to find out if referencing is available?
|
||||||
- do we need to know that?
|
- do we need to know that?
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
@ -188,6 +198,9 @@ class ILoadHost:
|
||||||
loading. Checks only existence of methods.
|
loading. Checks only existence of methods.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
HostBase: Object of host where to look for required methods.
|
||||||
|
|
||||||
|
Returns:
|
||||||
list[str]: Missing method implementations for loading workflow.
|
list[str]: Missing method implementations for loading workflow.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -202,6 +215,9 @@ class ILoadHost:
|
||||||
def validate_load_methods(host):
|
def validate_load_methods(host):
|
||||||
"""Validate implemented methods of host for load workflow.
|
"""Validate implemented methods of host for load workflow.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
HostBase: Object of host to validate.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
MissingMethodsError: If there are missing methods on host
|
MissingMethodsError: If there are missing methods on host
|
||||||
implementation.
|
implementation.
|
||||||
|
|
@ -216,7 +232,7 @@ class ILoadHost:
|
||||||
|
|
||||||
This can be implemented in hosts where referencing can be used.
|
This can be implemented in hosts where referencing can be used.
|
||||||
|
|
||||||
TODO:
|
Todo:
|
||||||
Rename function to something more self explanatory.
|
Rename function to something more self explanatory.
|
||||||
Suggestion: 'get_referenced_containers'
|
Suggestion: 'get_referenced_containers'
|
||||||
|
|
||||||
|
|
@ -242,6 +258,9 @@ class IWorkfileHost:
|
||||||
Method is used for validation of implemented functions related to
|
Method is used for validation of implemented functions related to
|
||||||
workfiles. Checks only existence of methods.
|
workfiles. Checks only existence of methods.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
HostBase: Object of host where to look for required methods.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list[str]: Missing method implementations for workfiles workflow.
|
list[str]: Missing method implementations for workfiles workflow.
|
||||||
"""
|
"""
|
||||||
|
|
@ -264,6 +283,9 @@ class IWorkfileHost:
|
||||||
def validate_workfile_methods(host):
|
def validate_workfile_methods(host):
|
||||||
"""Validate implemented methods of host for workfiles workflow.
|
"""Validate implemented methods of host for workfiles workflow.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
HostBase: Object of host to validate.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
MissingMethodsError: If there are missing methods on host
|
MissingMethodsError: If there are missing methods on host
|
||||||
implementation.
|
implementation.
|
||||||
|
|
@ -276,9 +298,10 @@ class IWorkfileHost:
|
||||||
def file_extensions(self):
|
def file_extensions(self):
|
||||||
"""Extensions that can be used as save.
|
"""Extensions that can be used as save.
|
||||||
|
|
||||||
QUESTION: This could potentially use 'HostDefinition'.
|
Questions:
|
||||||
|
This could potentially use 'HostDefinition'.
|
||||||
|
|
||||||
TODO:
|
Todo:
|
||||||
Rename to 'get_workfile_extensions'.
|
Rename to 'get_workfile_extensions'.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -288,7 +311,7 @@ class IWorkfileHost:
|
||||||
def save_file(self, dst_path=None):
|
def save_file(self, dst_path=None):
|
||||||
"""Save currently opened scene.
|
"""Save currently opened scene.
|
||||||
|
|
||||||
TODO:
|
Todo:
|
||||||
Rename to 'save_current_workfile'.
|
Rename to 'save_current_workfile'.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
@ -302,7 +325,7 @@ class IWorkfileHost:
|
||||||
def open_file(self, filepath):
|
def open_file(self, filepath):
|
||||||
"""Open passed filepath in the host.
|
"""Open passed filepath in the host.
|
||||||
|
|
||||||
TODO:
|
Todo:
|
||||||
Rename to 'open_workfile'.
|
Rename to 'open_workfile'.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
@ -315,7 +338,7 @@ class IWorkfileHost:
|
||||||
def current_file(self):
|
def current_file(self):
|
||||||
"""Retreive path to current opened file.
|
"""Retreive path to current opened file.
|
||||||
|
|
||||||
TODO:
|
Todo:
|
||||||
Rename to 'get_current_workfile'.
|
Rename to 'get_current_workfile'.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
@ -342,16 +365,16 @@ class IWorkfileHost:
|
||||||
def work_root(self, session):
|
def work_root(self, session):
|
||||||
"""Modify workdir per host.
|
"""Modify workdir per host.
|
||||||
|
|
||||||
WARNING:
|
|
||||||
We must handle this modification with more sofisticated way because
|
|
||||||
this can't be called out of DCC so opening of last workfile
|
|
||||||
(calculated before DCC is launched) is complicated. Also breaking
|
|
||||||
defined work template is not a good idea.
|
|
||||||
Only place where it's really used and can make sense is Maya. There
|
|
||||||
workspace.mel can modify subfolders where to look for maya files.
|
|
||||||
|
|
||||||
Default implementation keeps workdir untouched.
|
Default implementation keeps workdir untouched.
|
||||||
|
|
||||||
|
Warnings:
|
||||||
|
We must handle this modification with more sofisticated way because
|
||||||
|
this can't be called out of DCC so opening of last workfile
|
||||||
|
(calculated before DCC is launched) is complicated. Also breaking
|
||||||
|
defined work template is not a good idea.
|
||||||
|
Only place where it's really used and can make sense is Maya. There
|
||||||
|
workspace.mel can modify subfolders where to look for maya files.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
session (dict): Session context data.
|
session (dict): Session context data.
|
||||||
|
|
||||||
|
|
@ -381,6 +404,9 @@ class INewPublisher:
|
||||||
new publish creation. Checks only existence of methods.
|
new publish creation. Checks only existence of methods.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
HostBase: Object of host where to look for required methods.
|
||||||
|
|
||||||
|
Returns:
|
||||||
list[str]: Missing method implementations for new publsher
|
list[str]: Missing method implementations for new publsher
|
||||||
workflow.
|
workflow.
|
||||||
"""
|
"""
|
||||||
|
|
@ -399,6 +425,9 @@ class INewPublisher:
|
||||||
def validate_publish_methods(host):
|
def validate_publish_methods(host):
|
||||||
"""Validate implemented methods of host for create-publish workflow.
|
"""Validate implemented methods of host for create-publish workflow.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
HostBase: Object of host to validate.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
MissingMethodsError: If there are missing methods on host
|
MissingMethodsError: If there are missing methods on host
|
||||||
implementation.
|
implementation.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue