mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
allow to implement 'get_app_information' by host
This commit is contained in:
parent
69cb9477b6
commit
5f68e8107e
3 changed files with 39 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from .constants import ContextChangeReason
|
||||
from .abstract import AbstractHost
|
||||
from .abstract import AbstractHost, ApplicationInformation
|
||||
from .host import (
|
||||
HostBase,
|
||||
ContextChangeData,
|
||||
|
|
@ -21,6 +21,7 @@ __all__ = (
|
|||
"ContextChangeReason",
|
||||
|
||||
"AbstractHost",
|
||||
"ApplicationInformation",
|
||||
|
||||
"HostBase",
|
||||
"ContextChangeData",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import logging
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
import typing
|
||||
from typing import Optional, Any
|
||||
|
||||
|
|
@ -13,6 +14,19 @@ if typing.TYPE_CHECKING:
|
|||
from .typing import HostContextData
|
||||
|
||||
|
||||
@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
|
||||
|
||||
|
||||
class AbstractHost(ABC):
|
||||
"""Abstract definition of host implementation."""
|
||||
@property
|
||||
|
|
@ -26,6 +40,16 @@ class AbstractHost(ABC):
|
|||
"""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.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import ayon_api
|
|||
from ayon_core.lib import emit_event
|
||||
|
||||
from .constants import ContextChangeReason
|
||||
from .abstract import AbstractHost
|
||||
from .abstract import AbstractHost, ApplicationInformation
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from ayon_core.pipeline import Anatomy
|
||||
|
|
@ -96,6 +96,18 @@ class HostBase(AbstractHost):
|
|||
|
||||
pass
|
||||
|
||||
def get_app_information(self) -> ApplicationInformation:
|
||||
"""Running application information.
|
||||
|
||||
Host integration should override this method and return correct
|
||||
information.
|
||||
|
||||
Returns:
|
||||
ApplicationInformation: Application information.
|
||||
|
||||
"""
|
||||
return ApplicationInformation()
|
||||
|
||||
def install(self):
|
||||
"""Install host specific functionality.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue