Skip to content

abstract

AbstractHost

Bases: ABC

Abstract definition of host implementation.

Source code in client/ayon_core/host/abstract.py
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
class AbstractHost(ABC):
    """Abstract definition of host implementation."""
    @property
    @abstractmethod
    def log(self) -> logging.Logger:
        pass

    @property
    @abstractmethod
    def name(self) -> str:
        """Host name."""
        pass

    @abstractmethod
    def get_app_information(self) -> ApplicationInformation:
        """Information about the application where host is running.

        Returns:
            ApplicationInformation: Application information.

        """
        pass

    @abstractmethod
    def get_current_context(self) -> HostContextData:
        """Get the current context of the host.

        Current context is defined by project name, folder path and task name.

        Returns:
            HostContextData: The current context of the host.

        """
        pass

    @abstractmethod
    def set_current_context(
        self,
        folder_entity: dict[str, Any],
        task_entity: dict[str, Any],
        *,
        reason: ContextChangeReason = ContextChangeReason.undefined,
        project_entity: Optional[dict[str, Any]] = None,
        anatomy: Optional[Anatomy] = None,
    ) -> HostContextData:
        """Change context of the host.

        Args:
            folder_entity (dict[str, Any]): Folder entity.
            task_entity (dict[str, Any]): Task entity.
            reason (ContextChangeReason): Reason for change.
            project_entity (dict[str, Any]): Project entity.
            anatomy (Anatomy): Anatomy entity.

        """
        pass

    @abstractmethod
    def get_current_project_name(self) -> str:
        """Get the current project name.

        Returns:
            Optional[str]: The current project name.

        """
        pass

    @abstractmethod
    def get_current_folder_path(self) -> Optional[str]:
        """Get the current folder path.

        Returns:
            Optional[str]: The current folder path.

        """
        pass

    @abstractmethod
    def get_current_task_name(self) -> Optional[str]:
        """Get the current task name.

        Returns:
            Optional[str]: The current task name.

        """
        pass

    @abstractmethod
    def get_context_title(self) -> str:
        """Get the context title used in UIs."""
        pass

name abstractmethod property

Host name.

get_app_information() abstractmethod

Information about the application where host is running.

Returns:

Name Type Description
ApplicationInformation ApplicationInformation

Application information.

Source code in client/ayon_core/host/abstract.py
43
44
45
46
47
48
49
50
51
@abstractmethod
def get_app_information(self) -> ApplicationInformation:
    """Information about the application where host is running.

    Returns:
        ApplicationInformation: Application information.

    """
    pass

get_context_title() abstractmethod

Get the context title used in UIs.

Source code in client/ayon_core/host/abstract.py
117
118
119
120
@abstractmethod
def get_context_title(self) -> str:
    """Get the context title used in UIs."""
    pass

get_current_context() abstractmethod

Get the current context of the host.

Current context is defined by project name, folder path and task name.

Returns:

Name Type Description
HostContextData HostContextData

The current context of the host.

Source code in client/ayon_core/host/abstract.py
53
54
55
56
57
58
59
60
61
62
63
@abstractmethod
def get_current_context(self) -> HostContextData:
    """Get the current context of the host.

    Current context is defined by project name, folder path and task name.

    Returns:
        HostContextData: The current context of the host.

    """
    pass

get_current_folder_path() abstractmethod

Get the current folder path.

Returns:

Type Description
Optional[str]

Optional[str]: The current folder path.

Source code in client/ayon_core/host/abstract.py
 97
 98
 99
100
101
102
103
104
105
@abstractmethod
def get_current_folder_path(self) -> Optional[str]:
    """Get the current folder path.

    Returns:
        Optional[str]: The current folder path.

    """
    pass

get_current_project_name() abstractmethod

Get the current project name.

Returns:

Type Description
str

Optional[str]: The current project name.

Source code in client/ayon_core/host/abstract.py
87
88
89
90
91
92
93
94
95
@abstractmethod
def get_current_project_name(self) -> str:
    """Get the current project name.

    Returns:
        Optional[str]: The current project name.

    """
    pass

get_current_task_name() abstractmethod

Get the current task name.

Returns:

Type Description
Optional[str]

Optional[str]: The current task name.

Source code in client/ayon_core/host/abstract.py
107
108
109
110
111
112
113
114
115
@abstractmethod
def get_current_task_name(self) -> Optional[str]:
    """Get the current task name.

    Returns:
        Optional[str]: The current task name.

    """
    pass

set_current_context(folder_entity, task_entity, *, reason=ContextChangeReason.undefined, project_entity=None, anatomy=None) abstractmethod

Change context of the host.

Parameters:

Name Type Description Default
folder_entity dict[str, Any]

Folder entity.

required
task_entity dict[str, Any]

Task entity.

required
reason ContextChangeReason

Reason for change.

undefined
project_entity dict[str, Any]

Project entity.

None
anatomy Anatomy

Anatomy entity.

None
Source code in client/ayon_core/host/abstract.py
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
@abstractmethod
def set_current_context(
    self,
    folder_entity: dict[str, Any],
    task_entity: dict[str, Any],
    *,
    reason: ContextChangeReason = ContextChangeReason.undefined,
    project_entity: Optional[dict[str, Any]] = None,
    anatomy: Optional[Anatomy] = None,
) -> HostContextData:
    """Change context of the host.

    Args:
        folder_entity (dict[str, Any]): Folder entity.
        task_entity (dict[str, Any]): Task entity.
        reason (ContextChangeReason): Reason for change.
        project_entity (dict[str, Any]): Project entity.
        anatomy (Anatomy): Anatomy entity.

    """
    pass

ApplicationInformation dataclass

Application information.

Attributes:

Name Type Description
app_name Optional[str]

Application name. e.g. Maya, NukeX, Nuke

app_version Optional[str]

Application version. e.g. 15.2.1

Source code in client/ayon_core/host/abstract.py
17
18
19
20
21
22
23
24
25
26
27
@dataclass
class ApplicationInformation:
    """Application information.

    Attributes:
        app_name (Optional[str]): Application name. e.g. Maya, NukeX, Nuke
        app_version (Optional[str]): Application version. e.g. 15.2.1

    """
    app_name: Optional[str] = None
    app_version: Optional[str] = None